Info & Market Data

This document covers endpoints used to fetch public exchange information and market data. These endpoints are typically public and do not require API Key authentication.

Pagination

Endpoints that return a list of items (such as historical orders) use cursor-based pagination. You can navigate through the data using the before and after parameters. The values for these parameters should be the order ID (ordId) from your last request.

  • after: Fetches records older than this ID.

  • before: Fetches records newer than this ID.

Using cursor-based pagination ensures that you won't miss or receive duplicate data in a rapidly changing market.


1. Get Instruments

GET /api/v1/common/instruments

Retrieves detailed information for all tradable products, including spot and swaps, such as product ID, precision, minimum order size, and more. This is the first endpoint you should call before starting to trade.

Authentication: None (Public)

Query Parameters:

Name
Type
Required
Description

instType

String

Yes

Instrument type. SPOT, SWAP.

Success Response (200 OK):

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "instType": "SPOT",
      "instId": "BTC-USDT",
      "baseCcy": "BTC",
      "quoteCcy": "USDT",
      "tickSize": "0.01",
      "lotSize": "0.00001",
      "minOrderSize": "0.0001",
      "state": "live"
    },
    {
      "instType": "SWAP",
      "instId": "BTC-USDT-SWAP",
      "contractValue": "0.001",
      "settleCcy": "USDT",
      "tickSize": "0.1",
      "lotSize": "1",
      "state": "live"
    }
  ]
}

2. Get Order Book

GET /api/v1/market/books

Retrieves the order book depth snapshot for a specific instrument.

Authentication: None (Public)

Query Parameters:

Name
Type
Required
Description

instId

String

Yes

Instrument ID, e.g., BTC-USDT-SWAP.

sz

String

No

Number of depth levels. Default is 20, max is 100.

Success Response (200 OK):

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "asks": [
        ["68001.5", "1.5", "0", "5"],
        ["68002.0", "2.0", "0", "8"]
      ],
      "bids": [
        ["68000.0", "1.2", "0", "4"],
        ["67999.5", "0.8", "0", "3"]
      ],
      "ts": "1755243794995"
    }
  ]
}

Note: The format for each price level is [price, size, (deprecated), number_of_orders].


3. Get Candlestick Data (K-line)

GET /api/v1/market/candles

Retrieves historical candlestick data for a specific instrument.

Authentication: None (Public)

Query Parameters:

Name
Type
Required
Description

instId

String

Yes

Instrument ID, e.g., BTC-USDT.

bar

String

No

Candlestick interval. E.g., 1m, 5m, 1H, 4H, 1D. Default is 1m.

limit

String

No

Number of results. Max 1000, default 100.

after

String

No

Request data before this timestamp (older). (Unix ms)

before

String

No

Request data after this timestamp (newer). (Unix ms)

Success Response (200 OK):

{
  "code": "0",
  "msg": "",
  "data": [
    [
      "1755243600000",
      "68000.0",
      "68100.5",
      "67950.0",
      "68050.5",
      "120.5"
    ]
  ]
}

Note: The format for each candle is [timestamp, open, high, low, close, volume].


Last updated