Real-Time Data via WebSocket
Real-Time Data via WebSocket
Connect, authorize, subscribe, and decode market-data events.
Market data streams over a WebSocket on a dedicated host. The low-level wire protocol — frame types, request framing, heartbeats, and market replay — is the same one the trading API uses, so see the Trade API Real-Time Data via WebSocket guide for the full protocol. This page covers what’s specific to market data.
Connect and Authorize
Open a WebSocket to the market-data host and authorize it once with your mdAccessToken (see Authentication & Access):
Subscribe and Stream
Send a subscription request — for example md/subscribeQuote with a symbol — and the server streams matching events until you unsubscribe. Each subscription returns a subscription ID; cache it so you can unsubscribe later. The WebSocket API reference documents every channel and message, and the Market Data overview walks the end-to-end flow.
Market Data Events
Market data arrives as event frames inside a[...] array frames:
e: "md"— quote, DOM, and histogram updates, carried ind.quotes,d.doms, ord.histograms.e: "chart"— bar and tick chart packets, carried ind.charts.
For example, a quote event:
A server that’s actively streaming won’t send heartbeats, so your client must send a heartbeat every 2.5 seconds to keep the connection alive. See Client Heartbeats in the protocol guide.

