Skip to main content

The makerbot is a cryptocurrency market-maker bot that is easy to understand and customize. Its goal is to create a useful practical tool to begin trading digital assets algorithmically. The bot provides a skeleton to build upon for traders wanting to perform market-maker strategies. Its default configuration should allow for trading on Nash out of the box, so users can start quickly.

Requires Python 3.7

This software is a beta. It works as intended but several improvements are expected in the near term.

Quick install guide

First you will need a Nash (https://nash.io) account with 2FA disabled. The login credentials will be asked after starting the bot.

Install a Python 3 package manager if you do not already have one:

  • On Ubuntu/Debian: sudo apt install python3-pip

  • On Fedora/CentOS: sudo dnf install python3-pip

  • On Mac OSX, first install Homebrew, then Python 3:

    • /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    • brew install python3

  • Using pip, install the bot:

    • as a user: pip3 install --user nash-makerbot

    • as root: pip3 install -U nash-makerbot

  • Get the example configuration file provided here: $ wget https://gitlab.com/nash-io-public/nash-makerbot/raw/master/default.ini

  • Update your $PATH to include the makerbot command by either re-entering the terminal or:source ~/.bashrc

  • Start the bot: makerbot start eth_usdc --config=default.ini

How it works

This bot implements a simple symmetric market-maker algorithm. It is based on the idea that there is intrinsic volatility within a market, as shown in the image below, and will trade within a fixed spread.

Market volatility

When the bot starts, it watches the order book for the chosen market until it gets min_history_points updates or a maximum time of max_loading_time passes. The order book is stored in the OrderBookSeries object. This is a NamedTuple with two fields wrapping around two NumPy.Array s, one obs.t that contains the time in which each snapshot of the order book was recorded and another obs.data that contains the snapshots of the order book.

  1. The bot will place the first buy order, the scrum buy. It is defined as setup_scrum_buy.

Scrum buy
  1. If the price goes up, the scrum buy order will be filled. In that case, the bot will place a new buy order buy 1 with a price buy_down_interval lower than the microprice.

docs/fig/2_buy_1.png
  1. At the same time as placing buy 1, a sell order corresponding to the scrum buy sell (sb) will be placed at a price straddle higher than buy 1. The bot has now become a market maker, since it has both buy and sell orders open in the limit order book.

docs/fig/3_maker1.png
  1. As the market continues to move, the bot will place buy and sell orders according to its volatility. For each new buy order, a corresponding sell order will be placed.

docs/fig/4_maker2.png

Users are invited to take a closer look at the functions the bot follows when placing its orders: should_rebuy, should_place_buy, get_buy_order and size_order.

  • should_rebuy determines if the bot should cancel the current open buy order. This is needed, for example, if the spread between the lowest sell and the current buy is too big or if the market has moved up and the probability of the buy order executing is now low.

  • should_place_buy looks at market microstructure and determines if now is a good moment to place a new buy order.

  • get_buy_order determines the price of buy orders.

  • size_order determines the size of buy orders.

Todo

  • [ ] Refactor to make code more pythonic and clean

  • [ ] Add testing everywhere

  • [ ] Generalize for custom strategy

  • [ ] Create web UI

  • [ ] Add historical data collection

  • [ ] Allow simulation of a strategy and track expected performance.

License

This software uses the MIT License. You are free to use it for profit or include it in other closed-source projects.

History

0.1.5 (2019-12-12)

  • Fix top bid check

0.1.4 (2019-12-08)

  • Adjust timings

  • Make retry use pg backoff

  • Respect min base amount on orders

0.1.3 (2019-12-06)

  • Fix typos

0.1.1 (2019-12-06)

  • Add basic documentation

  • Bump nash-api requirement to 1.0.6 to allow LINK trading

  • Remove some dead code

0.1.0 (2019-12-04)

  • Public release

Metadata

Release files for nash-makerbot 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nash-makerbot 0.1.5
File Size Uploaded
nash-makerbot-0.1.5.tar.gz 13.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nash-makerbot 0.1.5
File Interpreter ABI Platform
nash_makerbot-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / nash-makerbot-0.1.5.tar.gz

Download URL nash-makerbot-0.1.5.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
07315818c7b84d9e73a7634601c41be38c5d8f5983c59f73b07e0ef5ef1c0e2a
BLAKE2b-256 checksum
How to use checksums
62f03fdb5b3a7c440fb39d4d2a073c852c9828ab100b29dff01a18309a14f52e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

Release files / nash_makerbot-0.1.5-py3-none-any.whl

Download URL nash_makerbot-0.1.5-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1e8c631edc01fdd1c88c7c72e84e39eab44e3346226bf6a7b61f15c708795c5f
BLAKE2b-256 checksum
How to use checksums
52e4c588a3fc4997a20f374e146cff9843e8ff0cc0eaa88f51866f34c55d8d2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.5

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page