Skip to main content

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

# 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'

Subscribe

  • method selects the request type (SUBSCRIBE or PING).
  • params is 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 to USD / USDT.
  • id uniquely identifies the subscribe request and is echoed in the ack.
{
"method": "SUBSCRIBE",
"params": [
string
],
"id": int32
}

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
idTokenId — internal unified token id
mMarketspot or futures
eExchange — exchange identifier (e.g. bybit, okx)
dTimestamp — exchange-reported snapshot time (ms, UTC)
sSymbol — exchange-native API symbol (matches the subscription key)
bBase — base asset (e.g. BTC)
qQuote — quote currency (replaced with the requested currency after conversion)
asAsks — ask-side levels
bsBids — bid-side levels
paProcessedAt — server processing time (ms, UTC)
msMarginSupported — whether the symbol supports margin trading

Each level has two fields:

FieldDescription
pprice
vvolume

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.