WebSocket

WebSocket API Overview

Real-time streaming market data via persistent WebSocket connections.

The WebSocket API delivers real-time market data over persistent WebSocket connections. Orderbook channels are served from book endpoints, while every other live feed uses nonbook endpoints.

When to use WebSocket vs REST

REST APIWebSocket API
Best forHistorical queries, one-off lookupsReal-time dashboards, trading bots, live feeds
Data deliveryRequest-responseServer pushes updates as they occur
ConnectionNew HTTP request per queryJSON WebSocket connection(s) by endpoint family
LatencyHigher (per-request overhead)Lower (no connection overhead per message)

Available channels

ChannelDescriptionKey parameters
TRADEIndividual trades--
TRADE_AGGAggregated trades (OHLCV batches)batchInterval
BLOCK_BOOK_SNAPSHOTOrderbook depth snapshotsblockSize, maxDepth, updateFrequency
LIQUIDATIONIndividual liquidation events--
FUNDING_RATEFunding rate updates--
OPEN_INTERESTOpen interest updates--
VOLUME_PROFILE_AGGReal-time volume profilegroupByType

Endpoint selection

Choose the endpoint family that matches the channels you want:

Endpoint familyChannelsSingaporeEurope
bookBLOCK_BOOK_SNAPSHOTwss://ap-sin3.ws.api.kiyotaka.ai/wswss://eu-de3.ws.api.kiyotaka.ai/ws
nonbookTRADE, TRADE_AGG, LIQUIDATION, FUNDING_RATE, OPEN_INTEREST, VOLUME_PROFILE_AGGwss://ap-sin3.ws.api.kiyotaka.ai/nonbook/wswss://eu-de3.ws.api.kiyotaka.ai/nonbook/ws

Pick the region closest to your deployment. Add ?encoding=json to the endpoint you use. If you consume both orderbook and non-orderbook data, keep one connection to each endpoint family.

Quick example

Connect, authenticate, subscribe, and receive non-orderbook data:

Connect
wss://ap-sin3.ws.api.kiyotaka.ai/nonbook/ws?encoding=json
Authenticate
{
  "method": "public/authenticate",
  "params": {
    "token": "YOUR_API_KEY"
  }
}
Subscribe
{
  "jsonrpc": "2.0",
  "id": 0,
  "method": "public/subscribe",
  "params": {
    "channels": [
      {
        "type": "TRADE",
        "exchange": "BINANCE_FUTURES",
        "symbol": "BTCUSDT",
        "category": "*"
      }
    ],
    "compression": "brotli",
    "version": "v2"
  }
}
Receive
{
  "points": [
    {
      "series": {
        "type": "TRADE",
        "symbol": "BTCUSDT",
        "exchange": "BINANCE_FUTURES",
        "normalizedSymbol": "BTC-USDT",
        "category": "PERPETUAL",
        "side": "BUY",
        "coin": "BTC"
      },
      "trade": {
        "id": "7126482260",
        "price": 90003,
        "amount": 0.002,
        "timestamp": {
          "seconds": 1769058875,
          "nanoseconds": 830000000
        }
      }
    }
  ]
}