For the complete documentation index, see llms.txt. This page is also available as Markdown.

User Data

Account / Order / Position State

post
/ws/subscribe/aopState

Subscribe to real-time account, order, and position state updates.

{ "method": "subscribe", "subscription": { "type": "aopState", "userAddress": "0xabc..." } }
Param
Type
Required

userAddress

string

Yes

Responses
200

Push data

application/json
channelstringOptionalExample: aopState
post/ws/subscribe/aopState
ws.send(JSON.stringify({
  method: "subscribe",
  subscription: { type: "aopState", userAddress: "0xabc..." },
}));

ws.onmessage = (event) => {
  const msg = JSON.parse(event.data);
  if (msg.channel === "aopState") {
    const { accounts, orders, positions } = msg.data.aop;
    console.log("accounts:", accounts);
    console.log("orders:", orders);
    console.log("positions:", positions);
  }
};
200

Push data

{
  "channel": "aopState",
  "data": {
    "type": "snapshot",
    "sequence": 123456,
    "timestamp": 1776920283000,
    "userAddr": "0xabc...",
    "aop": {
      "accounts": [
        {
          "userAddr": "0xabc...",
          "currency": 1,
          "balance": "10000.00",
          "availableBalance": "8500.00",
          "availableTransferBalance": "8500.00",
          "equity": "10500.00",
          "status": "NORMAL",
          "takerFeeRatio": "0.0006",
          "makerFeeRatio": "0.0001"
        }
      ],
      "orders": [
        {
          "userAddr": "0xabc...",
          "symbol": "BTCUSDC",
          "ordId": 12345,
          "clOrdId": 0,
          "ordPx": "77000.0",
          "ordQty": "0.5",
          "ordStatus": "NEW",
          "ordType": "LIMIT",
          "ordSide": "BUY",
          "timeInForce": "GTC",
          "filledQty": "0",
          "leavesQty": "0.5",
          "cumFilledValue": "0"
        }
      ],
      "positions": [
        {
          "userAddr": "0xabc...",
          "symbolCode": 1,
          "symbol": "BTCUSDC",
          "leverage": "10",
          "longSize": "0.5",
          "longEntryValue": "38750.0",
          "shortSize": "0",
          "shortEntryValue": "0",
          "posMode": "ONE_WAY",
          "posMarginMode": "CROSS",
          "assignedPosBalance": "0",
          "unrealizedPnl": "250.00",
          "cumRealizedPnl": "100.00",
          "curMarkPx": "77920.3",
          "cumTransactionFee": "5.00",
          "marginTableId": 1
        }
      ],
      "settings": [
        {
          "symbol": "BTCUSDC",
          "leverage": [
            "ONE_WAY",
            "10"
          ]
        }
      ]
    }
  }
}

Order History

post
/ws/subscribe/orderHist

Subscribe to order execution history updates.

{ "method": "subscribe", "subscription": { "type": "orderHist", "userAddress": "0xabc..." } }
Param
Type
Required

userAddress

string

Yes

Responses
200

Push data

application/json
channelstringOptionalExample: orderHist
post/ws/subscribe/orderHist
ws.send(JSON.stringify({
  method: "subscribe",
  subscription: { type: "orderHist", userAddress: "0xabc..." },
}));
200

Push data

{
  "channel": "orderHist",
  "data": {
    "type": "incremental",
    "orderHists": [
      {
        "userAddr": "0xabc...",
        "symbol": "BTCUSDC",
        "ordId": 12345,
        "execId": 67890,
        "clOrdId": 0,
        "transactionTime": 1776920283000,
        "ordType": "LIMIT",
        "ordSide": "BUY",
        "execStatus": "FILLED",
        "ordPx": "77000.0",
        "execPx": "77000.0",
        "triggerPx": "0",
        "execQty": "0.5",
        "ordQty": "0.5",
        "reduceOnly": "NONE",
        "slippagePct": "0"
      }
    ]
  }
}

User Fills

post
/ws/subscribe/userFilled

Subscribe to user trade fill events.

{ "method": "subscribe", "subscription": { "type": "userFilled", "userAddress": "0xabc..." } }
Param
Type
Required

userAddress

string

Yes

Responses
200

Push data

