create account

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

View this thread on: hive.blogpeakd.comecency.com
· @xeroc · (edited)
$309.25
[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.)
πŸ‘  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
properties (23)
authorxeroc
permlinkstakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares
categorybitshares
json_metadata{"users":["mauritso"],"links":["https://steemit.com/bitshares/@linouxis9/liqbot-0"]}
created2016-05-28 09:04:18
last_update2016-05-29 16:22:36
depth0
children15
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value154.649 HBD
curator_payout_value154.598 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,449
author_reputation118,819,064,085,695
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,486
net_rshares60,296,496,999,294
author_curate_reward""
vote details (59)
@chris4210 ·
$0.34
This is great!! Everybody can now use their  idling funds to add some liqudity in the markets and earn a profit!! Great work Xeroc!
πŸ‘  
properties (23)
authorchris4210
permlinkre-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160528t094341010z
categorybitshares
json_metadata{}
created2016-05-28 09:43:39
last_update2016-05-28 09:43:39
depth1
children2
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.172 HBD
curator_payout_value0.172 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length131
author_reputation40,042,535,242,490
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,509
net_rshares884,917,544,305
author_curate_reward""
vote details (1)
@xeroc ·
I wouldn't claim this makes a profit for sure .. but the strategy is easy enough for people to understand it makes sense and may make a profit
properties (22)
authorxeroc
permlinkre-chris4210-re-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160528t094501548z
categorybitshares
json_metadata{}
created2016-05-28 09:45:00
last_update2016-05-28 09:45:00
depth2
children1
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length142
author_reputation118,819,064,085,695
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,510
net_rshares0
@vdoh ·
Hello! Prompt as it is possible to use a boat for trade at the internal exchange steemit!? What changes need to be entered into a code? Yours faithfully Irina =)
properties (22)
authorvdoh
permlinkre-xeroc-re-chris4210-re-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160720t154922118z
categorybitshares
json_metadata{"tags":["bitshares"]}
created2016-07-20 15:49:21
last_update2016-07-20 15:49:21
depth3
children0
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length161
author_reputation1,080,788,865,995
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id222,060
net_rshares0
@cm-steem ·
https://steemit.com/gridcoin/@cm-steem/brainstorming-new-boinc-projects-anyone-can-create-a-project-and-reward-their-users-with-gridcoin#@cm-steem/re-cm-steem-brainstorming-new-boinc-projects-anyone-can-create-a-project-and-reward-their-users-with-gridcoin-20160812t153824382z

Thoughts, @Xeroc?
πŸ‘  
properties (23)
authorcm-steem
permlinkre-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160812t170512005z
categorybitshares
json_metadata{"tags":["bitshares"],"links":["https://steemit.com/gridcoin/@cm-steem/brainstorming-new-boinc-projects-anyone-can-create-a-project-and-reward-their-users-with-gridcoin#@cm-steem/re-cm-steem-brainstorming-new-boinc-projects-anyone-can-create-a-project-and-reward-their-users-with-gridcoin-20160812t153824382z"]}
created2016-08-12 17:05:12
last_update2016-08-12 17:05:12
depth1
children0
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length295
author_reputation58,522,774,254,119
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id767,944
net_rshares2,692,526,759
author_curate_reward""
vote details (1)
@cm-steem ·
Hey @xeroc,

Are you planning on continuing development of the stakemachine?

Thanks,
CM.
properties (22)
authorcm-steem
permlinkre-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20170530t174340640z
categorybitshares
json_metadata{"tags":["bitshares"],"users":["xeroc"],"app":"steemit/0.1"}
created2017-05-30 17:43:36
last_update2017-05-30 17:43:36
depth1
children3
last_payout2017-06-06 17:43:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length89
author_reputation58,522,774,254,119
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id3,965,797
net_rshares0
@xeroc ·
$0.23
I have already started working on migrating it over to pybitshares .. just notfinished yet ..
might take quite some time until this can be released .. much stuff going on right now
πŸ‘  ,
properties (23)
authorxeroc
permlinkre-cm-steem-re-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20170530t174903466z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-05-30 17:49:03
last_update2017-05-30 17:49:03
depth2
children2
last_payout2017-06-06 17:49:03
cashout_time1969-12-31 23:59:59
total_payout_value0.190 HBD
curator_payout_value0.044 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length180
author_reputation118,819,064,085,695
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id3,965,965
net_rshares114,910,039,797
author_curate_reward""
vote details (2)
@cm-steem ·
Cool, looking forwards to future releases :)

