- Coinbase Market Data is our traditional feed which is available without authentication.
- Coinbase Direct Market Data has direct access to Coinbase Exchange servers and requires Authentication.
Coinbase Market Data
production =
sandbox =
Coinbase Direct Market Data
production =
sandbox =
production =
wss://ws-feed.exchange.coinbase.com sandbox =
wss://ws-feed-public.sandbox.exchange.coinbase.com Coinbase Direct Market Data
production =
wss://ws-direct.exchange.coinbase.com sandbox =
wss://ws-direct.sandbox.exchange.coinbase.comProtocol
The WebSocket feed uses a bidirectional protocol that encodes all messages as JSON objects. All messages have atype attribute that can be used to handle the message appropriately.
Subscribe
To begin receiving feed messages, you must send asubscribe message to the server indicating which channels and products to receive. This message is mandatory—you are disconnected if no subscribe has been received within 5 seconds.
subscriptions message as a response to an subscribe message.
Unsubscribe
To unsubscribe from channel/product pairs, send anunsubscribe message. The structure is equivalent to subscribe messages.
subscriptions message as a response to an unsubscribe message.
Specifying Product IDs
There are two ways to specify the product IDs to listen for within each channel:- You can define product IDs for an individual channel.
- You can define product IDs at the root of the object—this adds them to all the channels you subscribe to.
Subscriptions Message
Asubscriptions message is sent in response to both subscribe and unsubscribe messages.
In response to a subscribe message, the subscriptions message lists all channels you are subscribed to. Subsequent subscribe messages add to the list of subscriptions. If you subscribed to a channel without being authenticated, you will remain in the unauthenticated channel.