Skip to main content
The Coinbase Advanced Trade Market Data WebSocket feed provides the following channels:

Working with websockets

  • Keep subscriptions open with heartbeats. Most channels close within 60-90 seconds when no updates are sent. Subscribe to the heartbeats channel alongside your other channels to keep all subscriptions open — especially useful for illiquid pairs.
  • Authenticate for a reliable connection. For the most reliable connection, authenticate with a CDP API key when subscribing to any channel.
  • USDC products. Subscribing to -USDC products is only available on the user channel. Other channels return the same data as the corresponding -USD products. USDT-USDC and EURC-USDC are available on all channels.
For more detail, see:

Heartbeats Channel

Subscribe to the heartbeats channel to receive heartbeats messages every second. Heartbeats include a heartbeat_counter which verifies that no messages were missed.
Subscribing to the heartbeats channel, alongside other channels, ensures that all subscriptions stay open when updates are sparse. This is useful, for example, when fetching market data for illiquid pairs.
A heartbeats message is of the type heartbeats as seen below.

Candles Channel

Subscribe to the candles channel to receive candles messages for specific products with updates every second. Candles are grouped into buckets (granularities) of five minutes.
A candles message is of the type candles and some of its parameters include:
  • start - string representation of the UNIX timestamp of the candle.
  • high and low - highest and lowest prices during the bucket interval.
  • open and close - prices of the first and last trade respectively.
  • volume - base amount that has been traded during this interval.
  • product_id - product identifier for this candle

Market Trades Channel

The market_trades channel sends market trades for a specified product on a preset interval. Clients should provide an array of product_ids for which they would like status subscriptions.
A market trades message is of the type snapshot or update, and contains an array of market trades. Each market trade belongs to a side, which refers to the makers side, and can be of type BUY, or SELL. The channel collects all updates over the last 250 ms and sends them as an update — so an update can contain one or many trades, depending on the last 250 ms of trading volume.

Status Channel

The status channel sends all products and currencies on a preset interval. Clients should provide an array of product_ids for which they would like status subscriptions.
The status channel, like most channels, closes within 60-90 seconds when there are no updates. For example, if you listen for BTC-USD updates and nothing changes within 60-90 seconds (which is common), the channel closes. To avoid this, subscribe to the heartbeats in addition to your other channels.

Ticker Channel

The ticker channel provides real-time price updates every time a match happens. It batches updates in case of cascading matches, greatly reducing bandwidth requirements.

Ticker Batch Channel

The ticker_batch channel provides latest price updates every 5000 milliseconds (5 seconds) if there is a change. It has the same JSON message schema as the ticker channel, except the channel field will have a value of ticker_batch and it currently doesn’t provide best bid or best ask fields.

Level2 Channel

The level2 channel guarantees delivery of all updates and is the easiest way to keep a snapshot of the order book.
Subscribe to the level2 channel to guarantee that messages are delivered and your order book is in sync.
The level2 channel sends a message with fields, type (“snapshot” or “update”), product_id, and updates. The field updates is an array of objects of {price_level, new_quantity, event_time, side} to represent the entire order book. Theevent_time property is the time of the event as recorded by our trading engine.
The new_quantity property is the updated size at that price level, not a delta. A new_quantity of “0” indicates the price level can be removed.

User Channel

The user channel sends updates on all of a user’s open orders and current positions, including all subsequent updates of those orders and positions. The user channel expects one connection per user:
  • This connection accepts multiple product IDs in a product_ids array. If none are provided, the WebSocket subscription is open to all product IDs.
  • To subscribe to new product_ids, close your previous connection by unsubscribing and open a new connection with product_ids added to the array.
Subscribing to the User channel returns all OPEN orders, batched by 50, in the first few messages of the stream. For example, if you have 109 orders, you will get a snapshot containing 50 orders, followed by a patch of 50 orders, followed by a patch of 9 orders. To know when all of your open orders are returned, look for the first message with less than 50 orders.

Orders Fields

Positions Fields

Numeric values are in units of USDC.
The positions fields are in beta and is currently returned as an empty array by default. To enable access to the positions fields in the User WebSocket channel, please reach out to us through Discord.
Perpetual Futures

Expiring Futures

The positions object also includes a prediction_market_positions array. This field is in beta.

Futures Balance Summary Channel

The futures_balance_summary channel sends updates on all of a user’s futures balances, including all subsequent updates of those balances.
See Also: