Account positions

Streams all changes made to an account's positions in any market. A position that has been fully closed will be streamed and return empty.

Refer to Websocket for establishing the websocket connection.

Params

{
    "method": "subscribe",
    "params": {
        "source": "account_positions",
        "account": "42trU9A5..."
    }
}

Positions Snapshots

Upon subscription, the account_positions websocket immediately returns a snapshot of all current positions, then begins streams 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.

Stream

{
  "channel": "subscribe",
  "data": {
    "source": "account_positions",
    "account": "BrZp5..."
  }
}
// this is the initialization snapshot
{
  "channel": "account_positions", 
  "data": [
    {
      "s": "BTC",
      "d": "bid",
      "a": "0.00022",
      "p": "87185",
      "m": "0",
      "f": "-0.00023989",
      "i": false,
      "l": null,
      "t": 1764133203991
    }
  ],
  "li": 1559395580
}
// this shows the position being increased by an order filling
{
  "channel": "account_positions",
  "data": [
    {
      "s": "BTC",
      "d": "bid",
      "a": "0.00044",
      "p": "87285.5",
      "m": "0",
      "f": "-0.00023989",
      "i": false,
      "l": "-95166.79231",
      "t": 1764133656974
    }
  ],
  "li": 1559412952
}
// this shows the position being closed
{
  "channel": "account_positions",
  "data": [],
  "li": 1559438203
}
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'

number

Exchange-wide nonce. Used to reliably determine exchange event ordering. Sequential and not subject to clock drift.

Last updated