[SQUASH] Address PR comments.
* Split Parameter into IntParameter/FloatParameter/CategoricalParameter. * Rename IHyperStrategy to HyperStrategyMixin and use it as mixin. * --hyperopt parameter is now optional if strategy uses HyperStrategyMixin. * Use OperationalException() instead of asserts.
This commit is contained in:
@@ -23,6 +23,7 @@ from pandas import DataFrame
|
||||
from freqtrade.constants import DATETIME_PRINT_FORMAT, LAST_BT_RESULT_FN
|
||||
from freqtrade.data.converter import trim_dataframe
|
||||
from freqtrade.data.history import get_timerange
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.misc import file_dump_json, plural
|
||||
from freqtrade.optimize.backtesting import Backtesting
|
||||
# Import IHyperOpt and IHyperOptLoss to allow unpickling classes from these modules
|
||||
@@ -68,7 +69,11 @@ class Hyperopt:
|
||||
|
||||
self.backtesting = Backtesting(self.config)
|
||||
|
||||
if self.config['hyperopt'] == 'HyperOptAuto':
|
||||
if not self.config.get('hyperopt'):
|
||||
if not getattr(self.backtesting.strategy, 'HYPER_STRATEGY', False):
|
||||
raise OperationalException('Strategy is not auto-hyperoptable. Specify --hyperopt '
|
||||
'parameter or add HyperStrategyMixin mixin to your '
|
||||
'strategy class.')
|
||||
self.custom_hyperopt = HyperOptAuto(self.config)
|
||||
else:
|
||||
self.custom_hyperopt = HyperOptResolver.load_hyperopt(self.config)
|
||||
|
Reference in New Issue
Block a user