Get Orderbook

API Description

Retrieves the current order book (market depth) for a specific trading pair. This endpoint provides real-time bid and ask prices with their corresponding quantities, essential for market analysis and trading decisions.

HTTP Request

GET /v5/market/orderbook

Request Parameters

Parameter
Type
Required
Description

symbol

string

Yes

Symbol name (e.g., BTCUSDT)

limit

number

No

Number of order book levels (1, 25, 50, 100, 200)

Response Parameters

Parameter
Type
Description

retCode

number

Return code

retMsg

string

Return message

result

object

Response data object

bids

array

Array of bid orders [price, size]

asks

array

Array of ask orders [price, size]

ts

string

Timestamp of the order book

Request Example

cURL

curl -X GET \
  'https://api.synfutures.com/v5/market/orderbook?category=linear&symbol=BTCUSDT&limit=25' \
  -H 'Content-Type: application/json'

JavaScript (Fetch)

const response = await fetch(
    "https://api.synfutures.com/v5/market/orderbook?category=linear&symbol=BTCUSDT&limit=25",
    {
        method: "GET",
        headers: {
            "Content-Type": "application/json",
        },
    }
);

const data = await response.json();
console.log(data);

Python (requests)

import requests

url = "https://api.synfutures.com/v5/market/orderbook"
params = {
    'category': 'linear',
    'symbol': 'BTCUSDT',
    'limit': 25
}
headers = {
    'Content-Type': 'application/json'
}

response = requests.get(url, headers=headers, params=params)
result = response.json()
print(result)

Response Example

Success Response

{
    "retCode": 0,
    "retMsg": "OK",
    "result": {
        "s": "BTCUSDT",
        "b": [
            ["47000.50", "0.123"],
            ["47000.00", "0.456"],
            ["46999.50", "0.789"]
        ],
        "a": [
            ["47001.00", "0.321"],
            ["47001.50", "0.654"],
            ["47002.00", "0.987"]
        ],
        "ts": 1640995200123,
        "u": 123456
    },
    "time": "1640995200123"
}

Error Response

{
    "retCode": 10001,
    "retMsg": "Request parameter error",
    "result": {},
    "time": "1640995200123"
}

Last updated