Don't load fallback methods for autohyperopt

This commit is contained in:
Matthias 2021-08-02 21:17:56 +02:00
parent e70a742005
commit 4ab03f7e37

View File

@ -102,16 +102,17 @@ class Hyperopt:
self.num_epochs_saved = 0 self.num_epochs_saved = 0
self.current_best_epoch: Optional[Dict[str, Any]] = None self.current_best_epoch: Optional[Dict[str, Any]] = None
# Populate functions here (hasattr is slow so should not be run during "regular" operations) if not self.auto_hyperopt:
if hasattr(self.custom_hyperopt, 'populate_indicators'): # Populate "fallback" functions here (hasattr is slow so should not be run during "regular" operations)
self.backtesting.strategy.advise_indicators = ( # type: ignore if hasattr(self.custom_hyperopt, 'populate_indicators'):
self.custom_hyperopt.populate_indicators) # type: ignore self.backtesting.strategy.advise_indicators = ( # type: ignore
if hasattr(self.custom_hyperopt, 'populate_buy_trend'): self.custom_hyperopt.populate_indicators) # type: ignore
self.backtesting.strategy.advise_buy = ( # type: ignore if hasattr(self.custom_hyperopt, 'populate_buy_trend'):
self.custom_hyperopt.populate_buy_trend) # type: ignore self.backtesting.strategy.advise_buy = ( # type: ignore
if hasattr(self.custom_hyperopt, 'populate_sell_trend'): self.custom_hyperopt.populate_buy_trend) # type: ignore
self.backtesting.strategy.advise_sell = ( # type: ignore if hasattr(self.custom_hyperopt, 'populate_sell_trend'):
self.custom_hyperopt.populate_sell_trend) # type: ignore self.backtesting.strategy.advise_sell = ( # type: ignore
self.custom_hyperopt.populate_sell_trend) # type: ignore
# Use max_open_trades for hyperopt as well, except --disable-max-market-positions is set # Use max_open_trades for hyperopt as well, except --disable-max-market-positions is set
if self.config.get('use_max_market_positions', True): if self.config.get('use_max_market_positions', True):