stable/freqtrade/tests/testdata/download_backtest_data.py

17 lines
495 B
Python
Raw Normal View History

2017-10-14 12:40:26 +00:00
"""This module download automatically json data of crypto currencies in bittrex"""
#!/usr/bin/env python3
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"]
2017-10-13 13:50:50 +00:00
2017-10-14 12:40:26 +00:00
for cur in CURRENCIES:
url1 = 'https://bittrex.com/Api/v2.0/pub/market/GetTicks?marketName=BTC-'
url2 = '&tickInterval=fiveMin'
url = url1+cur+url2
2017-10-13 13:50:50 +00:00
x = urlopen(url)
2017-10-14 12:40:26 +00:00
json_data = x.read()
json_str = str(json_data, 'utf-8')
with open("btc-"+cur+".json", "w") as file:
file.write(json_str)