WebSocket API
Real-time consolidated order book data across 20 exchanges via a single WebSocket connection.
Quick Start
Connect and get live BTC-USDT order book data in three lines:
const ws = new WebSocket("wss://api.microversesystems.com");
ws.onopen = () => ws.send('{"op":"subscribe","channel":"fullbook:BTC-USDT","depth":20}');
ws.onmessage = (e) => console.log(JSON.parse(e.data));
You'll receive a subscribed ack followed by continuous snapshot updates with the consolidated order book from all exchanges.
Connection
Connect via WebSocket to the API endpoint:
| Environment | Endpoint |
|---|---|
| Production | wss://api.microversesystems.com |
| Local dev | ws://localhost:8081 |
No authentication is required. The server sends a snapshot immediately after each successful subscription, then pushes updates at ~100ms intervals when the book changes.
subscribe
Subscribe to a market data channel. The server responds with a subscribed ack and an initial snapshot.
{
"op": "subscribe",
"channel": "fullbook:BTC-USDT",
"depth": 20,
"mode": "inc"
}
Parameters
Channel examples
| Channel | Description |
|---|---|
| top:BTC-USDT | BBO — best bid/offer, 1 level, aggregated across exchanges |
| consbook:ETH-USDT | Consolidated book — multi-level aggregated, no exchange attribution |
| fullbook:BTC-USDT | Full book — all exchanges, with exchange attribution |
| binance:BTC-USDT | Single exchange book — Binance only |
unsubscribe
Unsubscribe from a channel. Server responds with an unsubscribed ack.
{
"op": "unsubscribe",
"channel": "fullbook:BTC-USDT"
}
ping
Keepalive. Server responds with pong.
{ "op": "ping" }
exchanges
Request the list of available exchanges with live symbol counts.
{ "op": "exchanges" }
symbols
Request available symbols. Optionally filter by quote asset or exchange.
{
"op": "symbols",
"quote": "USDT",
"exchange": "binance"
}
snapshot
Book data pushed after subscribe and on each update. Format varies by channel type.
Full book fullbook:
Each level includes exchange attribution: [price, qty, orders, exchange_id]
{
"type": "snapshot",
"channel": "fullbook:BTC-USDT",
"data": {
"bids": [
[45000.50, 1.234, 5, "binance"],
[45000.25, 2.456, 3, "okx"],
[45000.10, 0.789, 2, "coinbase"]
],
"asks": [
[45001.00, 0.789, 2, "binance"],
[45001.50, 3.456, 7, "okx"]
],
"ts": 1711100000000
}
}
BBO top-of-book top:
Best bid/offer aggregated across all exchanges. Always 1 level per side: [price, qty, orders]
{
"type": "snapshot",
"channel": "top:BTC-USDT",
"data": {
"bids": [[45000.50, 4.234, 9]],
"asks": [[45001.00, 4.245, 9]],
"ts": 1711100000000
}
}
Consolidated book consbook:
Multi-level aggregated across exchanges at the same price. No exchange attribution: [price, qty, orders]
{
"type": "snapshot",
"channel": "consbook:BTC-USDT",
"data": {
"bids": [
[45000.50, 4.234, 9],
[45000.10, 0.789, 2]
],
"asks": [
[45001.00, 4.245, 9],
[45001.50, 3.456, 7]
],
"ts": 1711100000000
}
}
Single exchange {exchange}:
Book from one exchange only. No exchange attribution: [price, qty, orders]
{
"type": "snapshot",
"channel": "binance:BTC-USDT",
"data": {
"bids": [[45000.50, 1.234, 5]],
"asks": [[45001.00, 0.789, 2]],
"ts": 1711100000000
}
}
Level fields
| Index | Field | Type | Description |
|---|---|---|---|
| 0 | price | float | Price level |
| 1 | qty | float | Total quantity at this level |
| 2 | orders | integer | Number of orders at this level |
| 3 | exchange_id | string | Exchange ID (fullbook: only) |
Bids are sorted descending by price. Asks are sorted ascending. Timestamp ts is milliseconds since epoch.
delta
When subscribed with "mode":"inc", the first message is a full snapshot. Subsequent messages are delta updates containing only levels that changed. No message is sent when nothing changes.
{
"type": "delta",
"channel": "consbook:BTC-USDT",
"data": {
"bids": [
[45000.50, 1.200, 3],
[44998.00, 0, 0]
],
"asks": [
[45001.00, 0.500, 1]
],
"ts": 1711100000100
}
}
A level with qty = 0 means the level was removed. Apply deltas on top of the last snapshot to maintain the current book state.
subscribed / unsubscribed
Acknowledgment messages confirming subscription changes.
{ "type": "subscribed", "channel": "fullbook:BTC-USDT" }
{ "type": "unsubscribed", "channel": "fullbook:BTC-USDT" }
exchanges response
{
"type": "exchanges",
"data": [
{
"id": "binance",
"name": "Binance",
"quote": "USDT",
"symbols": 145,
"status": "live"
}
]
}
| Field | Type | Description |
|---|---|---|
| id | string | Exchange identifier (lowercase) |
| name | string | Display name |
| quote | string | Default quote asset |
| symbols | integer | Count of live symbols |
| status | string | live or down |
symbols response
{
"type": "symbols",
"data": [
{
"symbol": "BTC-USDT",
"exchanges": ["binance", "coinbase", "okx"]
}
]
}
| Field | Type | Description |
|---|---|---|
| symbol | string | Canonical symbol (BASE-QUOTE, uppercase) |
| exchanges | string[] | Exchange IDs carrying this symbol |
pong
{ "type": "pong" }
error
{ "type": "error", "msg": "missing channel" }
Possible error messages:
| Message | Cause |
|---|---|
| missing op | No op field in message |
| unknown op | Unrecognized operation |
| missing channel | Subscribe/unsubscribe without channel |
| unknown channel | Invalid channel format |
| unknown symbol | Symbol not found in any exchange |
| unknown exchange | Exchange ID not recognized |
| already subscribed | Duplicate subscription |
Channel Types
| Prefix | Example | Description | Level Format |
|---|---|---|---|
| top: | top:BTC-USDT | BBO — best bid/offer, 1 level, aggregated across exchanges | [price, qty, orders] |
| consbook: | consbook:ETH-USDT | Consolidated book — multi-level aggregated, no attribution | [price, qty, orders] |
| fullbook: | fullbook:BTC-USDT | Full book from all exchanges with attribution | [price, qty, orders, exchange_id] |
| {exchange}: | binance:BTC-USDT | Single exchange book | [price, qty, orders] |
Symbols use canonical format BASE-QUOTE (uppercase, hyphen-separated). Example: BTC-USDT, ETH-USD, SOL-USDT.
Exchanges
21 exchanges are supported. Use the exchange id as the channel prefix for single-exchange subscriptions.
| # | ID | Name | Quote |
|---|---|---|---|
| 0 | binance | Binance | USDT |
| 1 | coinbase | Coinbase | USD |
| 2 | okx | OKX | USDT |
| 3 | bybit | Bybit | USDT |
| 4 | kraken | Kraken | USDT |
| 5 | gemini | Gemini | USD |
| 6 | cryptocom | Crypto.com | USDT |
| 7 | gateio | Gate.io | USDT |
| 8 | kucoin | KuCoin | USDT |
| 9 | upbit | Upbit | USDT |
| 10 | bitget | Bitget | USDT |
| 11 | mexc | MEXC | USDT |
| 12 | htx | HTX | USDT |
| 13 | bitfinex | Bitfinex | USD |
| 14 | bingx | BingX | USDT |
| 15 | phemex | Phemex | USDT |
| 16 | lbank | LBank | USDT |
| 17 | bitmart | BitMart | USDT |
| 18 | coinex | CoinEx | USDT |
| 19 | ascendex | AscendEX | USDT |
| 20 | deribit | Deribit | USD |
Try It
Connect to the API and send commands interactively.