Cascade
Account

Subscribe Position

Primary WebSocket channel for all market data and order management.

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

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)

Payload
{
  "jsonrpc": "2.0",
  "method": "subscribe",
  "params": {
    "source": "position",
    "account": "0xe1c03ec3bcf509b3e8e63abcd03edc661ffe6a78"
  },
  "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

subaccountIndexstring

Subaccount index as string

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

updatedAtinteger

Timestamp when position was last updated in milliseconds

Payload
{
  "type": "Position",
  "data": {
    "account": "0xc2cbbb5bea8fdefb1f441feaf017a0df72e89c9f",
    "subaccountIndex": "0",
    "symbol": "ETHUSD",
    "quantity": "1.5",
    "basis": "3720.226",
    "fees": "1.323667",
    "funding": "87.382478",
    "margin": "558.621108",
    "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
}