feat: support "--spaces all" with custom spaces

This commit is contained in:
Matthias
2025-11-05 20:12:56 +01:00
parent cfd4926f47
commit 1a2f261ee2
2 changed files with 8 additions and 3 deletions

View File

@@ -42,6 +42,13 @@ class HyperOptAuto(IHyperOpt):
sell_indicator_space methods, but other hyperopt methods can be overridden as well.
"""
def get_available_spaces(self) -> list[str]:
"""
Get list of available spaces defined in strategy.
:return: list of available spaces.
"""
return list(self.strategy._ft_hyper_params)
def _get_func(self, name) -> Callable:
"""
Return a function defined in Strategy.HyperOpt class, or one defined in super() class.

View File

@@ -223,9 +223,7 @@ class HyperOptimizer:
Assign the dimensions in the hyperoptimization space.
"""
spaces = ["buy", "sell", "protection", "roi", "stoploss", "trailing", "trades"]
spaces += [
s for s in self.config["spaces"] if s not in spaces and s not in ("all", "default")
]
spaces += [s for s in self.custom_hyperopt.get_available_spaces() if s not in spaces]
for space in spaces:
if not HyperoptTools.has_space(self.config, space):