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 API | WebSocket API | |
|---|---|---|
| Best for | Historical queries, one-off lookups | Real-time dashboards, trading bots, live feeds |
| Data delivery | Request-response | Server pushes updates as they occur |
| Connection | New HTTP request per query | JSON WebSocket connection(s) by endpoint family |
| Latency | Higher (per-request overhead) | Lower (no connection overhead per message) |
Available channels
| Channel | Description | Key parameters |
|---|---|---|
TRADE | Individual trades | -- |
TRADE_AGG | Aggregated trades (OHLCV batches) | batchInterval |
BLOCK_BOOK_SNAPSHOT | Orderbook depth snapshots | blockSize, maxDepth, updateFrequency |
LIQUIDATION | Individual liquidation events | -- |
FUNDING_RATE | Funding rate updates | -- |
OPEN_INTEREST | Open interest updates | -- |
VOLUME_PROFILE_AGG | Real-time volume profile | groupByType |
Endpoint selection
Choose the endpoint family that matches the channels you want:
| Endpoint family | Channels | Singapore | Europe |
|---|---|---|---|
book | BLOCK_BOOK_SNAPSHOT | wss://ap-sin3.ws.api.kiyotaka.ai/ws | wss://eu-de3.ws.api.kiyotaka.ai/ws |
nonbook | TRADE, TRADE_AGG, LIQUIDATION, FUNDING_RATE, OPEN_INTEREST, VOLUME_PROFILE_AGG | wss://ap-sin3.ws.api.kiyotaka.ai/nonbook/ws | wss://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
}
}
}
]
}