Start with a lifecycle record, not only an order ID
- Submit the order request and store the request metadata you will need later: trader, strategy, symbol, nonce, client timestamp, and local submission time.
- Bootstrap current order and strategy state from REST before you rely on realtime user-data feeds.
- Subscribe to
ORDER_UPDATEandSTRATEGY_UPDATEwithtraderAddressand optionalstrategyIdHash,symbol, orreasonfilters. - Correlate updates by the stable order identity fields in the payload, plus
orderMatchOrdinaland per-outcome ordinals where applicable. - Apply updates using the documented ordering fields, not local arrival time alone.
- Keep the order open until a terminal state is explicit in the update stream or reconciled from REST history.
Use a state model that matches the platform
| State | Meaning |
|---|---|
| Submitted | Client sent the request but has not yet confirmed sequencing acceptance |
| Sequenced / accepted | The platform admitted the request into ordered processing |
| Posted | Order entered the book without immediate full fill |
| Partially filled | The order has fills plus remaining size |
| Fully filled | No remaining size exists |
| Canceled | Remaining size was intentionally removed |
| Rejected | The order never became a live executable order or a later lifecycle operation failed |
| Liquidated / ADL-resolved | Order/account effects were resolved through stressed-path safety handling |
Reconnect and replay safely
- If the WebSocket disconnects, reconnect first.
- Resubscribe to the affected feeds.
- Resume one update family with its own
globalOrdinalhistory rules if you need gap repair. - Reconcile the target order plus its strategy state from REST before concluding the live state is complete again.
Important edge cases
| Edge case | Why it matters |
|---|---|
| Rejected outcomes with placeholder maker fields | Fully rejected orders can carry incomplete maker-intent fields; do not over-trust those values |
| Multi-outcome matches | One match can generate multiple ORDER_UPDATE outcomes; use orderMatchOrdinal and per-outcome ordinal fields |
| Balance effects after trading outcomes | Fees, funding, liquidation, and PnL realization can appear on strategy or trader surfaces in addition to order updates |