> ## Documentation Index
> Fetch the complete documentation index at: https://docs.roxom.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Position Updates

> Stream real-time position updates including size, margin, liquidation price, and PnL via WebSocket.

## Overview

Receive position updates including size, average entry and exit prices, margin, liquidation price, profit and loss (PnL), and more via the `positions` channel.

## Channel information

| Property             | Value                     |
| -------------------- | ------------------------- |
| **Channel Name**     | `positions`               |
| **Authentication**   | Required                  |
| **Update Frequency** | On position changes       |
| **Data Type**        | Array of position objects |

## Subscribe

<RequestExample>
  ```json Subscribe theme={null}
  {
    "op": "subscribe",
    "args": [ { "channel": "positions" } ]
  }
  ```
</RequestExample>

## Message format

<ResponseExample>
  ```json Position Update theme={null}
  {
    "type": "position",
    "data": [
      {
        "id": "pos-uuid",
        "symbol": "US500-BTC",
        "accountId": "acct-uuid",
        "side": "long",
        "entryAmount": "1.000",
        "exitAmount": "0.500",
        "size": "0.500",
        "tradeMode": "isolated",
        "openDate": 1640995200000,
        "closeDate": null,
        "avgEntry": "50000.00",
        "avgExit": null,
        "entryFees": "0.00100000",
        "exitFees": null,
        "positionBalance": "0.05000000",
        "initialMargin": "0.05000000",
        "maintenanceMargin": "0.00500000",
        "liquidationPrice": "45000.00",
        "leverage": "10.0",
        "unrealizedPnl": "0.00100000",
        "realizedPnl": "0.00200000",
        "markPrice": "52500.00",
        "status": "normal",
        "updatedAt": 1640995200000000000,
        "createdAt": 1640995200000000000
      }
    ]
  }
  ```
</ResponseExample>

<ResponseField name="data[]" type="object">
  Position fields

  <Expandable title="Position properties">
    <ResponseField name="id" type="string">Position identifier</ResponseField>
    <ResponseField name="symbol" type="string">Instrument symbol</ResponseField>
    <ResponseField name="accountId" type="string">Account identifier (UUID)</ResponseField>
    <ResponseField name="side" type="string">`long` or `short`</ResponseField>
    <ResponseField name="entryAmount" type="string">Total entry amount (BTC)</ResponseField>
    <ResponseField name="exitAmount" type="string">Total exit amount (BTC)</ResponseField>
    <ResponseField name="size" type="string">Current position size (BTC)</ResponseField>
    <ResponseField name="tradeMode" type="string">e.g. `isolated`</ResponseField>
    <ResponseField name="openDate" type="integer">Open time in ms</ResponseField>
    <ResponseField name="closeDate" type="integer?">Close time in ms, if closed</ResponseField>
    <ResponseField name="avgEntry" type="string">Average entry price</ResponseField>
    <ResponseField name="avgExit" type="string?">Average exit price (if any)</ResponseField>
    <ResponseField name="entryFees" type="string">Entry fees (BTC)</ResponseField>
    <ResponseField name="exitFees" type="string?">Exit fees (BTC)</ResponseField>
    <ResponseField name="positionBalance" type="string">Position margin balance (BTC)</ResponseField>
    <ResponseField name="initialMargin" type="string">Initial margin (BTC)</ResponseField>
    <ResponseField name="maintenanceMargin" type="string">Maintenance margin (BTC)</ResponseField>
    <ResponseField name="liquidationPrice" type="string">Liquidation price</ResponseField>
    <ResponseField name="leverage" type="string">Leverage</ResponseField>
    <ResponseField name="unrealizedPnl" type="string">Unrealized PnL (BTC)</ResponseField>
    <ResponseField name="realizedPnl" type="string">Realized PnL (BTC)</ResponseField>
    <ResponseField name="markPrice" type="string">Mark price</ResponseField>
    <ResponseField name="status" type="string">`normal`, `liquidation`, or `adl`</ResponseField>
    <ResponseField name="updatedAt" type="integer">Update time in ns</ResponseField>
    <ResponseField name="createdAt" type="integer">Creation time in ns</ResponseField>
  </Expandable>
</ResponseField>
