Orderbook
Real-time orderbook stream (bids / asks). Subscribe to {symbol}@{exchange} pairs on either the spot or futures market and receive full orderbook snapshots — no client-side delta merging required.
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
methodselects the request type (SUBSCRIBEorPING).paramsis a list of pair specifiers. The format is{base}-{quote}@{exchange}@{currency}@{conversionBase}(e.g."BTC-KRW@upbit@USD@USDT"). Same shape as ticker — the last two segments are optional and default toUSD/USDT.- Supported exchanges: see /api/v1/ticker/exchanges. Supported symbols: see /api/v1/ticker/symbols.
- Supported currencies:
USD,KRW - Supported conversion bases:
USDT,USD
iduniquely identifies the subscribe request and is echoed 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 subscription. The ack returns only those that passed validation. Broadcast bid / ask prices are converted from the pair's native quote currency into the requested currency.
Response
Each update is a full orderbook snapshot for a single pair. protojson-encoded — keys use 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 (ms, UTC) |
s | Symbol — exchange-native API symbol (matches the subscription key) |
b | Base — base asset (e.g. BTC) |
q | Quote — quote currency (replaced with the requested currency after conversion) |
as | Asks — ask-side levels |
bs | Bids — bid-side levels |
pa | ProcessedAt — server processing time (ms, UTC) |
ms | MarginSupported — whether the symbol supports margin trading |
Each level has two fields:
| Field | Description |
|---|---|
p | price |
v | volume |
Example
{
"id": "bitcoin",
"m": "spot",
"e": "bybit",
"d": 1776825400123,
"s": "BTC-USDT",
"b": "BTC",
"q": "USD",
"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 refresh the session on the server.
Pricing
Each subscribe request is billed 1 credit regardless of how many pairs are in params. The connection itself is free.