Quickstart
Stream trades from the market-data socket
This walks the market-data WebSocket end to end: connect, authenticate, subscribe, read frames. You need a token first — see Authentication.
Connect
Open a WebSocket to the production endpoint. One connection carries every topic you subscribe to.
Authenticate
Send your token as a message once the socket is open — the socket authenticates by message, not in the handshake:
The acknowledgement echoes your reqId. Wait for it before you subscribe:
A token that does not verify is answered "success": false with "error": "invalid_token".
The same in Python
What to know next
- Heartbeats. Every session receives a heartbeat carrying
streamAgeMs, the stream-freshness floor: it tells a quiet market from a stalled stream. - Falling behind. A session that cannot keep up is disconnected, not throttled. Reconnect,
authenticate and subscribe again: a latest-image topic such as
tobpushes its current image when you subscribe, and a synced book its snapshot. - Books. A book topic may answer
syncingrather thanlive: its snapshot arrives the moment the book is synced. A stale marker means the book cannot be trusted until the restatement that follows it. - Conflation. Append a conflation tier to a topic to receive it at a fixed cadence rather than every update — the tiers, every channel and every frame are in the Market Data WebSocket reference.