From cb7e04bfb02f6c3f99f9b868c0dde25482a5629c Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 1 Nov 2025 16:03:01 +0100 Subject: [PATCH] feat: add explicit scenario testing if any parameter is selected --- freqtrade/optimize/hyperopt/hyperopt_optimizer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/hyperopt/hyperopt_optimizer.py b/freqtrade/optimize/hyperopt/hyperopt_optimizer.py index bf5fbdd90..4eda78004 100644 --- a/freqtrade/optimize/hyperopt/hyperopt_optimizer.py +++ b/freqtrade/optimize/hyperopt/hyperopt_optimizer.py @@ -244,6 +244,11 @@ class HyperOptimizer: self.spaces[space] = self.custom_hyperopt.get_indicator_space(space) self.dimensions = [s for space in self.spaces.values() for s in space] + if len(self.dimensions) == 0: + raise OperationalException( + "No hyperopt parameters found to optimize. Did you intend to use different spaces?" + ) + self.o_dimensions = self.convert_dimensions_to_optuna_space(self.dimensions) def assign_params(self, params_dict: dict[str, Any], category: str) -> None: """ @@ -413,7 +418,6 @@ class HyperOptimizer: o_sampler = self.custom_hyperopt.generate_estimator( dimensions=self.dimensions, random_state=random_state ) - self.o_dimensions = self.convert_dimensions_to_optuna_space(self.dimensions) if isinstance(o_sampler, str): if o_sampler not in optuna_samplers_dict.keys():