fix: call order_filled callback for left open trades

This commit is contained in:
Matthias 2024-09-07 09:24:21 +02:00
parent d9ec66695c
commit 1b00f512c1

View File

@ -1165,12 +1165,10 @@ class Backtesting:
self._exit_trade( self._exit_trade(
trade, exit_row, exit_row[OPEN_IDX], trade.amount, ExitType.FORCE_EXIT.value trade, exit_row, exit_row[OPEN_IDX], trade.amount, ExitType.FORCE_EXIT.value
) )
trade.orders[-1].close_bt_order(exit_row[DATE_IDX].to_pydatetime(), trade)
trade.close_date = exit_row[DATE_IDX].to_pydatetime()
trade.exit_reason = ExitType.FORCE_EXIT.value trade.exit_reason = ExitType.FORCE_EXIT.value
trade.close(exit_row[OPEN_IDX], show_msg=False) self._process_exit_order(
LocalTrade.close_bt_trade(trade) trade.orders[-1], trade, exit_row[DATE_IDX].to_pydatetime(), exit_row, pair
)
def trade_slot_available(self, open_trade_count: int) -> bool: def trade_slot_available(self, open_trade_count: int) -> bool:
# Always allow trades when max_open_trades is enabled. # Always allow trades when max_open_trades is enabled.