Refactor start-adjust logic to timerange

This commit is contained in:
Matthias
2019-10-23 19:30:01 +02:00
parent 5c2682e2c9
commit bd4a23beeb
2 changed files with 30 additions and 9 deletions

View File

@@ -446,15 +446,9 @@ class Backtesting:
'Loading backtest data from %s up to %s (%s days)..',
min_date.isoformat(), max_date.isoformat(), (max_date - min_date).days
)
if (not timerange.starttype or (self.required_startup
and min_date.timestamp == timerange.startts)):
# If no startts was defined, or test-data starts at the defined test-date
logger.warning("Moving start-date by %s candles to account for startup time.",
self.required_startup)
timerange.startts = (min_date.timestamp
+ timeframe_to_seconds(self.ticker_interval)
* self.required_startup)
timerange.starttype = 'date'
# Adjust startts forward if not enough data is available
timerange.adjust_start_if_necessary(timeframe_to_seconds(self.ticker_interval),
self.required_startup, min_date)
for strat in self.strategylist:
logger.info("Running backtesting for Strategy %s", strat.get_strategy_name())