stable/freqtrade/tests/testdata/download_backtest_data.py

30 lines
892 B
Python
Raw Normal View History

2017-10-14 12:40:26 +00:00
#!/usr/bin/env python3
2017-10-13 13:50:50 +00:00
2017-10-15 15:24:49 +00:00
"""This script generate json data from bittrex"""
import json
from os import path
2017-10-15 15:24:49 +00:00
from freqtrade import exchange
from freqtrade.exchange import Bittrex
2017-10-13 13:50:50 +00:00
PAIRS = [
'BTC_BCC', 'BTC_ETH', 'BTC_MER', 'BTC_POWR', 'BTC_ETC',
'BTC_OK', 'BTC_NEO', 'BTC_EMC2', 'BTC_DASH', 'BTC_LSK',
'BTC_LTC', 'BTC_XZC', 'BTC_OMG', 'BTC_STRAT', 'BTC_XRP',
'BTC_QTUM', 'BTC_WAVES', 'BTC_VTC', 'BTC_XLM', 'BTC_MCO'
]
TICKER_INTERVAL = 5 # ticker interval in minutes (currently implemented: 1 and 5)
OUTPUT_DIR = path.dirname(path.realpath(__file__))
2017-10-13 13:50:50 +00:00
# Init Bittrex exchange
exchange._API = Bittrex({'key': '', 'secret': ''})
for pair in PAIRS:
2017-11-07 17:59:47 +00:00
data = exchange.get_ticker_history(pair, TICKER_INTERVAL)
filename = path.join(OUTPUT_DIR, '{}-{}.json'.format(
pair,
2017-11-07 17:59:47 +00:00
TICKER_INTERVAL,
))
with open(filename, 'w') as fp:
json.dump(data, fp)