Merge pull request #622 from gcarq/fix/dl-testdata

fix download testdata
This commit is contained in:
Michael Egger
2018-05-02 22:06:43 +02:00
committed by GitHub
8 changed files with 95 additions and 59 deletions

View File

@@ -74,10 +74,9 @@ def default_conf():
"secret": "secret",
"pair_whitelist": [
"ETH/BTC",
"TKN/BTC",
"TRST/BTC",
"SWT/BTC",
"BCC/BTC"
"LTC/BTC",
"XRP/BTC",
"NEO/BTC"
]
},
"telegram": {

View File

@@ -45,7 +45,7 @@ def test_init_exception(default_conf):
def test_validate_pairs(default_conf, mocker):
api_mock = MagicMock()
api_mock.load_markets = MagicMock(return_value={
'ETH/BTC': '', 'TKN/BTC': '', 'TRST/BTC': '', 'SWT/BTC': '', 'BCC/BTC': ''
'ETH/BTC': '', 'LTC/BTC': '', 'XRP/BTC': '', 'NEO/BTC': ''
})
id_mock = PropertyMock(return_value='test_exchange')
type(api_mock).id = id_mock

View File

@@ -1,35 +0,0 @@
#!/usr/bin/env python3
"""This script generate json data from bittrex"""
import json
import sys
from freqtrade import (exchange, arguments, misc)
from freqtrade.exchange import ccxt
BASE_PATH = 'freqtrade/tests/testdata'
arguments = arguments.Arguments(sys.argv[1:], 'download utility')
arguments.scripts_options()
args = arguments.parse_args()
TICKER_INTERVALS = ['1m', '5m']
PAIRS = []
if args.pair:
with open(args.pair) as file:
PAIRS = json.load(file)
PAIRS = list(set(PAIRS))
print('About to download pairs:', PAIRS)
# Init Bittrex exchange
exchange._API = ccxt.bittrex({'key': '', 'secret': ''})
for pair in PAIRS:
for tick_interval in TICKER_INTERVALS:
print('downloading pair %s, interval %s' % (pair, tick_interval))
data = exchange.get_ticker_history(pair, tick_interval)
pair_print = pair.replace('/', '_')
filename = '{}-{}.json'.format(pair_print, tick_interval)
misc.file_dump_json(filename, data)