Access real-time platform data
- Bootstrap the initial state you need from REST.
- Open the realtime connection and subscribe only to the feeds your workflow needs.
- Track acknowledgements, ordinals, and reconnect state explicitly.
- Apply updates in connection order and reconcile by update family after reconnects.
- Keep market-data and user-data handling separate in your application pipeline.
Build the initial baseline first
- Use REST to load the current products, market snapshot, or user-scoped state your workflow needs.
- Keep that baseline in memory or persistent storage before subscribing.
- Record which update families you will resume later if the WebSocket reconnects.
Subscribe with the correct feed shape
| Need | Feed family |
|---|---|
| public market depth | ORDER_BOOK_L2 or ORDER_BOOK_L3 |
| live mark price | MARK_PRICE |
| order lifecycle outcomes | ORDER_UPDATE |
| strategy collateral and position updates | STRATEGY_UPDATE |
| trader-level balance and profile updates | TRADER_UPDATE |
Process updates safely
- Wait for
ACKNOWLEDGEon your subscribe and unsubscribe messages. - Apply messages in top-level
ordinalorder for the active connection. - Treat
globalOrdinalas per-update-family resume state, not as one number that can be compared across every message type. - Use
orderMatchOrdinalplusORDER_UPDATE.ordinalwhen you need to reconstruct one multi-outcome match.
Reconnect without corrupting state
- re-open the connection
- resubscribe to the exact feed set you previously used
- resume one update family with its own
globalOrdinal - run a REST reconciliation pass when the workflow requires exact current state