Main Menu

Trading Bot for BTSX

Started by xeroc, October 18, 2014, 12:07:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

xeroc

Quote from: abit on January 26, 2015, 05:24:51 AM
Quote from: xeroc on January 25, 2015, 06:09:05 PM
BTW ... please also note that @toast has released a new version of the market_maker bot .. my bots are currently under-maintained due to lack of time :(
Yes, it's https://github.com/freetradebots/bts_bots
That's where my fork comes from ..

The new bot actually is a bter.com trading bot written in go:
https://github.com/freetradebots/market_maker

abit

Quote from: xeroc on January 25, 2015, 06:09:05 PM
BTW ... please also note that @toast has released a new version of the market_maker bot .. my bots are currently under-maintained due to lack of time :(
Yes, it's https://github.com/freetradebots/bts_bots
BitShares committee member: abit
BitShares witness: in.abit

kamir.tam

#8
Great work, gonna try this out.

xeroc

BTW ... please also note that @toast has released a new version of the market_maker bot .. my bots are currently under-maintained due to lack of time :(

xeroc

Quote from: iHashFury on January 25, 2015, 05:17:30 PM

ValueError: Expecting ',' delimiter: line 12 column 13 (char 313)


What am I doing wrong?
I'd say you have a missing "," at the end of some parameters in your config json file .. please check them

iHashFury

Hello

Trying to test out your bot and run it to compliment toasts market maker bot but I'm getting the following error:

  File "main.py", line 17, in <module>
    config = read_config(sys.argv[1])
  File "/home/jason/tmp/git/btsx_bots/config.py", line 38, in read_config
    return json.load(f)
  File "/usr/lib/python3.4/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.4/json/__init__.py", line 318, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.4/json/decoder.py", line 343, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.4/json/decoder.py", line 359, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Expecting ',' delimiter: line 12 column 13 (char 313)


What am I doing wrong?

cass

█║▌║║█  - - -  The quieter you become, the more you are able to hear  - - -  █║▌║║█

xeroc

The initial buy oders are not working well yet .. bot is asking to confirm the initial orders ... please check them before you confirm them

cube

Wonderful piece of work!  +5%

Will look through and learn how a bot works.
ID: bitcube
bitcube is a dedicated witness and committe member. Please vote for bitcube.

xeroc

#1
I just now pushed a new bot I wrote ...

https://github.com/xeroc/btsx_bots

In particular the trading strategy/bot:
https://github.com/xeroc/btsx_bots/blob/master/bots/market_balance.py

For those that have been familiar with goxtool
(http://prof7bit.github.io/goxtool/) [scary reference to some long forgotten
centralized service] -- that bot should basically do the same as the 'portfolio rebalancing'
strategy of goxtool. (https://bitcointalk.org/index.php?topic=181584.0)
I haven't compared the code though!

Related theory: http://en.wikipedia.org/wiki/Rebalancing_investments#Rebalancing_bonus

It's "supposed" to keep the wealth split evenly among two assets and trades
when the market moves into either direction ..


{
"bot_type": "market_balance",           // bot name (fixed)
"account_name": "balance.bot.account",  // your account name (should be used ONLY by this bot)
"spread_percent": 0.05,                 // trades on prices moves +-5%
"asset_pair": [   
"USD", "BTSX"                   // trades in USD/BTSX in this case (first is quote, second is base)
],
"min_base_balance": 10,                 // minimum BTSX to keep
"min_quote_balance": 10                 // minimum USD to keep
},


Example output for the balancing bot:
~/btsx_bots$ python3 main.py config.json
INFO:MarketMakerBot:1 open orders -> Market has moved and order was executed! Canceling the other!
INFO:MarketMakerBot:freeing up 0.00000000  BTSX
INFO:MarketMakerBot:freeing up 66.84839000   USD
INFO:MarketMakerBot:available:   2877.65776000  BTSX            and              65.13140000   USD
INFO:MarketMakerBot:buy:           67.83787128  BTSX for price      0.02526589 -- pay      1.71398421   USD
INFO:MarketMakerBot:sell:          68.51566095  BTSX for price      0.02792546 -- get      1.91333119   USD
INFO:MarketMakerBot:submitting orders!


Remarks:

  • No external price fetching required! (running this bot only makes sense on matured markets)
  • The code is supposed to work on any asset pair as long as the market is open and the base asset has a lower id on the blockchain
  • The bot requires an initial equal distribution and if this is not the case in your account would order @ market prices  (asks for manual confirmation of orders for the initial trades) -- remark: be carefull here as the market price is taken from the btsx exchange, not from an external exchange/price feed
  • The bot places orders at +-SPREAD and allocates an amount such that after the (complete) trade has been filled, both assets hold the "same" wealth.

Todo

  • Take external price for initial balancing and wait for order to be filled
  • Set a minimum trade size
  • Incorporate trading feeds

DISCLAIMER:
- I used this to learn how to write a bot in python
- don't use with serious money unless you know what you are doing and checked the code
- I currently run one bot for USD/BTSX and CNY/BTSX with low volume to check trades, seems to work so far


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


Thought, critiques appreciated ..