Properly close out orders in backtesting

This commit is contained in:
Matthias
2022-04-29 06:53:30 +02:00
parent c499bb051f
commit f709222943
2 changed files with 2 additions and 0 deletions

View File

@@ -1094,6 +1094,7 @@ class Backtesting:
# 5. Process exit orders.
order = trade.select_order(trade.exit_side, is_open=True)
if order and self._get_order_filled(order.price, row):
order.close_bt_order(current_time, trade)
trade.open_order_id = None
trade.close_date = current_time
trade.close(order.price, show_msg=False)