Fix problem when no experimental dict is available

This commit is contained in:
Matthias 2019-01-06 10:35:18 +01:00
parent 798ae460d8
commit 2147bd8847
2 changed files with 12 additions and 0 deletions

View File

@ -153,6 +153,9 @@ class Hyperopt(Backtesting):
spaces += self.custom_hyperopt.indicator_space() spaces += self.custom_hyperopt.indicator_space()
if self.has_space('sell'): if self.has_space('sell'):
spaces += self.custom_hyperopt.sell_indicator_space() spaces += self.custom_hyperopt.sell_indicator_space()
# Make sure experimental is enabled
if 'experimental' not in self.config:
self.config['experimental'] = {}
self.config['experimental']['use_sell_signal'] = True self.config['experimental']['use_sell_signal'] = True
if self.has_space('roi'): if self.has_space('roi'):
spaces += self.custom_hyperopt.roi_space() spaces += self.custom_hyperopt.roi_space()

View File

@ -312,6 +312,15 @@ def test_generate_optimizer(mocker, default_conf) -> None:
'mfi-enabled': False, 'mfi-enabled': False,
'rsi-enabled': False, 'rsi-enabled': False,
'trigger': 'macd_cross_signal', 'trigger': 'macd_cross_signal',
'sell-adx-value': 0,
'sell-fastd-value': 75,
'sell-mfi-value': 0,
'sell-rsi-value': 0,
'sell-adx-enabled': False,
'sell-fastd-enabled': True,
'sell-mfi-enabled': False,
'sell-rsi-enabled': False,
'sell-trigger': 'macd_cross_signal',
'roi_t1': 60.0, 'roi_t1': 60.0,
'roi_t2': 30.0, 'roi_t2': 30.0,
'roi_t3': 20.0, 'roi_t3': 20.0,