pyexchange - Consistent API wrapper for cryptocurrency exchanges.
$ pip install -e git+https://github.com/coderiot/pyexchange.git#egg=pyexchange
Exchange Name | Public Api | Private Api |
---|---|---|
Bitcurex | Yes | No |
Bitfinex | Yes | No |
Bitstamp | Yes | No |
BTCChina | Yes | No |
BTC-e | Yes | No |
CampBX | Yes | No |
Crypto-Trade | Yes | Yes (not tested) |
Cryptsy | Yes | Yes (not tested) |
Yes | No | |
Justcoin | Yes | No |
localbitcions | Yes | No |
Yes | No | |
The Rock Trading | Yes | No |
Bter | Yes | Yes (without tests) |
Coins-e | Yes | Yes (not tested) |
Vircurex | Yes | No |
CoinEx | Yes | No |
tested with python2.7 and python3
python -m pyexchange.tests -v
>>> import pyexchange
>>> pyexchange.exchanges()
example Result:
['bitcurex',
'bitfinex',
'bitstamp',
'btcchina',
'btce',
'campbx',
'cryptotrade',
'cryptsy',
'intersango',
'justcoin',
'localbitcoins',
'mtgox',
'rocktrading']
>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox', 'btc_eur')
>>> import pyexchange
>>> pyexchange.find_market('btc_usd')
>>> import pyexchange
>>> ex = pyexchange.new_exchange('bitfinex')
>>> ex.markets()
or
>>> pyexchange.exchange.bitfinex.markets()
Result:
['ltc_btc', 'ltc_usd', 'btc_usd']
>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> ex.market = 'btc_eur' # set market
>>> print ex.market # current market
>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> print ex.ticker()
Result:
Ticker(avg=Decimal('157.19387'), high=Decimal('163.0'), low=Decimal('151.13324'), last=Decimal('160.0'), buy=Decimal('160.00001'), sell=Decimal('160.16'), vol=Decimal('22805.9081')
>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> asks, bids = ex.depth()
>>> print asks
Result:
[Order(price=Decimal('160.22457'), amount=Decimal('0.01')),
Order(price=Decimal('160.22458'), amount=Decimal('0.12521962')),
Order(price=Decimal('160.29347'), amount=Decimal('1')),
Order(price=Decimal('160.36999'), amount=Decimal('2.56417803')),
Order(price=Decimal('160.37'), amount=Decimal('7.98')),],
...
]
>>> import pyexchange
>>> ex = pyexchange.new_exchange('mtgox')
>>> trades = ex.trades()
>>> print trades
Result:
[Order(price=Decimal('160.22457'), amount=Decimal('0.01')),
Order(price=Decimal('160.22458'), amount=Decimal('0.12521962')),
Order(price=Decimal('160.29347'), amount=Decimal('1')),
Order(price=Decimal('160.36999'), amount=Decimal('2.56417803')),
Order(price=Decimal('160.37'), amount=Decimal('7.98')),
...
]