Coder Social home page Coder Social logo

blackbot's Introduction

BlackBot

BlackBot is a Python bot implementing a grid trading strategy. It can work with any assets pair on the Waves DEX.

Grid trading doesn’t care about which way the market’s going — in fact, as a profitable strategy it works best in ranging markets. The strategy places a ladder of sells at regular intervals above market price, and another ladder of buys beneath it. If a sell is filled, those funds are used to place a buy just beneath that sell. Thus you can think of the grid as a series of pairs of buys/sells stretching up and down the price chart, with either the buy or sell in each pair always active.

For example, let’s say the last price is 2000 satoshis you’ve got sells laddered up at 2100, 2200, 2300… If the price hits 2100, you immediately use those funds to place a new buy at 2000. If it drops to 2000 again, you buy back the Incent you sold at 2100. If it rises further, you sell at 2200 and open a buy at 2100. Whichever way the price moves, you’re providing depth — buffering the market and smoothing out any peaks and troughs. Additionally, if you open and then close a trade within a tranche (e.g. you sell at 2200, then buy back at 2100) then you make a small profit.

Getting Started

BlackBot requires Python 2.7 or 3.x and the following Python packages:

  • PyWaves
  • ConfigParser (with Python 2.7)
  • configparser (with Python 3.x)

You can install them with

pip install pywaves
pip install ConfigParser (python 2.7)
pip install configparser (python 3.x)

You can start BlackBot with this command:

python BlackBot.py sample-bot.cfg

below you can find a sample configuration file:

[main]
node = http://nodes.wavesnodes.com
matcher = http://matcher.wavesnodes.com
order_fee = 300000
order_lifetime = 86400

[account]
private_key = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

[market]
amount_asset = WAVES
price_asset = 8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS

[grid]
interval = 0.005
tranche_size = 200000000
grid_levels = 20
base = last
type = symmetric
 
[logging]
logfile = bot.log

main section

node is the address of the fullnode

matcher is the matcher address

order_fee is the fee to place buy and sell orders

order_lifetime is the maximum life time (in seconds) for an open order

account section

private_key is the private key of the trading account

market section

amount_asset and price_asset are the IDs of the traded assets pair

grid section

interval is the % interval between grid levels

tranche_size is the size amount of each buy and sell order

grid_levels is the number of grid levels

base is the price level around which the grid is setup; it can be LAST, for the last traded price, BID for the current bid price, ASK for the current ask price or a fixed constant price can be specified

flexibility amount flexibility in percent, 20% flexibility means that the amount of the order might flucture +/- 10% around the defined tranche_size

type the initial grid can be SYMMETRIC, if there are both buy and sell orders; BIDS if the are only buy orders; ASKS if there are only sell orders

logging section

logfile is the file where the log will be written

blackbot's People

Contributors

jansenmarc avatar kinbitz avatar marcjansen-tommapps avatar pywaves avatar sabotagebeats avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.