timeperiod argument to backtesting and hyperopt

This commit is contained in:
kryofly
2018-01-10 23:03:05 +01:00
parent feca87345f
commit b0f3fd7ffb
7 changed files with 41 additions and 17 deletions

View File

@@ -12,6 +12,13 @@ from freqtrade.analyze import populate_indicators, parse_ticker_dataframe
logger = logging.getLogger(__name__)
def trim_tickerlist(dl, num):
new = {}
for pair, pair_data in dl.items():
new[pair] = pair_data[num:]
return new
def load_tickerdata_file(datadir, pair, ticker_interval):
"""
Load a pair from file,
@@ -61,7 +68,9 @@ def load_data(datadir: str, ticker_interval: int = 5, pairs: Optional[List[str]]
return result
def tickerdata_to_dataframe(data):
def tickerdata_to_dataframe(data, timeperiod=None):
if timeperiod:
data = trim_tickerlist(data, timeperiod)
preprocessed = preprocess(data)
return preprocessed

View File

@@ -176,7 +176,7 @@ def start(args):
from freqtrade import main
main._CONF = config
preprocessed = optimize.tickerdata_to_dataframe(data)
preprocessed = optimize.tickerdata_to_dataframe(data, timeperiod=args.timeperiod)
# Print timeframe
min_date, max_date = get_timeframe(preprocessed)
logger.info('Measuring data from %s up to %s ...', min_date.isoformat(), max_date.isoformat())

View File

@@ -231,7 +231,7 @@ def start(args):
config = load_config(args.config)
pairs = config['exchange']['pair_whitelist']
data = optimize.load_data(args.datadir, pairs=pairs, ticker_interval=args.ticker_interval)
PROCESSED = optimize.tickerdata_to_dataframe(data)
PROCESSED = optimize.tickerdata_to_dataframe(data, timeperiod=args.timeperiod)
if args.mongodb:
logger.info('Using mongodb ...')