Adding ability to ignore unparameterized spaces

This commit is contained in:
Scott Lyons 2021-09-30 01:11:02 -07:00 committed by GitHub
parent 95227376b6
commit df45f467c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,27 +237,63 @@ class Hyperopt:
logger.debug("Hyperopt has 'protection' space") logger.debug("Hyperopt has 'protection' space")
# Enable Protections if protection space is selected. # Enable Protections if protection space is selected.
self.config['enable_protections'] = True self.config['enable_protections'] = True
try:
self.protection_space = self.custom_hyperopt.protection_space() self.protection_space = self.custom_hyperopt.protection_space()
except OperationalException as e:
if self.config["hyperopt_ignore_unparam_space"]:
logger.warning(e)
else:
raise
if HyperoptTools.has_space(self.config, 'buy'): if HyperoptTools.has_space(self.config, 'buy'):
logger.debug("Hyperopt has 'buy' space") logger.debug("Hyperopt has 'buy' space")
try:
self.buy_space = self.custom_hyperopt.buy_indicator_space() self.buy_space = self.custom_hyperopt.buy_indicator_space()
except OperationalException as e:
if self.config["hyperopt_ignore_unparam_space"]:
logger.warning(e)
else:
raise
if HyperoptTools.has_space(self.config, 'sell'): if HyperoptTools.has_space(self.config, 'sell'):
logger.debug("Hyperopt has 'sell' space") logger.debug("Hyperopt has 'sell' space")
try:
self.sell_space = self.custom_hyperopt.sell_indicator_space() self.sell_space = self.custom_hyperopt.sell_indicator_space()
except OperationalException as e:
if self.config["hyperopt_ignore_unparam_space"]:
logger.warning(e)
else:
raise
if HyperoptTools.has_space(self.config, 'roi'): if HyperoptTools.has_space(self.config, 'roi'):
logger.debug("Hyperopt has 'roi' space") logger.debug("Hyperopt has 'roi' space")
try:
self.roi_space = self.custom_hyperopt.roi_space() self.roi_space = self.custom_hyperopt.roi_space()
except OperationalException as e:
if self.config["hyperopt_ignore_unparam_space"]:
logger.warning(e)
else:
raise
if HyperoptTools.has_space(self.config, 'stoploss'): if HyperoptTools.has_space(self.config, 'stoploss'):
logger.debug("Hyperopt has 'stoploss' space") logger.debug("Hyperopt has 'stoploss' space")
try:
self.stoploss_space = self.custom_hyperopt.stoploss_space() self.stoploss_space = self.custom_hyperopt.stoploss_space()
except OperationalException as e:
if self.config["hyperopt_ignore_unparam_space"]:
logger.warning(e)
else:
raise
if HyperoptTools.has_space(self.config, 'trailing'): if HyperoptTools.has_space(self.config, 'trailing'):
logger.debug("Hyperopt has 'trailing' space") logger.debug("Hyperopt has 'trailing' space")
try:
self.trailing_space = self.custom_hyperopt.trailing_space() self.trailing_space = self.custom_hyperopt.trailing_space()
except OperationalException as e:
if self.config["hyperopt_ignore_unparam_space"]:
logger.warning(e)
else:
raise
self.dimensions = (self.buy_space + self.sell_space + self.protection_space self.dimensions = (self.buy_space + self.sell_space + self.protection_space
+ self.roi_space + self.stoploss_space + self.trailing_space) + self.roi_space + self.stoploss_space + self.trailing_space)