Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/j-w-yun/crypto_data
Python wrapper for cryptocurrency exchange platforms designed for quantitative trading. Deprecated.
https://github.com/j-w-yun/crypto_data
binance-api bitmex-api cryptocurrency data-mining gdax-api kraken-exchange-api poloniex-api
Last synced: about 7 hours ago
JSON representation
Python wrapper for cryptocurrency exchange platforms designed for quantitative trading. Deprecated.
- Host: GitHub
- URL: https://github.com/j-w-yun/crypto_data
- Owner: j-w-yun
- Created: 2018-05-10T03:43:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-06T14:27:24.000Z (about 4 years ago)
- Last Synced: 2024-04-16T03:18:55.169Z (7 months ago)
- Topics: binance-api, bitmex-api, cryptocurrency, data-mining, gdax-api, kraken-exchange-api, poloniex-api
- Language: Python
- Homepage:
- Size: 3.51 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Crypto Data
Deprecated
## List of Supported Currency Pair Data
315 currency pairs in Binance:
['ADABNB', 'ADABTC', 'ADAETH', 'ADAUSDT', 'ADXBNB', 'ADXBTC', 'ADXETH', 'AEBNB', 'AEBTC', 'AEETH', 'AIONBNB', 'AIONBTC', 'AIONETH',
'AMBBNB', 'AMBBTC', 'AMBETH', 'APPCBNB', 'APPCBTC', 'APPCETH', 'ARKBTC', 'ARKETH', 'ARNBTC', 'ARNETH', 'ASTBTC', 'ASTETH', 'BATBNB',
'BATBTC', 'BATETH', 'BCCBNB', 'BCCBTC', 'BCCETH', 'BCCUSDT', 'BCDBTC', 'BCDETH', 'BCNBNB', 'BCNBTC', 'BCNETH', 'BCPTBNB', 'BCPTBTC',
'BCPTETH', 'BLZBNB', 'BLZBTC', 'BLZETH', 'BNBBTC', 'BNBETH', 'BNBUSDT', 'BNTBTC', 'BNTETH', 'BQXBTC', 'BQXETH', 'BRDBNB', 'BRDBTC',
'BRDETH', 'BTCUSDT', 'BTGBTC', 'BTGETH', 'BTSBNB', 'BTSBTC', 'BTSETH', 'CDTBTC', 'CDTETH', 'CHATBTC', 'CHATETH', 'CLOAKBTC',
'CLOAKETH', 'CMTBNB', 'CMTBTC', 'CMTETH', 'CNDBNB', 'CNDBTC', 'CNDETH', 'DASHBTC', 'DASHETH', 'DGDBTC', 'DGDETH', 'DLTBNB', 'DLTBTC',
'DLTETH', 'DNTBTC', 'DNTETH', 'EDOBTC', 'EDOETH', 'ELFBTC', 'ELFETH', 'ENGBTC', 'ENGETH', 'ENJBTC', 'ENJETH', 'EOSBTC', 'EOSETH',
'ETCBTC', 'ETCETH', 'ETHBTC', 'ETHUSDT', 'EVXBTC', 'EVXETH', 'FUELBTC', 'FUELETH', 'FUNBTC', 'FUNETH', 'GASBTC', 'GNTBNB', 'GNTBTC',
'GNTETH', 'GRSBTC', 'GRSETH', 'GTOBNB', 'GTOBTC', 'GTOETH', 'GVTBTC', 'GVTETH', 'GXSBTC', 'GXSETH', 'HSRBTC', 'HSRETH', 'ICNBTC',
'ICNETH', 'ICXBNB', 'ICXBTC', 'ICXETH', 'INSBTC', 'INSETH', 'IOSTBTC', 'IOSTETH', 'IOTABNB', 'IOTABTC', 'IOTAETH', 'KMDBTC', 'KMDETH',
'KNCBTC', 'KNCETH', 'LENDBTC', 'LENDETH', 'LINKBTC', 'LINKETH', 'LOOMBNB', 'LOOMBTC', 'LOOMETH', 'LRCBTC', 'LRCETH', 'LSKBNB',
'LSKBTC', 'LSKETH', 'LTCBNB', 'LTCBTC', 'LTCETH', 'LTCUSDT', 'LUNBTC', 'LUNETH', 'MANABTC', 'MANAETH', 'MCOBNB', 'MCOBTC', 'MCOETH',
'MDABTC', 'MDAETH', 'MODBTC', 'MODETH', 'MTHBTC', 'MTHETH', 'MTLBTC', 'MTLETH', 'NANOBNB', 'NANOBTC', 'NANOETH', 'NAVBNB', 'NAVBTC',
'NAVETH', 'NCASHBNB', 'NCASHBTC', 'NCASHETH', 'NEBLBNB', 'NEBLBTC', 'NEBLETH', 'NEOBNB', 'NEOBTC', 'NEOETH', 'NEOUSDT', 'NULSBNB',
'NULSBTC', 'NULSETH', 'OAXBTC', 'OAXETH', 'OMGBTC', 'OMGETH', 'ONTBNB', 'ONTBTC', 'ONTETH', 'OSTBNB', 'OSTBTC', 'OSTETH', 'PIVXBNB',
'PIVXBTC', 'PIVXETH', 'POABNB', 'POABTC', 'POAETH', 'POEBTC', 'POEETH', 'POWRBNB', 'POWRBTC', 'POWRETH', 'PPTBTC', 'PPTETH', 'QLCBNB',
'QLCBTC', 'QLCETH', 'QSPBNB', 'QSPBTC', 'QSPETH', 'QTUMBNB', 'QTUMBTC', 'QTUMETH', 'QTUMUSDT', 'RCNBNB', 'RCNBTC', 'RCNETH', 'RDNBNB',
'RDNBTC', 'RDNETH', 'REPBNB', 'REPBTC', 'REPETH', 'REQBTC', 'REQETH', 'RLCBNB', 'RLCBTC', 'RLCETH', 'RPXBNB', 'RPXBTC', 'RPXETH',
'SALTBTC', 'SALTETH', 'SNGLSBTC', 'SNGLSETH', 'SNMBTC', 'SNMETH', 'SNTBTC', 'SNTETH', 'STEEMBNB', 'STEEMBTC', 'STEEMETH', 'STORJBTC',
'STORJETH', 'STORMBNB', 'STORMBTC', 'STORMETH', 'STRATBTC', 'STRATETH', 'SUBBTC', 'SUBETH', 'SYSBNB', 'SYSBTC', 'SYSETH', 'TNBBTC',
'TNBETH', 'TNTBTC', 'TNTETH', 'TRIGBNB', 'TRIGBTC', 'TRIGETH', 'TRXBTC', 'TRXETH', 'VENBNB', 'VENBTC', 'VENETH', 'VIABNB', 'VIABTC',
'VIAETH', 'VIBBTC', 'VIBEBTC', 'VIBEETH', 'VIBETH', 'WABIBNB', 'WABIBTC', 'WABIETH', 'WANBNB', 'WANBTC', 'WANETH', 'WAVESBNB',
'WAVESBTC', 'WAVESETH', 'WINGSBTC', 'WINGSETH', 'WPRBTC', 'WPRETH', 'WTCBNB', 'WTCBTC', 'WTCETH', 'XEMBNB', 'XEMBTC', 'XEMETH',
'XLMBNB', 'XLMBTC', 'XLMETH', 'XMRBTC', 'XMRETH', 'XRPBTC', 'XRPETH', 'XRPUSDT', 'XVGBTC', 'XVGETH', 'XZCBNB', 'XZCBTC', 'XZCETH',
'YOYOBNB', 'YOYOBTC', 'YOYOETH', 'ZECBTC', 'ZECETH', 'ZILBNB', 'ZILBTC', 'ZILETH', 'ZRXBTC', 'ZRXETH']6 currency pairs in Bitmex:
['XBTUSD', 'ADAM18', 'BCHM18', 'ETHM18', 'LTCM18', 'XRPM18']12 currency pairs in GDAX:
['BCH-BTC', 'BCH-EUR', 'BCH-USD', 'BTC-EUR', 'BTC-GBP', 'BTC-USD', 'ETH-BTC', 'ETH-EUR', 'ETH-USD', 'LTC-BTC', 'LTC-EUR', 'LTC-USD']57 currency pairs in Kraken:
['BCHEUR', 'BCHUSD', 'BCHXBT', 'DASHEUR', 'DASHUSD', 'DASHXBT', 'EOSETH', 'EOSEUR', 'EOSUSD', 'EOSXBT', 'GNOETH', 'GNOEUR', 'GNOUSD',
'GNOXBT', 'USDTZUSD', 'XETCXETH', 'XETCXXBT', 'XETCZEUR', 'XETCZUSD', 'XETHXXBT', 'XETHZCAD', 'XETHZEUR', 'XETHZGBP', 'XETHZJPY',
'XETHZUSD', 'XICNXETH', 'XICNXXBT', 'XLTCXXBT', 'XLTCZEUR', 'XLTCZUSD', 'XMLNXETH', 'XMLNXXBT', 'XREPXETH', 'XREPXXBT', 'XREPZEUR',
'XREPZUSD', 'XXBTZCAD', 'XXBTZEUR', 'XXBTZGBP', 'XXBTZJPY', 'XXBTZUSD', 'XXDGXXBT', 'XXLMXXBT', 'XXLMZEUR', 'XXLMZUSD', 'XXMRXXBT',
'XXMRZEUR', 'XXMRZUSD', 'XXRPXXBT', 'XXRPZCAD', 'XXRPZEUR', 'XXRPZJPY', 'XXRPZUSD', 'XZECXXBT', 'XZECZEUR', 'XZECZJPY', 'XZECZUSD']99 currency pairs in Poloniex:
['BTC_AMP', 'BTC_ARDR', 'BTC_BCH', 'BTC_BCN', 'BTC_BCY', 'BTC_BELA', 'BTC_BLK', 'BTC_BTCD', 'BTC_BTM', 'BTC_BTS', 'BTC_BURST',
'BTC_CLAM', 'BTC_CVC', 'BTC_DASH', 'BTC_DCR', 'BTC_DGB', 'BTC_DOGE', 'BTC_EMC2', 'BTC_ETC', 'BTC_ETH', 'BTC_EXP', 'BTC_FCT',
'BTC_FLDC', 'BTC_FLO', 'BTC_GAME', 'BTC_GAS', 'BTC_GNO', 'BTC_GNT', 'BTC_GRC', 'BTC_HUC', 'BTC_LBC', 'BTC_LSK', 'BTC_LTC',
'BTC_MAID', 'BTC_NAV', 'BTC_NEOS', 'BTC_NMC', 'BTC_NXC', 'BTC_NXT', 'BTC_OMG', 'BTC_OMNI', 'BTC_PASC', 'BTC_PINK', 'BTC_POT',
'BTC_PPC', 'BTC_RADS', 'BTC_REP', 'BTC_RIC', 'BTC_SBD', 'BTC_SC', 'BTC_STEEM', 'BTC_STORJ', 'BTC_STR', 'BTC_STRAT', 'BTC_SYS',
'BTC_VIA', 'BTC_VRC', 'BTC_VTC', 'BTC_XBC', 'BTC_XCP', 'BTC_XEM', 'BTC_XMR', 'BTC_XPM', 'BTC_XRP', 'BTC_XVC', 'BTC_ZEC', 'BTC_ZRX',
'ETH_BCH', 'ETH_CVC', 'ETH_ETC', 'ETH_GAS', 'ETH_GNO', 'ETH_GNT', 'ETH_LSK', 'ETH_OMG', 'ETH_REP', 'ETH_STEEM', 'ETH_ZEC', 'ETH_ZRX',
'USDT_BCH', 'USDT_BTC', 'USDT_DASH', 'USDT_ETC', 'USDT_ETH', 'USDT_LTC', 'USDT_NXT', 'USDT_REP', 'USDT_STR', 'USDT_XMR', 'USDT_XRP',
'USDT_ZEC', 'XMR_BCN', 'XMR_BLK', 'XMR_BTCD', 'XMR_DASH', 'XMR_LTC', 'XMR_MAID', 'XMR_NXT', 'XMR_ZEC']489 total currency pairs in 5 exchanges.
## Dependencies
requests
numpy
matplotlib
mpl_finance## Usage
Data is stored in `/exchange/{exchange_name}/{currency_pair_name}.csv` separately for each currency pair.
Currently supports five exchanges:
Binance exchange:
import binance_data
client = binance_data.Binance()Bitmex exchange:
import bitmex_data
client = bitmex_data.Bitmex()GDAX exchange:
import gdax_data
client = gdax_data.Gdax()Kraken exchange:
import kraken_data
client = kraken_data.Kraken()Poloniex exchange:
import poloniex_data
client = poloniex_data.Poloniex()---
Code for each exchange share four universal public methods:
client.download_data(currency_pair_name, start_unix, end_unix)
Downloads trade data for `currency_pair_name` for specified UNIX timestamp range.
As long as `start_unix` is fixed, this method can resume download from the last saved trade.
To change `start_unix` to a point further back in time, you must delete all `/exchange/{exchange_name}/{currency_pair_name}.csv` files associated with your download scope.client.get_trades(currency_pair_name, start_unix, end_unix)
Fetches downloaded trade data as a list of python dict, in the order of increasing UNIX.
client.get_charts(currency_pair_name, start_unix, end_unix, interval)
Fetches downloaded trade data and builds OHLC + additional information from trade data as a list of python dict, in the order of increasing UNIX.
client.get_pairs()
Fetches all currency pairs currently supported by the exchange.
---
These exchange clients and their methods are incorporated in the `DataManager` class:
import data_manager
dm = data_manager.DataManager()`DataManager` offers the following methods:
dm.get_trades(exchange_name, currency_pair_name, start_unix, end_unix)
Downloads and returns trade data as a list of python dicts, in the order of increasing UNIX.
dm.get_charts(exchange_name, currency_pair_name, start_unix, end_unix)
Downloads trade data and returns OHLC data as a list of python dicts, in the order of increasing UNIX.
dm.download_all(start_unix, end_unix)
Concurrently downloads all pairs from each exchange.
dm.all_clients()
dm.all_pairs()Fetches all suppoerted exchange client instances and list of currency pairs for each exchange, respectively.
## Tests
The following test file downloads most recent trades of BTC and ETH currencies paired with USD/USDT and plots OHLC:
/tests/test_plot.py
![alt tag](https://github.com/Jaewan-Yun/cdata/blob/master/figures/test_plot.png)
---
The following test file downloads currency pairs from each exchange and plots OHLC:
/tests/test_exchange_data.py
![alt tag](https://github.com/Jaewan-Yun/cdata/blob/master/figures/test_gdax_data.png)
![alt tag](https://github.com/Jaewan-Yun/cdata/blob/master/figures/test_kraken_data.png)
![alt tag](https://github.com/Jaewan-Yun/cdata/blob/master/figures/test_poloniex_data.png)