Skip to main content

Subscribe

Request Body

ParameterTypeDescription
method*stringMust be "subscribe"
subscription*objectSee below
subscription.type*stringMust be "accountSummary"
subscription.user*stringYour wallet address (lowercase), e.g., "0x742d35cc6634c0532925a3b844bc9e7595f0beb"

Response

Subscription Confirmation:
{
  "channel": "subscriptionResponse",
  "data": {
    "method": "subscribe",
    "subscription": {
      "type": "accountSummary",
      "user": "0x742d35cc6634c0532925a3b844bc9e7595f0beb"
    }
  }
}
Initial Snapshot:
{
  "channel": "accountSummary",
  "data": {
    "user": "0x742d35cc6634c0532925a3b844bc9e7595f0beb",
    "summary": {
      "accountValue": 10000.00,
      "totalMarginUsed": 1000.00,
      "availableMargin": 9000.00,
      "crossMaintenanceMargin": 500.00,
      "withdrawable": 9000.00,
      "assets": [
        {
          "coin": "USDC",
          "total": 10000.00,
          "available": 9000.00
        }
      ],
      "positions": {
        "BTC": {
          "coin": "BTC",
          "szi": "0.1",
          "entryPx": "50000.00",
          "positionValue": "5000.00",
          "unrealizedPnl": "50.00",
          "marginUsed": "1000.00",
          "leverage": "5",
          "liqPx": "45000.00",
          "returnOnEquity": "0.05"
        }
      }
    }
  }
}

Summary Fields

Account Level

FieldTypeDescription
accountValuenumberTotal account value in USDC
totalMarginUsednumberMargin allocated to positions
availableMarginnumberFree margin for new positions
crossMaintenanceMarginnumberMaintenance margin required
withdrawablenumberAmount available for withdrawal

Assets

FieldTypeDescription
coinstringAsset symbol (USDC, USDT, etc.)
totalnumberTotal balance
availablenumberAvailable for trading/withdrawal

Positions

FieldTypeDescription
coinstringAsset symbol (BTC, ETH, etc.)
szistringPosition size (+ long, - short)
entryPxstringAverage entry price
positionValuestringNotional value
unrealizedPnlstringCurrent unrealized PnL
marginUsedstringMargin allocated
leveragestringCurrent leverage
liqPxstringEstimated liquidation price
returnOnEquitystringROE as decimal

Unsubscribe

{
  "method": "unsubscribe",
  "subscription": {
    "type": "accountSummary",
    "user": "0x742d35cc6634c0532925a3b844bc9e7595f0beb"
  }
}

Notes

  • Initial snapshot sent immediately after subscription
  • Updates sent only when account state changes
  • User address must be lowercase
  • All numeric values are numbers (not strings)