Connection
Connect to the Phoenix WebSocket endpoint:PHOENIX_WS_URL when it is set. Otherwise, it derives the WebSocket URL from PHOENIX_API_URL by switching http to ws and using /v1/ws.
Messages are UTF-8 JSON objects.
Client messages
Subscribe with atype and subscription envelope:
Supported channels
Control responses
The server confirms successful subscriptions with asubscriptionConfirmed message:
subscriptionError:
error channel:
Market subscriptions
Exchange
Use theexchange channel to keep local exchange and market-parameter metadata in sync. The server sends an initial snapshot followed by ordered deltas when exchange keys, exchange status, markets, or market parameters change.
encoding field is optional. Omit it to use the default compressed snapshot response:
encoding to json to receive the initial snapshot as JSON. The examples below are abbreviated to show the fields relevant to cache synchronization:
delta with the next sequenceNumber to your local cache. If a sequence number is skipped, resubscribe and rebuild from a fresh snapshot.
All mids
Funding rate
Orderbook
SetbypassExecutionBand to true to receive the full orderbook during commodities after-hours, including price levels outside the tradeable execution band.
Market stats
Trades
Candles
Supported timeframes are1s, 5s, 1m, 5m, 15m, 30m, 1h, 4h, and 1d.
channel set to candle:
Trader subscriptions
Trader state
snapshot or delta payloads.