mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-16 12:51:14 +00:00
refactor: simplify hyperopt-auto
This commit is contained in:
@@ -62,11 +62,6 @@ class HyperOptAuto(IHyperOpt):
|
|||||||
else:
|
else:
|
||||||
return default_func
|
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(
|
def get_indicator_space(
|
||||||
self, category: Literal["buy", "sell", "enter", "exit", "protection"] | str
|
self, category: Literal["buy", "sell", "enter", "exit", "protection"] | str
|
||||||
) -> list:
|
) -> list:
|
||||||
@@ -74,8 +69,11 @@ class HyperOptAuto(IHyperOpt):
|
|||||||
Get indicator space for a given space.
|
Get indicator space for a given space.
|
||||||
:param category: parameter space to get.
|
:param category: parameter space to get.
|
||||||
"""
|
"""
|
||||||
# TODO: is this necessary, or can we call "generate_space" directly?
|
indicator_space = [
|
||||||
indicator_space = list(self._generate_indicator_space(category))
|
attr.get_space(attr_name)
|
||||||
|
for attr_name, attr in self.strategy.enumerate_parameters(category)
|
||||||
|
if attr.optimize
|
||||||
|
]
|
||||||
if len(indicator_space) > 0:
|
if len(indicator_space) > 0:
|
||||||
return indicator_space
|
return indicator_space
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user