margin channel streams the margin state of your derivatives wallets: the multi-collateral (flex) wallet and each single-collateral wallet.
It carries the margin portion of the Derivatives WebSocket balances feed — the flex_futures and futures structures. Use balances for asset quantities and ledger transactions; use this channel for margin requirements, margin equity, and available margin.
This channel contains account specific data, an authentication token is required in the request.
This channel is currently only available for futures (
derivatives).Subscribe
- Request
- Response
snapshot parameter. Every message is a full state replacement, and the current state is always delivered on subscribe. Sending params.snapshot is rejected with 'params.snapshot' is not valid for the margin channel.
A connection may hold a single margin subscription, bound to the account of the token used to subscribe. A second subscribe attempt on the same connection is rejected with Already subscribed to margin channel.
Messages
Each message carries one complete section of your margin state, identified bytype: the multi-collateral wallet (multi_collateral) or the single-collateral wallets (single_collateral). There is no snapshot/update distinction — data is always the full current state of that section, never a delta.
Replace any state you hold for a section when a message for it arrives, rather than merging into it. You receive the current state of each applicable section on subscribe, then a fresh message for a section whenever it changes.
All margin figures are sent as JSON numbers. Use a decimal-aware JSON parser if you need to preserve all digits. A figure that is unavailable is omitted from
data rather than sent as null.Multi-collateral wallet
string
Value:
marginstring
Value:
multi_collateralobject
Margin state of the multi-collateral (flex) wallet. All values are in USD.
Single-collateral wallets
string
Value:
marginstring
Value:
single_collateralobject
Margin unavailable
string
Value:
marginstring
One of:
margin_unavailableYour margin state cannot be served, and the subscription has been dropped server side. This can arrive after a successful subscribe acknowledgement. Resubscribe to resume the feed.