max_open_trades should be an integer

Max open trades will be always an integer in the strategy (-1 for infinity), but in the config -1 will be parsed as infinity
This commit is contained in:
Antonio Della Fortuna
2023-01-04 16:09:27 +01:00
parent 1c5e172683
commit f2fa476dc6
8 changed files with 27 additions and 16 deletions

View File

@@ -119,11 +119,14 @@ class Hyperopt:
# Use max_open_trades for hyperopt as well, except --disable-max-market-positions is set
if self.config.get('use_max_market_positions', True):
self.max_open_trades = self.config['max_open_trades']
self.max_open_trades = self.config['max_open_trades'] \
if self.config['max_open_trades'] != float('inf') else -1
else:
logger.debug('Ignoring max_open_trades (--disable-max-market-positions was used) ...')
self.max_open_trades = 0
print("Strategy max open trades", self.max_open_trades)
if HyperoptTools.has_space(self.config, 'sell'):
# Make sure use_exit_signal is enabled
self.config['use_exit_signal'] = True