refactor: simplify hyperopt-auto

This commit is contained in:
Matthias
2025-11-08 16:26:05 +01:00
parent 7d1c2d3a1b
commit 1e50a2da53

View File

@@ -62,11 +62,6 @@ class HyperOptAuto(IHyperOpt):
else:
return default_func
def _generate_indicator_space(self, category):
for attr_name, attr in self.strategy.enumerate_parameters(category):
if attr.optimize:
yield attr.get_space(attr_name)
def get_indicator_space(
self, category: Literal["buy", "sell", "enter", "exit", "protection"] | str
) -> list:
@@ -74,8 +69,11 @@ class HyperOptAuto(IHyperOpt):
Get indicator space for a given space.
:param category: parameter space to get.
"""
# TODO: is this necessary, or can we call "generate_space" directly?
indicator_space = list(self._generate_indicator_space(category))
indicator_space = [
attr.get_space(attr_name)
for attr_name, attr in self.strategy.enumerate_parameters(category)
if attr.optimize
]
if len(indicator_space) > 0:
return indicator_space
else: