Skip to content

Commit

Permalink
Fix BEST_EFFORT_CANCELED order status report for dYdX (#2082)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsblom authored Nov 30, 2024
1 parent 444b4cf commit ff7ecf2
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions nautilus_trader/adapters/dydx/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ def _handle_subaccounts_channel_data(self, raw: bytes) -> None:
f"Failed to parse subaccounts channel data: {raw.decode()} with error {e}",
)

def _handle_order_message( # noqa: C901
def _handle_order_message(
self,
order_msg: DYDXWsOrderSubaccountMessageContents,
) -> None:
Expand Down Expand Up @@ -842,7 +842,7 @@ def _handle_order_message( # noqa: C901
venue_order_id=report.venue_order_id,
ts_event=report.ts_last,
)
elif order_msg.status == DYDXOrderStatus.CANCELED:
elif order_msg.status in (DYDXOrderStatus.BEST_EFFORT_CANCELED, DYDXOrderStatus.CANCELED):
if order.status != OrderStatus.CANCELED:
self.generate_order_canceled(
strategy_id=strategy_id,
Expand All @@ -851,20 +851,6 @@ def _handle_order_message( # noqa: C901
venue_order_id=report.venue_order_id,
ts_event=report.ts_last,
)
elif order_msg.status in (
DYDXOrderStatus.UNTRIGGERED,
DYDXOrderStatus.BEST_EFFORT_CANCELED,
):
self.generate_order_updated(
strategy_id=strategy_id,
instrument_id=report.instrument_id,
client_order_id=report.client_order_id,
venue_order_id=report.venue_order_id,
quantity=report.quantity,
price=report.price,
trigger_price=report.trigger_price,
ts_event=report.ts_last,
)
elif order_msg.status == DYDXOrderStatus.FILLED:
# Skip order filled message. The _handle_fill_message generates
# a fill report.
Expand Down

0 comments on commit ff7ecf2

Please sign in to comment.