wss://advanced-trade-ws.coinbase.com
This public WebSocket feed delivers real-time updates on market orders and trades for various cryptocurrency products.
wss://advanced-trade-ws-user.coinbase.com
This authenticated WebSocket feed provides real-time updates on the user’s orders, including order status and updates on active trades.
wss://advanced-trade-ws.coinbase.com
This endpoint provides real-time market data, including updates on orders, trades, and price changes for various cryptocurrency pairs. Authentication is not required for most channels on this endpoint.
User Order Data Endpoint: wss://advanced-trade-ws-user.coinbase.com
This endpoint provides updates related to a user’s orders, including order status, fills, and real-time changes. It requires authentication using a JWT (JSON Web Token).
ticker
channel for the BTC-USD product.
First, let’s install the necessary dependency::
pip install websocket
ticker
channel for the BTC-USD product. The WebSocket then begins streaming real-time price updates for that product.
user
channel.
First, let’s install the necessary dependencies:
user
or futures_balance_summary
channels, you must include a valid JWT in the subscription message. The JWT is generated using your API key and signing key.
pip install websocket-client PyJWT cryptography
Then, generate the JWT for authentication:
user
channel for receiving updates on your orders:
Channel | Description | Authentication Required |
---|---|---|
ticker | Real-time price updates every time a match happens | No |
ticker_batch | Real-time price updates every 5000 milliseconds | No |
market_trades | Real-time updates every time a market trade happens | No |
status | Sends all products and currencies on a preset interval | No |
level2 | All updates and easiest way to keep order book snapshot | No |
candles | Price updates aggregated into time intervals | No |
user | Only sends messages that include the authenticated user | Yes |
heartbeats | Real-time server pings to keep all connections open | No |
futures_balance_summary | Real-time updates every time a user’s futures balance changes | Yes |
heartbeats
channel sends periodic heartbeat messages to ensure the WebSocket connection remains active, especially when there are no frequent updates in other channels (e.g., illiquid markets). It is a best practice to subscribe to the heartbeats
channel alongside other channels to prevent connections from closing due to inactivity.user
channel: