From 9804e201146762f96752e18f41304b37bf47804a Mon Sep 17 00:00:00 2001 From: Matthias Date: Sat, 10 Apr 2021 09:53:48 +0200 Subject: [PATCH] Don't use _set_value for autoOpt-Spaces --- freqtrade/optimize/hyperopt_auto.py | 4 ++-- freqtrade/strategy/hyper.py | 10 +--------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/freqtrade/optimize/hyperopt_auto.py b/freqtrade/optimize/hyperopt_auto.py index c4d6f1581..f86204406 100644 --- a/freqtrade/optimize/hyperopt_auto.py +++ b/freqtrade/optimize/hyperopt_auto.py @@ -27,7 +27,7 @@ class HyperOptAuto(IHyperOpt): for attr_name, attr in self.strategy.enumerate_parameters('buy'): if attr.optimize: # noinspection PyProtectedMember - attr._set_value(params[attr_name]) + attr.value = params[attr_name] return self.strategy.populate_buy_trend(dataframe, metadata) return populate_buy_trend @@ -37,7 +37,7 @@ class HyperOptAuto(IHyperOpt): for attr_name, attr in self.strategy.enumerate_parameters('sell'): if attr.optimize: # noinspection PyProtectedMember - attr._set_value(params[attr_name]) + attr.value = params[attr_name] return self.strategy.populate_sell_trend(dataframe, metadata) return populate_sell_trend diff --git a/freqtrade/strategy/hyper.py b/freqtrade/strategy/hyper.py index 35000d916..3fedda974 100644 --- a/freqtrade/strategy/hyper.py +++ b/freqtrade/strategy/hyper.py @@ -50,19 +50,11 @@ class BaseParameter(ABC): return f'{self.__class__.__name__}({self.value})' @abstractmethod - def get_space(self, name: str) -> Union['Integer', 'Real', 'Categorical']: + def get_space(self, name: str) -> Union['Integer', 'Real', 'SKDecimal', 'Categorical']: """ Get-space - will be used by Hyperopt to get the hyperopt Space """ - def _set_value(self, value: Any): - """ - Update current value. Used by hyperopt functions for the purpose where optimization and - value spaces differ. - :param value: A numerical value. - """ - self.value = value - class NumericParameter(BaseParameter): """ Internal parameter used for Numeric purposes """