Skip to main content

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

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

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
idTokenId — Internal unified token id
mMarketspot or futures
eExchange — Exchange identifier (e.g. bybit, okx)
dTimestamp — Exchange-reported snapshot time in ms (UTC)
sSymbol — Exchange-native API symbol (matches the subscribe key)
bBase — Base asset (e.g. BTC)
qQuote — Quote asset (e.g. USDT)
asAsks — Array of ask levels (see below)
bsBids — Array of bid levels
paProcessedAt — Server-side processed time in ms (UTC)
msMarginSupported — Whether margin trading is supported for this symbol

Each ask/bid level has two fields:

FieldDescription
pPrice
vVolume

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.