Skip to content
XBridge market making bot
Python
Branch: master
Clone or download
Latest commit 95c68ba Oct 2, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
utils instructions Mar 29, 2019
.gitignore improved readme + cleanup Mar 14, 2019
LICENSE Create LICENSE Jun 14, 2018
README.md Update installation instructions Oct 2, 2019
dxmakerbot.py instructions Mar 29, 2019
dxtaker.py updated dxbottools w/ additional functions and wip taker script Jan 2, 2019
requirements.txt refactoring: Dec 22, 2018

README.md

DX Maker Bot

A market making bot for Blocknet's decentralized exchange protocol, built with the XBridge API.

Website Blocknet API Blocknet Docs Discord

Prerequisites

  1. Latest Blocknet wallet installed.
  2. The wallet of any assets you will be trading. See list of compatible assets.
  3. The Blocknet wallet and any other wallet you're trading out of must but fully synced and fully unlocked.
  4. The wallets used for trading must be configured. For simple setup, use Block DX's automated configuration setup wizard. Having Block DX installed and opened is also useful to visually monitor the market and your open orders.
  5. Make sure funds are split into multiple UTXOs. If you have an order for 1 LTC and you only have a single 10 LTC input, all 10 LTC will be locked in this order. Having multiple, preferably smaller, UTXOs will allow a better distribution of funds across orders.
  6. Make sure funds are in legacy addresses (Eg. LTC funds should be in a "L" address).

Installation

