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
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+126461
View File
File diff suppressed because it is too large Load Diff
+131672
View File
File diff suppressed because it is too large Load Diff
+131177
View File
File diff suppressed because it is too large Load Diff
+102638
View File
File diff suppressed because it is too large Load Diff
+130835
View File
File diff suppressed because it is too large Load Diff
+123446
View File
File diff suppressed because it is too large Load Diff
+129458
View File
File diff suppressed because it is too large Load Diff
+109712
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+121844
View File
File diff suppressed because it is too large Load Diff
+128972
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+124337
View File
File diff suppressed because it is too large Load Diff
+39 -17
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)