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
| Field | Type | Required | Description |
|---|---|---|---|
instrumentId | string | No* | Instrument ID (e.g., "BINANCE:BTC/USDT") |
venue | string | No* | Venue (alternative to instrumentId) |
symbol | string | No* | Symbol (alternative to instrumentId) |
depth | integer | No | Number of price levels (default: 20) |
*Either instrumentId OR (venue + symbol) is required.
Result
Order Book Object
| Field | Type | Description |
|---|---|---|
instrumentId | string | Instrument identifier |
venue | string | Exchange venue |
symbol | string | Trading symbol |
bids | array | Bid orders (sorted by price descending) |
asks | array | Ask orders (sorted by price ascending) |
timestamp | string | Snapshot timestamp (ISO 8601) |
Order Book Level
| Field | Type | Description |
|---|---|---|
price | string | Price level |
quantity | string | Available 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"
}