[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@xeroc·
0.000 HBD
[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares
I am proud to now publicly announce the first release of *StakeMachine*.

# What is it?

It is a Python tool that offers:

* a unified framework for writing bots for the DEX
* a simple market making strategy
* the [liquidity-providing strategy](https://steemit.com/bitshares/@linouxis9/liqbot-0) developed by @mauritso
* more strategies to come soon.

# Simple Market Making

A simple market making strategy (i.e. providing liquidity) works as follows:

1. Get the `last price` for your market
2. Place a buy order at `last price * 95%`
3. Place a sell order at `last price * 105%`
4. Wait for any of the two orders to get filled
5. Cancel the other order
6. Go to 1.

This strategy is very simple and tries to makes a profit *from the spread*. The more volatile a market is, the more profit it will (probably) make you.

# Usage

## Requirements

* python 3

## Installation
```
git clone https://github.com/xeroc/stakemachine
cd stakemachine
python3 setup.py install --user -r requirements.txt
```

## Configuration

There is an example YAML formatted configuration file called `config-example.yml`.
The general configuration looks like this

```yaml
witness_url: "wss://bitshares.openledger.info/ws"
prefix: "BTS"
safe_mode: True
account: "<accountname>"
wif: "<active-private-key-for-account>"
market_separator: ":"

bots:
    MakerWall:
        module: "stakemachine.strategies.maker"
        bot: "MakerSellBuyWalls"
        markets:
            - "USD:BTS"
        target_price: "last"
        target_price_offset_percentage: 1
        spread_percentage: 5
        volume_percentage: 50
        symmetric_sides: True
        only_buy: False
        only_sell: False
```

## Advanced Settings

As you can see, the idea is to

* Allow different strategies to be added easily
* Different parameters for different bots
* Multiple bots in parallel

```
bots:
    MakerWallBitAssets:
        module: "stakemachine.strategies.maker"
        bot: "MakerSellBuyWalls"
        markets:
            - "USD:BTS"
            - "GOLD:BTS"
        target_price: "last"
        target_price_offset_percentage: 1
        spread_percentage: 5
        volume_percentage: 50
        symmetric_sides: True
        only_buy: False
        only_sell: False

    MakerWallBTCBridge5:
        module: "stakemachine.strategies.maker"
        bot: "MakerSellBuyWalls"
        markets:
            - "OPEN.BTC:BTC"
            - "OPEN.BTC:TRADE.BTC"
            - "TRADE.BTC:BTC"
        target_price: 1.0
        target_price_offset_percentage: 0
        spread_percentage: 5
        volume_percentage: 50
        symmetric_sides: True
        only_buy: False
        only_sell: False

    MakerWallBTCBridge10:
        module: "stakemachine.strategies.maker"
        bot: "MakerSellBuyWalls"
        markets:
            - "OPEN.BTC:BTC"
            - "OPEN.BTC:TRADE.BTC"
            - "TRADE.BTC:BTC"
        target_price: 1.0
        target_price_offset_percentage: 0
        spread_percentage: 10
        volume_percentage: 50
        symmetric_sides: True
        only_buy: False
        only_sell: False
```

## Running the bot

Once the configuration is done, you can run your bot (with `safe_mode` on) using
```
stakemachine -c config.yml once
```
or
```
stakemachine -c config.yml run
```

# Roadmap

Extend the python-graphene library to allow

* Core Exchange Rate tracking
* Refilling of Fee Pools
* More trading strategies (heuristic, EMA-crossings, etc.)
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,