BT: Update trade open_rate on first filled order.
This commit is contained in:
parent
25c74e26d1
commit
2bed0eab0c
@ -813,6 +813,11 @@ class Backtesting:
|
||||
cost=stake_amount + trade.fee_open,
|
||||
)
|
||||
if pos_adjust and self._get_order_filled(order.price, row):
|
||||
# Update trade open_rate on first filled order
|
||||
# this is for cases where adjust_entry_order might have replaced the
|
||||
# initial order from trade opening
|
||||
if len(trade.select_filled_orders(trade.entry_side)) == 1:
|
||||
trade.open_rate = order.price
|
||||
order.close_bt_order(current_time)
|
||||
else:
|
||||
trade.open_order_id = str(self.order_id_counter)
|
||||
|
Loading…
Reference in New Issue
Block a user