refactor: simplify hyperopt-auto

pull/12483/merge
Matthias 3 months ago
parent 7d1c2d3a1b
commit 1e50a2da53

@ -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:

Loading…
Cancel
Save