Improve backtest performance

This commit is contained in:
Matthias
2021-03-13 10:16:32 +01:00
parent ef9977fc1e
commit d1acc8092c
5 changed files with 42 additions and 9 deletions

View File

@@ -377,7 +377,7 @@ class Backtesting:
open_trade_count += 1
# logger.debug(f"{pair} - Emulate creation of new trade: {trade}.")
open_trades[pair].append(trade)
LocalTrade.trades.append(trade)
LocalTrade.add_bt_trade(trade)
for trade in open_trades[pair]:
# also check the buying candle for sell conditions.
@@ -387,6 +387,8 @@ class Backtesting:
# logger.debug(f"{pair} - Backtesting sell {trade}")
open_trade_count -= 1
open_trades[pair].remove(trade)
LocalTrade.close_bt_trade(trade)
trades.append(trade_entry)
if enable_protections:
self.protections.stop_per_pair(pair, row[DATE_IDX])