Order Book
Returns a live order book snapshot — bids and asks for a symbol.
| Method | GET |
| Path | /v5/market/orderbook |
| Auth | Authenticated. |
For real-time updates without polling, use the Depth WebSocket.
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
category | string | Yes | linear. |
symbol | string | Yes | Symbol (e.g. BTCUSDT). |
limit | integer | No | Number of levels per side. |
Request
- Python
- Java
- Go
- Node.js
from reference_client import sign_request, BASE_URL
import requests
headers, path = sign_request(
"GET",
"/v5/market/orderbook",
{"category": "linear", "symbol": "BTCUSDT", "limit": 10},
)
r = requests.get(BASE_URL + path, headers=headers)
print(r.json())
HttpResponse<String> resp = client.send(
"GET", "/v5/market/orderbook", Map.of("category", "linear", "symbol", "BTCUSDT", "limit", "10"), null);
System.out.println(resp.body());
headers, p, err := SignRequest("GET", "/v5/market/orderbook", map[string]string{"category": "linear", "symbol": "BTCUSDT", "limit": 10})
if err != nil { panic(err) }
req, _ := http.NewRequest("GET", BaseURL+p, nil)
for k, v := range headers { req.Header.Set(k, v) }
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
out, _ := io.ReadAll(resp.Body)
fmt.Println(string(out))
const {signRequest, BASE_URL} = require('./reference-client');
const {headers, path} = signRequest('GET', '/v5/market/orderbook', {"category": "linear", "symbol": "BTCUSDT", "limit": 10});
const r = await fetch(BASE_URL + path, {
method: 'GET',
headers,
});
console.log(await r.json());
Response
{
"retCode": 0,
"retMsg": "OK",
"result": {
"s": "BTCUSDT",
"b": [
["109739.9", "8.007"],
["109739.8", "0.824"],
["109739.7", "0.12"]
],
"a": [
["109740", "0.355"],
["109740.5", "0.001"],
["109742.6", "0.001"]
],
"ts": 1756460692358,
"u": 368327,
"seq": 448248061021
}
}
Response parameters
| Field | Type | Description |
|---|---|---|
s | string | Symbol. |
b | array | Bids — sorted descending. Each entry is [price, quantity], both strings. |
a | array | Asks — sorted ascending. Each entry is [price, quantity]. |
ts | integer | Snapshot timestamp (Unix ms). |
u | integer | Update ID. Increments with each book change. |
seq | integer | Sequence number — use to detect missed updates between snapshots. |