Orderbook
Real-time orderbook (bids/asks) stream. Subscribe to any {symbol}@{exchange}
pair on either the spot or the futures market. Each update is a full orderbook
snapshot so clients do not need to merge deltas.
Connect
- websocat
- wscat
# spot market
websocat wss://api.datamaxiplus.com/ws/v1/orderbook/spot -H 'X-DTMX-APIKEY: $YOUR_API_KEY'
# futures market
websocat wss://api.datamaxiplus.com/ws/v1/orderbook/futures -H 'X-DTMX-APIKEY: $YOUR_API_KEY'
# spot market
wscat -c wss://api.datamaxiplus.com/ws/v1/orderbook/spot -H 'X-DTMX-APIKEY: $YOUR_API_KEY'
# futures market
wscat -c wss://api.datamaxiplus.com/ws/v1/orderbook/futures -H 'X-DTMX-APIKEY: $YOUR_API_KEY'
Subscribe
methodspecifies the type of request (SUBSCRIBEorPING).paramsis a list of{base}-{quote}@{exchange}@{currency}@{conversionBase}entries (e.g."BTC-KRW@upbit@USD@USDT"). Ticker-style — the last two segments are optional (default toUSDandUSDT).- You can look up supported exchanges via /api/v1/ticker/exchanges and symbols via /api/v1/ticker/symbols.
- Supported currency:
USD,KRW - Supported conversion base:
USDT,USD
iduniquely identifies the subscription request and is echoed back in the ack.
- schema
- example
{
"method": "SUBSCRIBE",
"params": [
string
],
"id": int32
}
{
"method": "SUBSCRIBE",
"params": [
"BTC-KRW@upbit@USD@USDT",
"ETH-USDT@bybit@USD@USDT"
],
"id": 1
}
Invalid pairs are silently dropped from the accepted subscription list.
The ack response echoes back only the pairs that passed validation. Each
bid/ask price in the broadcast is converted from the pair's native
quote to the requested currency.
Response
Each update is a full orderbook snapshot for a single pair. Fields are protojson-encoded — keys match the short JSON names from the protobuf schema.
| Field (JSON key) | Description |
|---|---|
id | TokenId — Internal unified token id |
m | Market — spot or futures |
e | Exchange — Exchange identifier (e.g. bybit, okx) |
d | Timestamp — Exchange-reported snapshot time in ms (UTC) |
s | Symbol — Exchange-native API symbol (matches the subscribe key) |
b | Base — Base asset (e.g. BTC) |
q | Quote — Quote asset (e.g. USDT) |
as | Asks — Array of ask levels (see below) |
bs | Bids — Array of bid levels |
pa | ProcessedAt — Server-side processed time in ms (UTC) |
ms | MarginSupported — Whether margin trading is supported for this symbol |
Each ask/bid level has two fields:
| Field | Description |
|---|---|
p | Price |
v | Volume |
Example
{
"id": "bitcoin",
"m": "spot",
"e": "bybit",
"d": 1776825400123,
"s": "BTCUSDT",
"b": "BTC",
"q": "USDT",
"as": [
{ "p": "76145.2", "v": "0.0438" },
{ "p": "76145.3", "v": "0.1250" }
],
"bs": [
{ "p": "76145.1", "v": "0.0219" },
{ "p": "76145.0", "v": "0.5000" }
],
"pa": 1776825400180,
"ms": false
}
Ping / Keepalive
Send {"method":"PING"} periodically to keep the connection alive. The
server extends the life of the connection on each ping.
Pricing
Each successful subscribe request costs 1 credit, regardless of how many
pairs are in params. Connection itself is free.