Rollback defaulting to DefaultHyperOptLoss

This commit is contained in:
hroff-1902
2019-10-11 23:33:22 +03:00
parent c4105436eb
commit 08e6d8a780
6 changed files with 11 additions and 42 deletions

View File

@@ -8,6 +8,7 @@ from pathlib import Path
from typing import Optional, Dict
from freqtrade import OperationalException
from freqtrade.constants import DEFAULT_HYPEROPT_LOSS
from freqtrade.optimize.hyperopt_interface import IHyperOpt
from freqtrade.optimize.hyperopt_loss_interface import IHyperOptLoss
from freqtrade.resolvers import IResolver
@@ -87,12 +88,9 @@ class HyperOptLossResolver(IResolver):
"""
config = config or {}
if not config.get('hyperopt_loss'):
raise OperationalException("No Hyperopt Loss Function set. Please use "
"`--hyperopt-loss` to specify "
"the Hyperopt Loss Function class to use.")
hyperoptloss_name = config['hyperopt_loss']
# Verify the hyperopt_loss is in the configuration, otherwise fallback to the
# default hyperopt loss
hyperoptloss_name = config.get('hyperopt_loss') or DEFAULT_HYPEROPT_LOSS
self.hyperoptloss = self._load_hyperoptloss(
hyperoptloss_name, config, extra_dir=config.get('hyperopt_path'))