backtest_live_models - params validation and get timerange from live models in BT

This commit is contained in:
Wagner Costa Santos
2022-09-25 23:14:00 -03:00
parent f3f3917da3
commit 5880f7a638
8 changed files with 165 additions and 833 deletions

View File

@@ -25,6 +25,7 @@ from freqtrade.enums import (BacktestState, CandleType, ExitCheckTuple, ExitType
from freqtrade.exceptions import DependencyException, OperationalException
from freqtrade.exchange import (amount_to_contract_precision, price_to_precision,
timeframe_to_minutes, timeframe_to_seconds)
from freqtrade.freqai import freqai_util
from freqtrade.mixins import LoggingMixin
from freqtrade.optimize.backtest_caching import get_strategy_run_id
from freqtrade.optimize.bt_progress import BTProgress
@@ -134,6 +135,12 @@ class Backtesting:
self.fee = self.exchange.get_fee(symbol=self.pairlists.whitelist[0])
self.precision_mode = self.exchange.precisionMode
if self.config.get('freqai_backtest_live_models', False):
freqai_model_path = freqai_util.get_full_model_path(self.config)
_, live_models_timerange, _ = freqai_util.get_timerange_from_ready_models(
freqai_model_path)
self.config['timerange'] = live_models_timerange
self.timerange = TimeRange.parse_timerange(
None if self.config.get('timerange') is None else str(self.config.get('timerange')))