Ensure bot_loop_start is called in hyperopt, too

closes #7001
This commit is contained in:
Matthias
2022-07-03 14:10:08 +02:00
parent c5e6520fee
commit 07aa372e2a
4 changed files with 11 additions and 3 deletions

View File

@@ -861,6 +861,7 @@ def test_in_strategy_auto_hyperopt(mocker, hyperopt_conf, tmpdir, fee) -> None:
hyperopt.backtesting.exchange.get_max_leverage = MagicMock(return_value=1.0)
assert isinstance(hyperopt.custom_hyperopt, HyperOptAuto)
assert isinstance(hyperopt.backtesting.strategy.buy_rsi, IntParameter)
assert hyperopt.backtesting.strategy.bot_loop_started is True
assert hyperopt.backtesting.strategy.buy_rsi.in_space is True
assert hyperopt.backtesting.strategy.buy_rsi.value == 35

View File

@@ -44,6 +44,11 @@ class HyperoptableStrategy(StrategyTestV2):
})
return prot
bot_loop_started = False
def bot_loop_start(self):
self.bot_loop_started = True
def bot_start(self, **kwargs) -> None:
"""
Parameters can also be defined here ...