Added bot_start callback to strategy interface

This commit is contained in:
Sam Germain 2022-04-01 08:39:56 -06:00
parent 44000ae0b3
commit 0b90e1d309
2 changed files with 9 additions and 0 deletions

View File

@ -122,6 +122,8 @@ class FreqtradeBot(LoggingMixin):
self._schedule.every().day.at(t).do(update) self._schedule.every().day.at(t).do(update)
self.last_process = datetime(1970, 1, 1, tzinfo=timezone.utc) self.last_process = datetime(1970, 1, 1, tzinfo=timezone.utc)
self.strategy.bot_start()
def notify_status(self, msg: str) -> None: def notify_status(self, msg: str) -> None:
""" """
Public method for users of this class (worker, etc.) to send notifications Public method for users of this class (worker, etc.) to send notifications

View File

@ -193,6 +193,13 @@ class IStrategy(ABC, HyperStrategyMixin):
""" """
return self.populate_sell_trend(dataframe, metadata) return self.populate_sell_trend(dataframe, metadata)
def bot_start(self, **kwargs) -> None:
"""
Called only once after bot instantiation.
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
"""
pass
def bot_loop_start(self, **kwargs) -> None: def bot_loop_start(self, **kwargs) -> None:
""" """
Called at the start of the bot iteration (one loop). Called at the start of the bot iteration (one loop).