application/json
channelstringOptionalExample: userFilled
post/ws/subscribe/userFilled
ws.send(JSON.stringify({
  method: "subscribe",
  subscription: { type: "userFilled", userAddress: "0xabc..." },
}));
200

Push data

{
  "channel": "userFilled",
  "data": {
    "type": "incremental",
    "userFills": [
      {
        "userAddr": "0xabc...",
        "symbol": "BTCUSDC",
        "ordId": 12345,
        "execId": 67890,
        "ordSide": "BUY",
        "execStatus": "FILLED",
        "ordPx": "77000.0",
        "filledPx": "77000.0",
        "execQty": "0.5",
        "ordQty": "0.5",
        "ordType": "LIMIT",
        "openFee": "2.31",
        "closeFee": "0",
        "posLongTerm": 1,
        "posShortTerm": 0,
        "txHash": "ABC123...",
        "transactionTime": 1776920283000
      }
    ]
  }
}

Closed Position

post
/ws/subscribe/closedPosition

Subscribe to closed position events (aggregated P&L per position cycle).

{ "method": "subscribe", "subscription": { "type": "closedPosition", "userAddress": "0xabc..." } }
Param
Type
Required

userAddress

string

Yes

Responses
200

Push data

application/json
channelstringOptionalExample: closedPosition
post/ws/subscribe/closedPosition
ws.send(JSON.stringify({
  method: "subscribe",
  subscription: { type: "closedPosition", userAddress: "0xabc..." },
}));
200

Push data

{
  "channel": "closedPosition",
  "data": {
    "type": "incremental",
    "closedPositions": [
      {
        "userAddr": "0xabc...",
        "symbolCode": 1,
        "symbol": "BTCUSDC",
        "side": "LONG",
        "term": 1,
        "size": "0.5",
        "ordPx": "76000.0",
        "closePx": "77920.0",
        "closedPnl": "960.00",
        "tradingFees": "9.36",
        "fundingFees": "-2.50",
        "realisedPnl": "948.14",
        "roi": "12.50",
        "leverage": "10",
        "openTime": 1776800000000,
        "closedTime": 1776920283000
      }
    ]
  }
}

User Funding

post
/ws/subscribe/userFunding

Subscribe to user funding fee settlement events.

{ "method": "subscribe", "subscription": { "type": "userFunding", "userAddress": "0xabc..." } }
Param
Type
Required

userAddress

string

Yes

Responses
200

Push data

application/json
channelstringOptionalExample: userFunding
post/ws/subscribe/userFunding
ws.send(JSON.stringify({
  method: "subscribe",
  subscription: { type: "userFunding", userAddress: "0xabc..." },
}));
200

Push data

{
  "channel": "userFunding",
  "data": {
    "type": "incremental",
    "funding": [
      {
        "userAddr": "0xabc...",
        "symbol": "BTCUSDC",
        "posSize": "0.5",
        "posSide": "LONG",
        "fundingRate": "0.0001",
        "fundingFee": "-3.896",
        "transactionTime": 1776920283000
      }
    ]
  }
}

User Events

post
/ws/subscribe/userEvent

Subscribe to general user events (order acks, agent approvals, vault deposits/withdrawals).

{ "method": "subscribe", "subscription": { "type": "userEvent", "userAddress": "0xabc..." } }
Param
Type
Required

userAddress

string

Yes

Event types: perpOrder, approveAgent, actionAck, vaultDeposit, vaultWithdraw

Responses
200

Push data

application/json
channelstringOptionalExample: userEvent
post/ws/subscribe/userEvent
ws.send(JSON.stringify({
  method: "subscribe",
  subscription: { type: "userEvent", userAddress: "0xabc..." },
}));
200

Push data

{
  "channel": "userEvent",
  "data": {
    "userAddr": "0xabc...",
    "sequence": 123456,
    "timestamp": 1776920283000,
    "events": [
      {
        "eventType": "perpOrder",
        "event": [
          {
            "ordId": 12345,
            "clOrdId": 0,
            "symbol": "BTCUSDC",
            "ordSide": "BUY",
            "execStatus": "NEW",
            "ordPx": "77000.0",
            "execQty": "0",
            "leavesQty": "0.5"
          }
        ]
      }
    ]
  }
}

Last updated