freqtrade_origin/freqtrade/tests/testdata/download_backtest_data.py

19 lines
548 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"""
2017-10-13 13:50:50 +00:00
from urllib.request import urlopen
2017-10-14 12:40:26 +00:00
CURRENCIES = ["ok", "neo", "dash", "etc", "eth", "snt"]
OUTPUT_DIR = 'freqtrade/tests/testdata/'
2017-10-13 13:50:50 +00:00
2017-10-14 12:40:26 +00:00
for cur in CURRENCIES:
2017-10-15 15:24:49 +00:00
url1 = 'https://bittrex.com/Api/v2.0/pub/market/GetTicks?marketName=BTC-'
url = url1+cur+'&tickInterval=fiveMin'
x = urlopen(url)
json_data = x.read()
json_str = str(json_data, 'utf-8')
output = OUTPUT_DIR + 'btc-'+cur+'.json'
with open(output, 'w') as file:
2017-10-15 15:24:49 +00:00
file.write(json_str)