Fix hyperopt when using MongoDB

This commit is contained in:
Gerald Lonlas
2017-12-20 23:31:26 -08:00
parent 33293d5cdd
commit 41e22657e4
5 changed files with 71 additions and 22 deletions

View File

@@ -5,6 +5,7 @@ import json
import os
from typing import Optional, List, Dict
from freqtrade.exchange import get_ticker_history
from freqtrade.optimize.hyperopt_conf import hyperopt_optimize_conf
from pandas import DataFrame
@@ -13,7 +14,7 @@ from freqtrade.analyze import populate_indicators, parse_ticker_dataframe
logger = logging.getLogger(__name__)
def load_data(pairs: List[str], ticker_interval: int = 5,
def load_data(ticker_interval: int = 5, pairs: Optional[List[str]] = None,
refresh_pairs: Optional[bool] = False) -> Dict[str, List]:
"""
Loads ticker history data for the given parameters
@@ -24,12 +25,14 @@ def load_data(pairs: List[str], ticker_interval: int = 5,
path = testdata_path()
result = {}
_pairs = pairs or hyperopt_optimize_conf()['exchange']['pair_whitelist']
# If the user force the refresh of pairs
if refresh_pairs:
logger.info('Download data for all pairs and store them in freqtrade/tests/testsdata')
download_pairs(pairs)
download_pairs(_pairs)
for pair in pairs:
for pair in _pairs:
file = '{abspath}/{pair}-{ticker_interval}.json'.format(
abspath=path,
pair=pair,