Perhaps consider a worker proposal? I'd vote for it! :D
πŸ‘  
properties (23)
authorcm-steem
permlinkre-xeroc-re-cm-steem-re-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20170530t181313758z
categorybitshares
json_metadata{"tags":["bitshares"],"app":"steemit/0.1"}
created2017-05-30 18:13:12
last_update2017-05-30 18:13:12
depth3
children1
last_payout2017-06-06 18:13:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length101
author_reputation58,522,774,254,119
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id3,966,667
net_rshares0
author_curate_reward""
vote details (1)
@finfree ·
Sorry that this question may not directly related to stakemachine. Can python-graphene be run on Windows with python3 installed?
properties (22)
authorfinfree
permlinkre-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160528t154257126z
categorybitshares
json_metadata{}
created2016-05-28 15:42:57
last_update2016-05-28 15:42:57
depth1
children1
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length128
author_reputation7,268,713,657
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,782
net_rshares0
@xeroc ·
Technically it should also work on Windows, however, I don't have a windows machine around so I cannot check it.
πŸ‘  
properties (23)
authorxeroc
permlinkre-finfree-re-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160529t162402554z
categorybitshares
json_metadata{}
created2016-05-29 16:24:03
last_update2016-05-29 16:24:03
depth2
children0
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length112
author_reputation118,819,064,085,695
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id17,902
net_rshares559,926,808
author_curate_reward""
vote details (1)
@jbbasics ·
Hey @xeroc ! I’ve recently been trying to get stakemachine working but am having some difficulty. I know you mentioned you were making some changes with it... are these changes still in progress? I’ve used your stakemachine pdf you posted a couple months ago to copy the walls config but still can’t get the walls to work. I posted on GitHub. Anyway, if you have any additional guidance or documentation that could help I would greatly appreciate it. I’m new to both Ubuntu and python but willing to put in some work. Thanks
πŸ‘  
properties (23)
authorjbbasics
permlinkre-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20171210t191121647z
categorybitshares
json_metadata{"tags":["bitshares"],"users":["xeroc"],"app":"steemit/0.1"}
created2017-12-10 19:11:21
last_update2017-12-10 19:11:21
depth1
children0
last_payout2017-12-17 19:11:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length524
author_reputation527,662,449,377
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id23,028,895
net_rshares0
author_curate_reward""
vote details (1)
@mostar ·
$1.32
How can i check it on the testnet?
πŸ‘  , ,
properties (23)
authormostar
permlinkre-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160528t104418243z
categorybitshares
json_metadata{}
created2016-05-28 10:49:12
last_update2016-05-28 10:49:12
depth1
children1
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value1.144 HBD
curator_payout_value0.176 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length34
author_reputation597,943,331,552
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,539
net_rshares1,372,171,466,247
author_curate_reward""
vote details (3)
@mauritso ·
$0.45
change:
1. witness_url: "wss://bitshares.openledger.info/ws" to a testnet witness ("ws://testnet.bitshares.eu/ws" for example),
2. "BTS" to "TEST"
3. "markets:" to markets on the testnet
πŸ‘  , ,
πŸ‘Ž  
properties (23)
authormauritso
permlinkre-mostar-re-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160528t110228245z
categorybitshares
json_metadata{}
created2016-05-28 11:02:27
last_update2016-05-28 11:02:27
depth2
children0
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.226 HBD
curator_payout_value0.226 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length186
author_reputation4,155,298,873,736
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,548
net_rshares1,109,718,758,585
author_curate_reward""
vote details (4)
@mostar ·
$0.97
So, the liquidity-providing strategy is other software that base on your library?  
As i understand it need cli_wallet and your not !?
πŸ‘  
properties (23)
authormostar
permlinkre-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160528t104710580z
categorybitshares
json_metadata{}
created2016-05-28 10:52:03
last_update2016-05-28 10:52:03
depth1
children1
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.968 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length134
author_reputation597,943,331,552
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,543
net_rshares468,998,864,094
author_curate_reward""
vote details (1)
@mauritso · (edited)
$0.07
It's a strategy that uses @xeroc 's bot infrastructure combined with deployment/automatic registration scripts.
In StakeMachine the strategy is updated to work without cli_wallet, those changes (and more) will be implemented in the next release of LiqBot.
πŸ‘  , , ,
properties (23)
authormauritso
permlinkre-mostar-re-xeroc-stakemachine-trading-infrastructure-and-simple-market-making-bot-for-bitshares--opensource-bot-for-bitshares-20160528t110938629z
categorybitshares
json_metadata{"users":["xeroc"]}
created2016-05-28 11:09:39
last_update2016-05-28 11:09:54
depth2
children0
last_payout2016-08-23 15:16:03
cashout_time1969-12-31 23:59:59
total_payout_value0.036 HBD
curator_payout_value0.036 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length255
author_reputation4,155,298,873,736
root_title"[StakeMachine] Trading infrastructure and simple market making bot for Bitshares | OpenSource Bot for BitShares"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id16,554
net_rshares224,189,668,412
author_curate_reward""
vote details (4)