mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-15 20:31:43 +00:00
feat: Assign all matching parameters
This commit is contained in:
@@ -255,15 +255,6 @@ class HyperOptimizer:
|
|||||||
)
|
)
|
||||||
self.o_dimensions = self.convert_dimensions_to_optuna_space(self.dimensions)
|
self.o_dimensions = self.convert_dimensions_to_optuna_space(self.dimensions)
|
||||||
|
|
||||||
def assign_params(self, params_dict: dict[str, Any], category: str) -> None:
|
|
||||||
"""
|
|
||||||
Assign hyperoptable parameters
|
|
||||||
"""
|
|
||||||
for attr_name, attr in self.backtesting.strategy.enumerate_parameters(category):
|
|
||||||
if attr.optimize:
|
|
||||||
# noinspection PyProtectedMember
|
|
||||||
attr.value = params_dict[attr_name]
|
|
||||||
|
|
||||||
@delayed
|
@delayed
|
||||||
@wrap_non_picklable_objects
|
@wrap_non_picklable_objects
|
||||||
def generate_optimizer_wrapped(self, params_dict: dict[str, Any]) -> dict[str, Any]:
|
def generate_optimizer_wrapped(self, params_dict: dict[str, Any]) -> dict[str, Any]:
|
||||||
@@ -279,15 +270,9 @@ class HyperOptimizer:
|
|||||||
HyperoptStateContainer.set_state(HyperoptState.OPTIMIZE)
|
HyperoptStateContainer.set_state(HyperoptState.OPTIMIZE)
|
||||||
backtest_start_time = datetime.now(UTC)
|
backtest_start_time = datetime.now(UTC)
|
||||||
|
|
||||||
# Apply parameters
|
for attr_name, attr in self.backtesting.strategy.enumerate_parameters():
|
||||||
if HyperoptTools.has_space(self.config, "buy"):
|
if attr.in_space and attr.optimize:
|
||||||
self.assign_params(params_dict, "buy")
|
attr.value = params_dict[attr_name]
|
||||||
|
|
||||||
if HyperoptTools.has_space(self.config, "sell"):
|
|
||||||
self.assign_params(params_dict, "sell")
|
|
||||||
|
|
||||||
if HyperoptTools.has_space(self.config, "protection"):
|
|
||||||
self.assign_params(params_dict, "protection")
|
|
||||||
|
|
||||||
if HyperoptTools.has_space(self.config, "roi"):
|
if HyperoptTools.has_space(self.config, "roi"):
|
||||||
self.backtesting.strategy.minimal_roi = self.custom_hyperopt.generate_roi_table(
|
self.backtesting.strategy.minimal_roi = self.custom_hyperopt.generate_roi_table(
|
||||||
|
|||||||
Reference in New Issue
Block a user