pub fn parse_order_event(
msg: &OKXOrderMsg,
client_order_id: ClientOrderId,
account_id: AccountId,
trader_id: TraderId,
strategy_id: StrategyId,
instrument: &InstrumentAny,
previous_fee: Option<Money>,
previous_filled_qty: Option<Quantity>,
previous_state: Option<&OrderStateSnapshot>,
ts_init: UnixNanos,
) -> Result<ParsedOrderEvent>Expand description
Parses an OKX order message into a specific order event.
This function determines the appropriate event type based on:
- Current order status from OKX
- Whether there’s a new fill
- Whether the order was updated (price/quantity change)
- Whether it’s an algo order that triggered
§Errors
Returns an error if parsing order identifiers or numeric fields fails.