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

@@ -231,8 +231,10 @@ AVAILABLE_CLI_OPTIONS = {
help='Specify the class name of the hyperopt loss function class (IHyperOptLoss). '
'Different functions can generate completely different results, '
'since the target for optimization is different. Built-in Hyperopt-loss-functions are: '
'DefaultHyperOptLoss, OnlyProfitHyperOptLoss, SharpeHyperOptLoss.',
'DefaultHyperOptLoss, OnlyProfitHyperOptLoss, SharpeHyperOptLoss '
'(default: `%(default)s`).',
metavar='NAME',
default=constants.DEFAULT_HYPEROPT_LOSS,
),
# List exchanges
"print_one_column": Arg(

View File

@@ -9,6 +9,7 @@ PROCESS_THROTTLE_SECS = 5 # sec
DEFAULT_TICKER_INTERVAL = 5 # min
HYPEROPT_EPOCH = 100 # epochs
RETRY_TIMEOUT = 30 # sec
DEFAULT_HYPEROPT_LOSS = 'DefaultHyperOptLoss'
DEFAULT_DB_PROD_URL = 'sqlite:///tradesv3.sqlite'
DEFAULT_DB_DRYRUN_URL = 'sqlite://'
UNLIMITED_STAKE_AMOUNT = 'unlimited'

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'))