Python wrapper of cryptocurrency exchange pubilc APIs
API |
Param |
Return |
Description |
get_exchanges |
None |
str[] |
Gets supported exchanges |
create_exchange |
str |
Exchange |
Creates an exchange object |
API |
Param |
Return |
Description |
get_currency_pairs |
None |
CurrenyPair[] |
Gets supported currency pair list |
get_ticker |
CurrencyPair |
Ticker |
Gets last price |
get_orderbook |
CurrencyPair |
Orderbook |
Gets orderbook |
python3 setup.py build
python3 setup.py install
or
pip3 install -e ./
from exchange import CurrencyPair
from exchange import ExchangeAPI
binance = ExchangeAPI().create_exchange('Binance')
for pair in binance.get_currency_pairs():
print(pair)
# market_currency: BTC, currency: ETH
# market_currency: BTC, currency: LTC
# market_currency: BTC, currency: BNB
# market_currency: BTC, currency: NEO
# market_currency: ETH, currency: QTUM
# ...
print(binance.get_ticker(CurrencyPair('USDT', 'BTC')))
# currency_pair: market_currency: USDT, currency: BTC, price: 7505.27, timestamp: 1533219056
print(binance.get_orderbook(CurrencyPair('USDT', 'BTC')))
# Orderbook(1533219081)-(market_currency: USDT, currency: BTC)
# Bids -
# price: 7504.00000, amount: 0.14538
# price: 7502.00000, amount: 0.23498
# price: 7501.00000, amount: 0.62473
# price: 7500.38000, amount: 0.05693
# price: 7500.06000, amount: 0.34357
# ...
# Bids -
# price: 7504.00000, amount: 0.14538
# price: 7502.00000, amount: 0.23498
# price: 7501.00000, amount: 0.62473
# price: 7500.38000, amount: 0.05693
# price: 7500.06000, amount: 0.34357
# '''
Please refer unittest for more example codes
Cryptocurrency |
Address |
BTC |
3LQ8rM139ehmGbqKwmKaEpiCyZhvGViLi8 |
BCH |
34FczBgU3F4S9tympRncaZ9AAQTqkbFKDJ |
ETH |
0x3102857c163bc6ec97b358d877897a4bd9fcc556 |
QTUM |
Qd9yEPh6KUcxTuz1k8MhWpmP44VnBkCsnD |
ICON |
hxdce20a7bf7437a0b5a062ea8d956a20460da7dc1 |