Author Topic: [ReleaseCandidate] Module "GrapheneExchange" - Simple Python Trading Interface  (Read 9027 times)

0 Members and 1 Guest are viewing this topic.


Offline BunkerChainLabs-DataSecurityNode

+-+-+-+-+-+-+-+-+-+-+
www.Peerplays.com | Decentralized Gaming Built with Graphene - Now with BookiePro and Sweeps!
+-+-+-+-+-+-+-+-+-+-+

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I present to you a *release candidate* for a python module that can be
used to easily build a trading bot.

As an orientation, I used the polonex trading interface. However there
are some differences that you should be aware of:

 * market pairs are denoted as 'quote'_'base', e.g. `USD_BTS`
 * Prices/Rates are denoted in 'quote', i.e. the USD_BTS market
   is priced in USD and buying 1 USD costs `rate` BTS
 * All markets could be considered reversed as well ('BTS_USD')

Usage
... is quite simple:

Code: [Select]
dex = GrapheneExchange(config)
dex.returnTradeHistory("USD_BTS")
dex.returnTicker()
dex.return24Volume()
dex.returnOrderBook("USD_BTS")
dex.returnBalances()
dex.returnOpenOrders("all")
dex.buy("USD_BTS", 0.001, 10)
dex.sell("USD_BTS", 0.001, 10)

Documentation:
http://python-graphenelib.readthedocs.org/en/latest/exchange.html

Example Usage:
Script: https://github.com/xeroc/python-graphenelib/blob/master/scripts/exchange-simpleticker-stats/main.py
Output:
Code: [Select]
CNY_BTS
=======
 - Trade Premium: 8.109%
 - Bid Order Premium: 1.171%
 - Ask Order Premium: 8.109%
 - Spread: 6.630%
 - CER premium:  5.22%

GOLD_BTS
========
 - Trade Premium: 2.264%
 - Bid Order Premium: 19.559%
 - Ask Order Premium: 2.264%
 - Spread: 19.413%
 - CER premium:  3.53%

USD_BTS
=======
 - Trade Premium: 0.180%
 - Bid Order Premium: 2.137%
 - Ask Order Premium: 0.439%
 - Spread: 1.721%
 - CER premium:  4.97%

SILVER_BTS
==========
 - Trade Premium: 8.595%
 - Bid Order Premium: 8.098%
 - Ask Order Premium: 1.031%
 - Spread: 9.464%
 - CER premium:  4.16%

So,

To all the Traders and Bot developers:
* Please give this library a try and improve liquidity in the markets
* Note that the library is not well tested yet, so please a) use only
  what you can affort to lose and b) review the code :)


cass edit: title spelling mistake  GrapehenExchange  --> GrapheneExchange
« Last Edit: January 11, 2016, 08:49:36 pm by cass »