Skip to content
LogoLogo

clearinghouseState

Endpoint

WebSocket /ws

Selector: subscription.type: "clearinghouseState"

Purpose

Streams the selected customer's private account state and perpetual positions. It reflects the customer's allocation inside Hyperjutsu, not the pooled venue account's aggregate exposure.

Authorization

Owner or approved reader for subscription.user. The SDK signs requests. Current permissions are checked before delivery; expiry or revocation stops access.

Request fields

FieldTypeRequiredMeaning
methodStringYes"subscribe".
authObjectYesRequest proof with timestamp, nonce and signature; see authorization.
subscriptionObjectYesSubscription definition.
subscription.typeStringYes"clearinghouseState".
subscription.userAddressYesCustomer account authorized by the request signer.
subscription.dexStringNoOmit or use "" for the default DEX. Other values are unsupported.

Request example

Test fixture. Generate a fresh proof before use. Fixture inputs.

{
  "method": "subscribe",
  "subscription": {
    "type": "clearinghouseState",
    "user": "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf"
  },
  "auth": {
    "timestamp": 1796250000000,
    "nonce": "0x0202020202020202020202020202020202020202020202020202020202020202",
    "signature": "0x9d3926e264f33056c287d31b1378daf634671f3c6388660725f802ccff09dbc30a3c4702271559a6a9df3a0f3025a81bee7b279883aa74c4b8d483d5ee503be41c"
  }
}

Response fields

First receive a subscribe acknowledgement, then data:

FieldMeaning
channel"clearinghouseState".
dataCustomer account-state message.
data.dex"" for the default DEX.
data.userSelected customer account address.
data.clearinghouseStateAccount-state object with the same logical shape as the corresponding /info query.
data.clearinghouseState.assetPositionsCustomer position entries, including account-specific leverage, PnL and funding fields.
data.clearinghouseState.crossMaintenanceMarginUsedCross-maintenance margin used, as a decimal string.
data.clearinghouseState.crossMarginSummaryCross-margin summary, including decimal-string account value, margin used, notional position value and raw USD balance.
data.clearinghouseState.marginSummaryMargin summary with the same summary fields.
data.clearinghouseState.timeAccount-state time in Unix milliseconds.
data.clearinghouseState.withdrawableWithdrawable amount as a decimal string.

Response example

Illustrative data message:

{
  "channel": "clearinghouseState",
  "data": {
    "dex": "",
    "user": "0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf",
    "clearinghouseState": {
      "assetPositions": [],
      "crossMaintenanceMarginUsed": "0",
      "crossMarginSummary": {
        "accountValue": "1000",
        "totalMarginUsed": "0",
        "totalNtlPos": "0",
        "totalRawUsd": "1000"
      },
      "marginSummary": {
        "accountValue": "1000",
        "totalMarginUsed": "0",
        "totalNtlPos": "0",
        "totalRawUsd": "1000"
      },
      "time": 1796000000000,
      "withdrawable": "1000"
    }
  }
}

Constraints

  • The initial state is followed by changed states. A timestamp-only change does not produce a new message.
  • Monetary and position quantities use decimal strings. Unverified cross-margin liquidation prices remain null; they are not replaced with guessed estimates.
  • Duplicate requests acknowledge the existing subscription without another snapshot.

unsubscribe stops this subscription. WebSocket overview covers connection limits and reconnect behavior.