download_backtest_data.py:

Uses direct api call instead of using library.
-No authentication
-Faster load time
-Faster response time

/testdata/*.json:
Updated.
This commit is contained in:
Michael Smith 2017-11-18 17:31:52 +08:00
parent 6f5b418f0b
commit f2927ed714
19 changed files with 2061966 additions and 17 deletions

129269
freqtrade/tests/testdata/btc-bcc.json vendored Normal file

File diff suppressed because it is too large Load Diff

125219
freqtrade/tests/testdata/btc-dash.json vendored Normal file

File diff suppressed because it is too large Load Diff

63686
freqtrade/tests/testdata/btc-edg.json vendored Normal file

File diff suppressed because it is too large Load Diff

126461
freqtrade/tests/testdata/btc-etc.json vendored Normal file

File diff suppressed because it is too large Load Diff

131672
freqtrade/tests/testdata/btc-eth.json vendored Normal file

File diff suppressed because it is too large Load Diff

131177
freqtrade/tests/testdata/btc-ltc.json vendored Normal file

File diff suppressed because it is too large Load Diff

102638
freqtrade/tests/testdata/btc-mtl.json vendored Normal file

File diff suppressed because it is too large Load Diff

130835
freqtrade/tests/testdata/btc-neo.json vendored Normal file

File diff suppressed because it is too large Load Diff

123446
freqtrade/tests/testdata/btc-ok.json vendored Normal file

File diff suppressed because it is too large Load Diff

129458
freqtrade/tests/testdata/btc-omg.json vendored Normal file

File diff suppressed because it is too large Load Diff

109712
freqtrade/tests/testdata/btc-pay.json vendored Normal file

File diff suppressed because it is too large Load Diff

80822
freqtrade/tests/testdata/btc-pivx.json vendored Normal file

File diff suppressed because it is too large Load Diff

124661
freqtrade/tests/testdata/btc-qtum.json vendored Normal file

File diff suppressed because it is too large Load Diff

79985
freqtrade/tests/testdata/btc-snt.json vendored Normal file

File diff suppressed because it is too large Load Diff

121844
freqtrade/tests/testdata/btc-xmr.json vendored Normal file

File diff suppressed because it is too large Load Diff

128972
freqtrade/tests/testdata/btc-xrp.json vendored Normal file

File diff suppressed because it is too large Load Diff

97733
freqtrade/tests/testdata/btc-xzc.json vendored Normal file

File diff suppressed because it is too large Load Diff

124337
freqtrade/tests/testdata/btc-zec.json vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,27 +3,49 @@
"""This script generate json data from bittrex""" """This script generate json data from bittrex"""
import json import json
from os import path from os import path
import urllib.request
import ssl
from freqtrade import exchange
from freqtrade.exchange import Bittrex
PAIRS = [ PAIRS = ['BTC-BCC', 'BTC-DASH', 'BTC-EDG', 'BTC-ETC', 'BTC-ETH', 'BTC-LTC', 'BTC-MTL', 'BTC-NEO',
'BTC_BCC', 'BTC_ETH', 'BTC_MER', 'BTC_POWR', 'BTC_ETC', 'BTC-OK', 'BTC-OMG', 'BTC-PAY', 'BTC-PIVX', 'BTC-QTUM', 'BTC-SNT', 'BTC-XMR', 'BTC-XRP', 'BTC-XZC', 'BTC-ZEC']
'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__)) OUTPUT_DIR = path.dirname(path.realpath(__file__))
# Init Bittrex exchange
exchange._API = Bittrex({'key': '', 'secret': ''})
for pair in PAIRS: for pair in PAIRS:
data = exchange.get_ticker_history(pair, TICKER_INTERVAL) print('========== Generating', pair, ' ==========')
filename = path.join(OUTPUT_DIR, '{}-{}.json'.format(
pair, filename = path.join(OUTPUT_DIR, '{}.json'.format(
TICKER_INTERVAL, pair.lower(),
)) ))
with open(filename, 'w') as fp: print(filename)
json.dump(data, fp)
if path.isfile(filename):
with open(filename) as fp:
data = json.load(fp)
print("Current Start:", data[1])
print("Current End: ", data[-1:])
else:
data=[]
print("Current Start: None")
print("Current End: None")
query = 'https://bittrex.com/Api/v2.0/pub/market/GetTicks?marketName=' + pair + '&tickInterval=oneMin'
print("Sending query:", query)
req = urllib.request.urlopen(url=query, timeout=60, context=ssl._create_unverified_context())
new_data = json.loads(req.read())
new_data = new_data['result']
for row in new_data:
if row not in data:
data.append(row)
#print("New Start:", data[1])
print("New End: ", data[-1:])
data = sorted(data, key=lambda data: data['T'])
with open(filename, "w") as fp:
json.dump(data, fp, indent=1)