Implement startup-period to default-strategy

This commit is contained in:
Matthias
2019-10-23 17:57:38 +02:00
parent 704121c197
commit 6382a4cd04
3 changed files with 16 additions and 9 deletions

View File

@@ -421,7 +421,6 @@ class Backtesting:
timerange = TimeRange.parse_timerange(None if self.config.get(
'timerange') is None else str(self.config.get('timerange')))
data = history.load_data(
datadir=Path(self.config['datadir']),
pairs=pairs,
@@ -447,9 +446,11 @@ 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:
# If no startts was defined, we need to move the backtesting start
logger.info("Moving start-date by %s candles.", self.required_startup)
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)