Cascade
Account

Subscribe Position

Primary WebSocket channel for all market data and order management.

Subscribe to position updates for an account (requires authentication, supports delegation)#

Primary WebSocket channel for all market data and order management.

Channel:WEBSOCKET
Tag:
Account

Request to subscribe to position updates (requires authentication)

Parameters

sourcestring

Must be 'position'

accountstring

Ethereum address of the account (must match authenticated user or user must be a delegate)

subaccountIndicesarray

Array of subaccount indices. - Empty array []: Subscribes to ALL subaccounts (owner only - delegation not allowed) - Non-empty array: Subscribes to the specified subaccounts (delegation allowed) For delegated access, delegation is checked for ALL specified subaccounts. Subscription fails if user lacks delegation for any subaccount in the array.

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "position",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78",
    "subaccountIndices": []
  },
  "id": 5
}

Generic success response for subscription requests

Parameters

message?string

Success message

Payload
{
  "jsonrpc": "2.0",
  "result": {
    "message": "Subscribed to trades"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}

Published each time a position is created or updated for the subscribed account. Wrapped with type field to identify the message type.

Parameters

accountstring

Ethereum address of the account

subaccountIndexinteger

Subaccount index

symbolstring

Market symbol for this position

quantitystring

Signed decimal string - positive for long, negative for short

basisstring

Signed notional cost basis as decimal string

feesstring

Accumulated trade fees as unsigned decimal string

fundingstring

Accumulated funding fees as signed decimal string

marginstring

Collateral amount reserved for this position as unsigned decimal string

upnlstring

Unrealized profit and loss for this position as signed decimal string

updatedAtinteger

Timestamp when position was last updated in milliseconds

Payload
{
  "type": "Position",
  "data": {
    "account": "0xc2cbbb5bea8fdefb1f441feaf017a0df72e89c9f",
    "subaccountIndex": 0,
    "symbol": "ETH-USD-PERP",
    "quantity": "1.5",
    "basis": "3720.226",
    "fees": "1.323667",
    "funding": "87.382478",
    "margin": "558.621108",
    "upnl": "125.50",
    "updatedAt": 1752846925000
  }
}

Error response for failed requests

Parameters

jsonrpcstring

JSON-RPC version

errorobject
usIninteger

Request received timestamp in milliseconds

usOutinteger

Response sent timestamp in milliseconds

usDiffinteger

Processing time in milliseconds

id?string | integer | null

Request identifier (if provided in request, otherwise null)

Payload
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid subscription params"
  },
  "usIn": 1234567890123,
  "usOut": 1234567890456,
  "usDiff": 333,
  "id": 2
}