Skip to main content

query.orderbook.get

Get order book for an instrument.

Method

query.orderbook.get

Description

Returns the current order book (bids and asks) for a specific trading instrument. Optionally specify depth to limit the number of price levels returned.

Parameters

FieldTypeRequiredDescription
instrumentIdstringNo*Instrument ID (e.g., "BINANCE:BTC/USDT")
venuestringNo*Venue (alternative to instrumentId)
symbolstringNo*Symbol (alternative to instrumentId)
depthintegerNoNumber of price levels (default: 20)

*Either instrumentId OR (venue + symbol) is required.

Result

Order Book Object

FieldTypeDescription
instrumentIdstringInstrument identifier
venuestringExchange venue
symbolstringTrading symbol
bidsarrayBid orders (sorted by price descending)
asksarrayAsk orders (sorted by price ascending)
timestampstringSnapshot timestamp (ISO 8601)

Order Book Level

FieldTypeDescription
pricestringPrice level
quantitystringAvailable quantity

Usage

# Get order book by instrument ID
result = await client.rpc("query.orderbook.get", {
"instrumentId": "BINANCE:BTC/USDT",
"depth": 10
})

# Get order book by venue and symbol
result = await client.rpc("query.orderbook.get", {
"venue": "BINANCE",
"symbol": "BTC/USDT",
"depth": 20
})

Example Response

{
"instrumentId": "BINANCE:BTC/USDT",
"venue": "BINANCE",
"symbol": "BTC/USDT",
"bids": [
{"price": "50000.00", "quantity": "1.5"},
{"price": "49999.50", "quantity": "2.3"},
{"price": "49999.00", "quantity": "0.8"}
],
"asks": [
{"price": "50000.50", "quantity": "1.2"},
{"price": "50001.00", "quantity": "3.1"},
{"price": "50001.50", "quantity": "0.5"}
],
"timestamp": "2024-01-15T10:30:00.000Z"
}