Merge pull request #2009 from hroff-1902/fix-2008

fix #2008
This commit is contained in:
Matthias
2019-07-15 10:55:33 +02:00
committed by GitHub
3 changed files with 37 additions and 11 deletions

View File

@@ -319,6 +319,9 @@ class Backtesting(object):
position_stacking: do we allow position stacking? (default: False)
:return: DataFrame
"""
# Arguments are long and noisy, so this is commented out.
# Uncomment if you need to debug the backtest() method.
# logger.debug(f"Start backtest, args: {args}")
processed = args['processed']
stake_amount = args['stake_amount']
max_open_trades = args.get('max_open_trades', 0)

View File

@@ -190,12 +190,22 @@ class Hyperopt(Backtesting):
self.strategy.stoploss = params['stoploss']
processed = load(TICKERDATA_PICKLE)
# Use max_open_trades for hyperopt as well, except --disable-max-market-positions is set
if self.config.get('use_max_market_positions', True):
max_open_trades = self.config['max_open_trades']
else:
logger.debug('Ignoring max_open_trades (--disable-max-market-positions was used) ...')
max_open_trades = 0
min_date, max_date = get_timeframe(processed)
results = self.backtest(
{
'stake_amount': self.config['stake_amount'],
'processed': processed,
'position_stacking': self.config.get('position_stacking', True),
'max_open_trades': max_open_trades,
'position_stacking': self.config.get('position_stacking', False),
'start_date': min_date,
'end_date': max_date,
}