Skip to main content
The Coinbase Derivatives: Predictions WebSocket Market Data API streams tickers, public trades, order books, and instrument and event changes as JSON over a single WebSocket connection.
  • Authentication: Credentials, signature, and authorization on the first command.
  • Commands: Subscribe, unsubscribe, list subscriptions, and update subscription.
  • Channels: Ticker, trade, orderbook, instrument lifecycle, and event lifecycle.

Connection

Authentication lasts for the life of the connection. If the connection drops, reconnect, authenticate again, and resubscribe.

Data frames

The ticker, trade, and orderbook channels send frames with this envelope: Lifecycle frames carry type, sid, and msg, and do not carry seq.
  • Key sets do not vary with the data. When a value is unknown, the key is present with JSON null.
  • Prices are strings with 3 decimal places. Quantities are strings with 2 decimal places.
  • Instrument and trade IDs are strings, to avoid precision loss in languages such as JavaScript.
  • msg.ticker is always present and is null when the instrument has no ticker.
If your client cannot read frames fast enough, the server may drop frames. A dropped frame still consumes a seq value, so a gap in seq means you missed data. To recover, unsubscribe and subscribe again. If your client falls too far behind, the server may close the connection.

Example session

You send an authenticated subscribe for one ticker. The credential keys are described in Authentication.
The server accepts the subscription:
The server streams ticker frames, starting at seq 1:
You unsubscribe:
The server confirms. seq is 1 because one data frame was sent on the subscription:

Errors

Error frames use this envelope: Example error frame, for a subscribe whose ticker matches no instrument:

Limits