diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index df541e3a9..a2a12a03a 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -123,7 +123,7 @@ class FreqtradeBot(LoggingMixin): self._schedule.every().day.at(t).do(update) self.last_process = datetime(1970, 1, 1, tzinfo=timezone.utc) - self.strategy.bot_start() + self.strategy.ft_bot_start() def notify_status(self, msg: str) -> None: """ diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index ef2b222a0..f1e9b7251 100755 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -187,7 +187,7 @@ class Backtesting: # since a "perfect" stoploss-exit is assumed anyway # And the regular "stoploss" function would not apply to that case self.strategy.order_types['stoploss_on_exchange'] = False - self.strategy.bot_start() + self.strategy.ft_bot_start() def _load_protections(self, strategy: IStrategy): if self.config.get('enable_protections', False): diff --git a/freqtrade/optimize/edge_cli.py b/freqtrade/optimize/edge_cli.py index 30eabecd0..aa3b02529 100644 --- a/freqtrade/optimize/edge_cli.py +++ b/freqtrade/optimize/edge_cli.py @@ -44,7 +44,7 @@ class EdgeCli: self.edge._timerange = TimeRange.parse_timerange(None if self.config.get( 'timerange') is None else str(self.config.get('timerange'))) - self.strategy.bot_start() + self.strategy.ft_bot_start() def start(self) -> None: result = self.edge.calculate(self.config['exchange']['pair_whitelist']) diff --git a/freqtrade/plot/plotting.py b/freqtrade/plot/plotting.py index ce8f54cbd..a64281156 100644 --- a/freqtrade/plot/plotting.py +++ b/freqtrade/plot/plotting.py @@ -633,7 +633,7 @@ def load_and_plot_trades(config: Dict[str, Any]): exchange = ExchangeResolver.load_exchange(config['exchange']['name'], config) IStrategy.dp = DataProvider(config, exchange) - strategy.bot_start() + strategy.ft_bot_start() strategy.bot_loop_start() plot_elements = init_plotscript(config, list(exchange.markets), strategy.startup_candle_count) timerange = plot_elements['timerange'] diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 60ac9da5a..c521943b1 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -144,6 +144,13 @@ class IStrategy(ABC, HyperStrategyMixin): informative_data.candle_type = config['candle_type_def'] self._ft_informative.append((informative_data, cls_method)) + def ft_bot_start(self, **kwargs) -> None: + """ + Strategy init - runs after dataprovider has been added. + Must call bot_start() + """ + strategy_safe_wrapper(self.bot_start)() + @abstractmethod def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: """