Trades

Subscribe to latest trades for the specific instruments.

Subscribe Request

{
  "id": 2,
  "method": "SUBSCRIBE",
  "params": {
    "chainId": 143,
    "type": "trades",
    "pairs": [
      "0x44b60b6af9b615a5cf2d366e2143582557cff711_4294967295",
      "0x8c5243a6a4c6c7a82d954c8ff29e0611e25ac33e_4294967295",
      "0x73ada1ea346cc3908f41cf67a040f0acd7808be0_4294967295"
    ],
    "tradesLimit": 50
  }
}

Unsubscribe Request

{
    "id": 2,
    "method": "UNSUBSCRIBE",
    "params": {
        "chainId": 143,
        "type": "trades",
        "pairs": [
            "0x44b60b6af9b615a5cf2d366e2143582557cff711_4294967295",
            "0x8c5243a6a4c6c7a82d954c8ff29e0611e25ac33e_4294967295",
            "0x73ada1ea346cc3908f41cf67a040f0acd7808be0_4294967295"
        ]
    }
}

Parameter Description

  • chainId (required): Chain ID

  • pairs (required): Instrument address (lowercase) and expiry timestamp, joined by an underscore (e.g., 0x..._4294967295).

  • type (required): Must be "trades"

  • tradesLimit (optional): Number of latest trades to return per update (default: 10, max: 100)

Data Stream Message

Trades Data Structure

  • chainId (top-level): Chain ID of the trade update

  • instrument (top-level): Instrument address corresponding to the update

  • expiry (top-level): Expiry timestamp

  • data: Latest trade of specific pair, contains:

    • id: Trade id

    • instrumentAddress: The instrument address of specific pair

    • expiry: Expiry timestamp

    • size: Trade size

    • balance: Account balance after trade

    • price: Execution price

    • tradeFee: Trade fee amount

    • protocolFee: Protocol fee amount

    • timestamp: Trade timestamp (Unix timestamp in seconds)

    • txHash: Transaction hash of the trade

    • type: Trade type (must be "Market")

    • symbol: Trading pair symbol (e.g., BTC/USDC)

    • baseToken: Base token information

      • address: Token contract address

      • symbol: Token symbol

      • decimals: Token decimals

      • image: Token image URL

      • price: Token price (USD)

    • quoteToken: Quote token information

      • address: Token contract address

      • symbol: Token symbol

      • decimals: Token decimals

      • image: Token image URL

      • price: Token price (USD)

    • typeString: Trade type string (must be "Market")

    • side: Trade side ("long" or "short")

    • event: Trade event ("trade" or "sweep")

    • fairPrice: AMM price after trade

    • markPrice: Mark price after trade

    • trader : trader address

Last updated