Streams

Orderbook

The orderbook channel provides real-time updates for the order book of a specified trading pair.

Request Format

Orderbook Subscription Request
{
  "method": "subscribe",
  "subscription": "orderbook",
  "args": {
    "pair": "ETH-USDC"
  }
}
Orderbook Unsubscription Request
{
  "method": "unsubscribe",
  "subscription": "orderbook",
  "args": {
    "pair": "ETH-USDC"
  }
}

Response Format

The response structure is as follows:

Orderbook Stream
{
  "s": "orderbook",
  "d": {
    "m": "ETHUSD",
    "t": 1672515782136,
    "b": [
      {
        "px": "price",
        "sz": "size",
        "n": "number of orders"
      }
    ],
    "a": [
      {
        "px": "price",
        "sz": "size",
        "n": "number of orders"
      }
    ]
  }
}
  • s: Stream type (always “orderbook” for this endpoint)
  • d: Data object
    • m: Market pair (e.g., “ETHUSD”)
    • t: Event time (timestamp in milliseconds)
    • b: Array of bid updates
    • a: Array of ask updates
      • px: Price level
      • sz: Size at this price level
      • n: Number of orders at this price level

Trades

The trades channel provides real-time updates for trades of a specified trading pair.

Request Format

Trades Subscription Request
{
  "id: "<unique_id>",
  "method": "trades.subscribe",
  "params": {
    "market": "<address>"
  }
}
Trades Unsubscription Request
{
  "method": "trades.unsubscribe",
  "args": {
    "market": "<address>"
  }
}

Response Format

The response structure is as follows:

Trades Stream
{
  "s": "trades",
  "d": {
    "sd": "B",
    "m": "<Market Address>",
    "px": "3442.0",
    "sz": "0.0995",
    "h": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "id": 2934702386,
    "ts": 1721166232023
  }
}
  • s: Stream type (always “trade” for this endpoint)
  • d: Data object
    • sd: Side of the trade (“B” for buy, “S” for sell)
    • m: Market address
    • px: Price of the trade
    • sz: Size of the trade
    • h: Transaction hash
    • id: Trade ID
    • t: Trade time (timestamp in milliseconds)

KLine Chart

The KLine chart uses Datafeed API to return KLine candlestick data.

Request Format

Candles Subscription Request
{
  "id": "<unique_id>",
  "method": "candles.subscribe",
  "params": {
    "market": "<address>",
    "interval": "<interval>"
  }
}
Candles Unsubscription Request
{
  "method": "candles.unsubscribe",
  "params": {
    "market": "<address>",
    "interval": "<interval>"
  }
}

Response Format

The response structure is as follows:

{
  "s": "candle",
  "d": {
    "m": "<address>",
    "t": 1672515780000,
    "i": "1m",
    "o": "3442.9",
    "c": "3442.9",
    "h": "3442.9",
    "l": "3442.9",
    "v": "1.2569",
    "n": 2
  }
}
  • s: Stream type (always “candle” for this endpoint)
  • d: Data object
    • m: Market address
    • t: Candle start time (timestamp in milliseconds)
    • i: Interval (e.g., “1m” for 1 minute)
    • o: Open price
    • c: Close price
    • h: High price
    • l: Low price
    • v: Volume (base unit)
    • n: Number of trades

The supported intervals are: 1s, 30s, 1m, 3m, 5m, 15m, 30m, 1h, 4h, 6h, 8h, 12h, 1d, 1w

Error Handling

In case of an error, the following structure will be returned:

Error Response
{
  "id": "<unique_id>",
  "status": 1,
  "error": "<error_message>"
}
  • id: Unique identifier for the request
  • status: Always 1 for error messages
  • error: Description of the error