Do not allow unlimited stake_amount for hyperopt

This commit is contained in:
hroff-1902 2020-03-10 12:02:23 +03:00
parent 77944175e2
commit f7ad6c20c7

View File

@ -17,10 +17,15 @@ def setup_optimize_configuration(args: Dict[str, Any], method: RunMode) -> Dict[
""" """
config = setup_utils_configuration(args, method) config = setup_utils_configuration(args, method)
if method == RunMode.BACKTEST: no_unlimited_runmodes = {
if config['stake_amount'] == constants.UNLIMITED_STAKE_AMOUNT: RunMode.BACKTEST: 'backtesting',
raise DependencyException('stake amount could not be "%s" for backtesting' % RunMode.HYPEROPT: 'hyperoptimization',
constants.UNLIMITED_STAKE_AMOUNT) }
if (method in no_unlimited_runmodes.keys() and
config['stake_amount'] == constants.UNLIMITED_STAKE_AMOUNT):
raise DependencyException(
f'The value of `stake_amount` cannot be set as "{constants.UNLIMITED_STAKE_AMOUNT}" '
f'for {no_unlimited_runmodes[method]}')
return config return config