Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

clearinghouseState

ChannelclearinghouseStateserver → client · type clearinghouseState

Keep the Positions panel and margin summary live.

Subscribe
{
  "method": "subscribe",
  "type": "clearinghouseState",
  "subscription": {
    "type": "clearinghouseState",
    "user": "0x0000000000000000000000000000000000000000",
    "dex": "txflow"
  }
}
Try it
WS wss://rpc.txflow-testnet.xyz/ws
Subscription parameters
typestringrequired
"clearinghouseState"
userEthAddressrequired

User to follow. Use the account address, not an agent's.

dexstringnullableoptional

Optional perp dex name. Defaults to the first dex.

exchangeIdExchangeScopeoptional

Filter by an instrument's configured exchange_id. Same three-state semantics as the HTTP /info ExchangeScope: missing, null, or 0 -> Default (only instruments with no configured exchange_id); the string "all" (case-insensitive) -> All (no filter, every exchange); a positive integer n -> Exchange(n) (only that exchange_id).

oneOf · variant 1
null
oneOf · variant 2
integer
oneOf · variant 3
string
Server message
channelstring
"clearinghouseState"
dataWsClearinghouseState

Aggregate margin and position state for one user.

accountValuePlusWithdrawHoldDecimalString

accountValue + withdrawHold.

assetPositionsWsAssetPosition[]
crossMaintenanceMarginUsedDecimalString

Cross-margin maintenance margin requirement.

crossMarginRatioDecimalString

Cross margin ratio = (balance + crossUnrealizedPnl) / (crossMaintenanceMargin + crossLiquidationFee). Higher is safer; liquidation triggers at <= 1.0.

crossMarginSummaryWsMarginSummary
marginSummaryWsMarginSummary
totalRawUsdPlusWithdrawHoldDecimalString

totalRawUsd + withdrawHold.

userEthAddress

Ethereum-style account or token address, 0x-prefixed, 40 hex characters.

vaultEquityDecimalString

User's total equity across all vaults.

withdrawableDecimalString

Amount currently withdrawable.

activeReverseJobsobject[]

In-flight reverse-position jobs for this user. Omitted when empty.

Message example
{
  "channel": "clearinghouseState",
  "data": {
    "user": "0x0000000000000000000000000000000000000000",
    "marginSummary": {
      "accountValue": "",
      "totalMarginUsed": "",
      "totalNtlPos": "",
      "totalRawUsd": ""
    },
    "crossMarginSummary": {
      "accountValue": "",
      "totalMarginUsed": "",
      "totalNtlPos": "",
      "totalRawUsd": ""
    },
    "crossMaintenanceMarginUsed": "",
    "crossMarginRatio": "",
    "withdrawable": "",
    "totalRawUsdPlusWithdrawHold": "",
    "accountValuePlusWithdrawHold": "",
    "vaultEquity": "",
    "assetPositions": [
      {
        "type": "oneWay",
        "position": {
          "coin": "4",
          "asset": "4",
          "szi": "",
          "leverage": {
            "type": "Cross",
            "value": 0,
            "rawUsd": ""
          },
          "entryPx": "0",
          "positionValue": "",
          "unrealizedPnl": "",
          "returnOnEquity": "",
          "liquidationPx": "0",
          "marginUsed": "",
          "maxLeverage": 0,
          "cumFunding": {
            "allTime": "",
            "sinceOpen": "",
            "sinceChange": ""
          },
          "marginRatio": "",
          "adlQuantile": 0,
          "markPx": "0"
        },
        "tpsl": [
          {}
        ]
      }
    ],
    "activeReverseJobs": [
      {}
    ]
  }
}