Linux

  1. Open the command line terminal to enter the following commands
  2. Install Python 3: apt-get install python3
    • Or upgrade Python 3: apt-get upgrade python3
  3. Install pip (Python's package manager): apt-get install python3-pip
    • Or upgrade pip: apt-get upgrade python3-pip
  4. Download DX Maker Bot
    • Download via Git:
      1. Navigate to your project directory
        • Example: cd ~/projects/
      2. Download DX Maker Bot: git clone https://github.com/blocknetdx/dxmakerbot
    • Download via Github:
      1. Navigate to https://github.com/blocknetdx/dxmakerbot
      2. Click the green Clone or download button and select Download ZIP from the dropdown
      3. Save the file and (if necessary) extract the contents to a folder
  5. Navigate into the dxmakerbot folder
    • Example: cd ~/projects/dxmakerbot
  6. Install the required DX Maket Bot packages: pip3 install -r requirements.txt
    • If that command does not work: pip install -r requirements.txt

MacOS

  1. Open Terminal to enter the following commands
  2. Install XCode: xcode-select --install
  3. Install Homebrew (MacOS package manager): /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  4. Install Python 3: brew install python3
  5. Upgrade pip (Python's package manager): pip3 install -U pip
  6. Download DX Maker Bot
    • Download via Git:
      1. Navigate to your project directory
        • Example: cd ~/Documents/projects/
      2. Download DX Maker Bot: git clone https://github.com/blocknetdx/dxmakerbot
    • Download via Github:
      1. Navigate to https://github.com/blocknetdx/dxmakerbot
      2. Click the green Clone or download button and select Download ZIP from the dropdown
      3. Save the file and (if necessary) extract the contents to a folder
  7. Navigate into the dxmakerbot folder
    • Example: cd ~/Documents/dxmakerbot
  8. Install the required DX Maket Bot packages: pip3 install -r requirements.txt

Windows

  1. Install Python 3:
    1. Navigate to https://www.python.org/downloads/windows/ and select Download Python 3.7.x
    2. Run the installer
    3. Check off Add Python 3.7 to PATH
    4. Click Install Now
  2. Right-click the taskbar Start menu and select Command Prompt (Admin)
  3. Upgrade pip (Python's package manager): py -m pip install --upgrade pip
  4. Download DX Maker Bot
    • Download via Git:
      1. Navigate to your project directory
        • Example: cd ~/projects/
      2. Download DX Maker Bot: git clone https://github.com/blocknetdx/dxmakerbot
    • Download via Github:
      1. Navigate to https://github.com/blocknetdx/dxmakerbot
      2. Click the green Clone or download button and select Download ZIP from the dropdown
      3. Save the file and (if necessary) extract the contents to a folder
  5. Navigate into the dxmakerbot folder
    • Example: cd C:\Users\%USERNAME%\Downloads\dxmakerbot
  6. Install the required DX Maket Bot packages: pip3 install -r requirements.txt
    • If that command does not work: pip install -r requirements.txt

Configuration

  1. Open dxmakerbot/utils/dxsettings.py.
  2. Edit the trading addresses to match the wallet addresses containing funds split into multiple UTXOs.
    • Make sure funds are in legacy addresses (Eg. LTC funds should be in a "L" address).
  3. Edit rpcuser =, rpcpassword =, and rpcport = to the same values used in the Blocknet client's blocknetdx.conf file.
  4. Save and close the file.

Example dxsettings.py file:

tradingaddress = {}
tradingaddress['SYS'] = "SbaRDo3taq1zmAba2Ak54fRxAz8Z9rkyPw"
tradingaddress['LTC'] = "LZdTPLFqQzxuoSfyRioUSMyPvlsrnpGVWR"
tradingaddress['BLOCK'] = "B2cBqpuEXu4tVS5prBd5zyeqvBTSi6g398"
tradingaddress['DGB'] = "D3F4pdn7CGZ4kxFUvdMbflyJ8cRqfwsurj"
rpcport = 41414
rpcuser = 'blocknetbot'
rpcpassword = 'blocknetbot123'

Custom Pricing

The bot supports pricing from Bittrex, CryptoBridge, CoinGecko, or custom price sources. If using custom price sources:

  1. Add a price source to be used for each asset that will be traded.
    • Example: apiendpoint['__asset__'] = '_url_'
  2. Custom price source endpoints must return BTC price.
    • The default function getprice() in utils/custompricing.py expects only a value to be returned.
      • Example: 0.0150147175974065 or 4.03393625609417E-6
  3. If the price source returns json:
    • Add the asset to one of the existing custom request lists or create a new one.
      • Example: customrequest1 = ['_asset1_', '_asset2_']
      • Each list will use a different custom exception to target the json (see next).
    • Create a custom exception in getprice() in utils/custompricing.py, using existing customrequest1 as guide.

Example custom price settings:

apiendpoint = {}
apiendpoint['SYS'] = 'https://chainz.cryptoid.info/sys/api.dws?q=ticker.btc'
apiendpoint['BLOCK'] = 'https://chainz.cryptoid.info/block/api.dws?q=ticker.btc'
apiendpoint['LTC'] = 'https://chainz.cryptoid.info/ltc/api.dws?q=ticker.btc'
apiendpoint['MUE'] = 'https://api.cryptonator.com/api/full/mue-btc'

customrequest1 = ['MUE']
customrequest2 = []
customrequest3 = []

Running the Bot

  1. Run the wallets of any assets being traded (fully synced, unlocked).
  2. Run the Blocknet wallet (fully synced, unlocked).
  3. Optional: Run Block DX for visual reference that the bot is working.
    • At this stage it would be a good idea to test making/taking an order without using the bot to ensure everything is setup properly.
  4. Navigate to the dxmakerbot directory in the terminal.

Maker Bot Usage

  • Pricing is based off BTC-XXX market pairs. For example, if running on the LTC-DASH market, the bot pulls the price for BTC-LTC and BTC-DASH then automatically calculates LTC-DASH price. This is how it works for all supported pricing sources:
    • Bittrex: default (no flag)
    • CryptoBridge: --usecb
    • CoinGecko: --usecg
    • Custom pricing: --usecustom

Use the following command format to start the bot:

python3 dxmakerbot.py --maker [] --taker [] --sellmin [] --sellmax [] --slidemin [] --slidemax []
Flag Default Description
--maker BLOCK Asset being sold
--taker LTC Asset being bought
--sellmin 0.001 Min maker sell order size
--sellmax 1 Max maker sell order size
--slidemin 1.000001 Min order price multiplier: Min order price = slidemin * price source quote
--slidemax 1.019999 Max order price multiplier: Min order price = slidemax * price source quote
--delay 3 Sleep delay between loops to place/cancel orders (seconds)
--maxloop 7 Number of loops before canceling the oldest order
--maxopen 5 Max amount of orders to have open at any given time
--minbalance 10 Min balance you want to maintain of the asset being sold
--usecb* disabled Use CryptoBridge prices (both assets must be listed on CryptoBridge)
--usecg* disabled Use CoinGecko prices (both assets must be listed on CoinGecko)
--usecustom* disabled Use custom price sources from utils/dxsettings.py
--cancelall* Cancel all orders and exit program
--cancelmarket* Cancel all orders in a given market

* = optional

Example command:

python3 dxmakerbot.py --maker SYS --taker LTC --sellmin 5 --sellmax 115 --slidemin 1.00111 --slidemax 1.1111 --usecustom
You can’t perform that action at this time.