Fix but with late entries in backtesting

This commit is contained in:
Matthias 2022-06-18 09:05:22 +02:00
parent 616bf315cb
commit 017fd03180
2 changed files with 3 additions and 2 deletions

View File

@ -1078,6 +1078,8 @@ class Backtesting:
open_trade_count += 1
# logger.debug(f"{pair} - Emulate creation of new trade: {trade}.")
open_trades[pair].append(trade)
LocalTrade.add_bt_trade(trade)
self.wallets.update()
for trade in list(open_trades[pair]):
# 3. Process entry orders.
@ -1085,7 +1087,6 @@ class Backtesting:
if order and self._get_order_filled(order.price, row):
order.close_bt_order(current_time, trade)
trade.open_order_id = None
LocalTrade.add_bt_trade(trade)
self.wallets.update()
# 4. Create exit orders (if any)