hyperopt - freqai - change validation to config_validation

This commit is contained in:
Wagner Costa Santos 2022-09-07 11:11:31 -03:00
parent 6b7644029c
commit 972b699105
2 changed files with 9 additions and 10 deletions

View File

@ -84,6 +84,7 @@ def validate_config_consistency(conf: Dict[str, Any], preliminary: bool = False)
_validate_protections(conf) _validate_protections(conf)
_validate_unlimited_amount(conf) _validate_unlimited_amount(conf)
_validate_ask_orderbook(conf) _validate_ask_orderbook(conf)
_validate_freqai_hyperopt(conf)
validate_migrated_strategy_settings(conf) validate_migrated_strategy_settings(conf)
# validate configuration before returning # validate configuration before returning
@ -323,6 +324,14 @@ def _validate_pricing_rules(conf: Dict[str, Any]) -> None:
del conf['ask_strategy'] del conf['ask_strategy']
def _validate_freqai_hyperopt(conf: Dict[str, Any]) -> None:
freqaimodel = conf.get('freqaimodel')
analyze_per_epoch = conf.get('analyze_per_epoch', False)
if analyze_per_epoch and freqaimodel is not None:
raise OperationalException(
'Using analyze-per-epoch parameter is not supported with a FreqAI strategy.')
def _strategy_settings(conf: Dict[str, Any]) -> None: def _strategy_settings(conf: Dict[str, Any]) -> None:
process_deprecated_setting(conf, None, 'use_sell_signal', None, 'use_exit_signal') process_deprecated_setting(conf, None, 'use_sell_signal', None, 'use_exit_signal')

View File

@ -285,7 +285,6 @@ class Configuration:
logger.info('Parameter --stoplosses detected: %s ...', self.args["stoploss_range"]) logger.info('Parameter --stoplosses detected: %s ...', self.args["stoploss_range"])
# Hyperopt section # Hyperopt section
self._check_hyperopt_analyze_per_epoch_freqai()
self._args_to_config(config, argname='hyperopt', self._args_to_config(config, argname='hyperopt',
logstring='Using Hyperopt class name: {}') logstring='Using Hyperopt class name: {}')
@ -538,12 +537,3 @@ class Configuration:
config['pairs'] = load_file(pairs_file) config['pairs'] = load_file(pairs_file)
if 'pairs' in config and isinstance(config['pairs'], list): if 'pairs' in config and isinstance(config['pairs'], list):
config['pairs'].sort() config['pairs'].sort()
def _check_hyperopt_analyze_per_epoch_freqai(self) -> None:
"""
Helper for block hyperopt with analyze-per-epoch param.
"""
if ("analyze_per_epoch" in self.args and
self.args["analyze_per_epoch"] and "freqaimodel" in self.args):
raise OperationalException('analyze-per-epoch parameter is \
not allowed with a Freqai strategy.')