Params
Positions Snapshots
Upon subscription, theaccount_positions websocket immediately returns a snapshot of all current positions, then begins streaming all changes made to an account’s positions in a best effort picture of current state.We recommend using
account_positions for initialization, and account_trades, to construct up-to-date positions state.
Every account_positions message is a complete replacement — replace your whole local array on each message rather than merging. A closed position is dropped (there is no zero row or deletion marker), and an empty data: [] array means the account is flat.
Each message carries a Last ID (li) on every row and one on the envelope for the whole position set. On (re)subscription, use the initialization snapshot as your baseline, then apply later snapshots with an equal or newer envelope li and discard older ones.
Stream
| Field | Type | Description |
|---|---|---|
’s’ | string | Symbol |
’d’ | string | Position side (bid, ask) |
‘a’ | decimal string | Position amount |
’p’ | decimal string | Average entry price |
’m’ | decimal string | Position margin |
’f’ | decimal string | Position funding fee |
’i’ | bool | Is position isolated? |
‘l’ | decimal string | Liquidation price in USD (null if not applicable) |
‘t’ | number | Timestamp in milliseconds |
’li’ (row) | number or null | Last ID — sequence number for this (account, symbol) position. null if the engine has not touched the row yet. |
‘li’ (envelope) | number | Last ID — sequence number for the account’s whole position set. Advances on every change, including closes and empty snapshots. |