Improve error when hyperopt-loss-function is missing

This commit is contained in:
Matthias
2020-10-28 07:58:55 +01:00
parent 28d6c3419b
commit 5cb3735a57
3 changed files with 11 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ import logging
from pathlib import Path
from typing import Dict
from freqtrade.constants import USERPATH_HYPEROPTS
from freqtrade.constants import HYPEROPT_LOSS_BUILTIN, USERPATH_HYPEROPTS
from freqtrade.exceptions import OperationalException
from freqtrade.optimize.hyperopt_interface import IHyperOpt
from freqtrade.optimize.hyperopt_loss_interface import IHyperOptLoss
@@ -72,8 +72,11 @@ class HyperOptLossResolver(IResolver):
hyperoptloss_name = config.get('hyperopt_loss')
if not hyperoptloss_name:
raise OperationalException("No Hyperopt loss set. Please use `--hyperopt-loss` to "
"specify the Hyperopt-Loss class to use.")
raise OperationalException(
"No Hyperopt loss set. Please use `--hyperopt-loss` to "
"specify the Hyperopt-Loss class to use.\n"
f"Built-in Hyperopt-loss-functions are: {', '.join(HYPEROPT_LOSS_BUILTIN)}"
)
hyperoptloss = HyperOptLossResolver.load_object(hyperoptloss_name,
config, kwargs={},
extra_dir=config.get('hyperopt_path'))