Pri-openapi
  • 中文文档
    • 文档说明
    • 返回码类型
    • 枚举类型
    • 现货交易
    • 合约交易
    • Websocket推送
    • SDK开发库
    • 常见问题
  • OpenApi Doc
    • Documentation description
    • Return Code Type
    • Enum Type
    • Spot Trading API
    • Futures Trading API
    • Websocket
    • Official SDK
    • Common Problem
Powered by GitBook
On this page
  • Public
  • Security: None
  • Test Connectivity
  • Check Server Time
  • Symbol Pair List
  • Market
  • Security: None
  • Depth
  • 24hrs ticker
  • Recent Trades List
  • Kline/candlestick data
  • Trade
  • Security: TRADE
  • Create new order
  • Test New Order
  • Batch Orders
  • Query Order
  • Cancel Order
  • Batch Cancel Order
  • Current Open Orders
  • Trading records
  • Account
  • Security: USER_DATA
  • Account Information
  1. OpenApi Doc

Spot Trading API

Public

Security: None

Public section can be accessed freely without requiring any API-key or signatures.


Test Connectivity

GET https://openapi.xxx.com/sapi/v1/ping

This interface checks connectivity to the host

{}

Check Server Time

GET https://openapi.xxx.com/sapi/v1/time

This interface checks connectivity to the server and retrieves server timestamp

{
    "timezone": "China Standard Time",
    "serverTime": 1595563624731
}
Parameter
Type
Example
Describe

timezone

string

China Standard Time

Server time zone

serverTime

long

1705039779880

Server timestamp


Symbol Pair List

GET https://openapi.xxx.com/sapi/v1/symbols

The supported symbol pair collection which in the exchange

{
    "symbols": [
        {
            "quantityPrecision": 3,
            "limitVolumeMin":0.0001,
            "symbol": "sccadai",
            "pricePrecision": 6,
            "marketBuyMin":0.0001,
            "marketSellMin":0.0001,
            "baseAsset": "SCCA",
            "limitPriceMin":0.001,
            "quoteAsset": "DAI",
        },
        {
            "quantityPrecision": 8,
            "limitVolumeMin":0.0001,
            "symbol": "btcusdt",
            "pricePrecision": 2,
            "marketBuyMin":0.0001,
            "marketSellMin":0.0001,
            "baseAsset": "BTC",
            "limitPriceMin":0.001,
            "quoteAsset": "USDT"
        },
        {
            "quantityPrecision": 3,
            "limitVolumeMin":0.0001,
            "symbol": "bchusdt",
            "pricePrecision": 2,
            "marketBuyMin":0.0001,
            "marketSellMin":0.0001,
            "baseAsset": "BCH",
            "limitPriceMin":0.001,
            "quoteAsset": "USDT"
        },
        {
            "quantityPrecision": 2,
            "limitVolumeMin":0.0001,
            "symbol": "etcusdt",
            "pricePrecision": 2,
            "marketBuyMin":0.0001,
            "marketSellMin":0.0001,
            "baseAsset": "ETC",
            "limitPriceMin":0.001,
            "quoteAsset": "USDT"
        },
        {
            "quantityPrecision": 2,
            "limitVolumeMin":0.0001,
            "symbol": "ltcbtc",
            "pricePrecision": 6,
            "marketBuyMin":0.0001,
            "marketSellMin":0.0001,
            "baseAsset": "LTC",
            "limitPriceMin":0.001,
            "quoteAsset": "BTC"
        }
    ]
}
Parameter
Type
Exmaple
Describe

symbol

string

btcusdt

Lower case symbol name

baseAsset

string

BTC

Underlying asset for the symbol

quoteAsset

string

USDT

Quote asset for the symbol

pricePrecision

integer

2

Price accuracy

quantityPrecision

integer

6

Quantity accuracy

limitVolumeMin

BigDecimal

0.00001

Minimum quantity limit for limit order

marketBuyMin

BigDecimal

0.00001

Minimum purchase quantity for market order

marketSellMin

BigDecimal

0.00001

Minimum selling quantity for market orders

limitPriceMin

BigDecimal

0.00001

Minimum price limit for limit orders


Market

Security: None

Market section can be accessed freely without requiring any API-key or signatures.


Depth

GET https://openapi.xxx.com/sapi/v1/depth

Market detpth data

Query Parameters

Name
Type
Description

limit*

integer

Default 100; Maximum 100

symbol*

string

Uppercase symbol name E.g.BTCUSDT

{
  "bids": [
    [
      "3.90000000",   // Price
      "431.00000000"  // Vol
    ],
    [
      "4.00000000",
      "431.00000000"
    ]
  ],
  "asks": [
    [
      "4.00000200",  // Price
      "12.00000000"  // Volume
    ],
    [
      "5.10000000",
      "28.00000000"
    ]
  ],
  "time": 1701658276000
}
Parameter
Type
Example
Describe

time

long

1595563624731

Current timestamp (ms)

bids

array

[[1.3200,2.04],[0.2,0.4]]

Order book buying information, the array length is 2, subscript one is the price, type is float; subscript two is the quantity corresponding to the current price, type is float

asks

array

[[1.3200,2.04],[0.2,0.4]]

Order book selling information, the array length is 2, subscript one is the price, type is float; subscript two is the quantity corresponding to the current price, type is float

The information corresponding to bids and asks represents all the prices in the order book and the quantity information corresponding to the prices, arranged from top to bottom from the best price


24hrs ticker

GET https://openapi.xxx.com/sapi/v1/ticker

24-hour price change data

Query Parameters

Name
Type
Description

symbol*

string

Uppercase symbol name E.g.BTCUSDT

{
    "amount":"23.20",
    "high": "9279.03",
    "vol": "1302.00",
    "last": "9200.00",
    "low": "9279.03",
    "buy":130.00,
    "sell":0.00,
    "rose": "+0.05",
    "time": 1595563624731
}
Parameter
Type
Example
Describe

time

long

1595563624731

Timestamp (ms)

high

float

9900

Highest price

low

float

8800.34

Lowest price

last

float

8900

Latest deal price

vol

float

4999

Trade volume

amount

float

23.20

Trade amount

buy

float

130

The price in the buying book order at the first one

sell

float

120

The price in the selling book order at the first one

rose

string

+0.05

Range of increase and decrease, + is increase, - is decrease, +0.05 means increase by 5%


Recent Trades List

GET https://openapi.xxx.com/sapi/v1/trades

Query Parameters

Name
Type
Description

symbol*

string

Uppercase symbol name E.g.BTCUSDT

limit*

string

Default 100; Maximum 1000

[
    {
        "side": "buy",
        "price": 130.0000000000000000,
        "qty": 0.1000000000000000,
        "time": 1704788645416
    },
    {
        "side": "buy",
        "price": 130.0000000000000000,
        "qty": 0.1000000000000000,
        "time": 1704788282332
    }
]
Parameter
Type
Example
Describe

price

float

0.055

Trade price

time

long

1537797044116

Timestamp(ms)

qty

float

5

The quantity traded

side

string

buy/sell

Taker side


Kline/candlestick data

GET https://openapi.xxx.com/sapi/v1/klines

Query Parameters

Name
Type
Description

symbol*

string

Uppercase symbol name E.g.BTCUSDT

interval*

string

Interval of the Kline. Possible values include: 1min,5min,15min,30min,60min,1day,1week,1month

limit

integer

Default 100; Maximum 300

[
    {
        "high": "6228.77",
        "vol": "111",
        "low": "6228.77",
        "idx": 1594640340,
        "close": "6228.77",
        "open": "6228.77"
    },
    {
        "high": "6228.77",
        "vol": "222",
        "low": "6228.77",
        "idx": 1587632160,
        "close": "6228.77",
        "open": "6228.77"
    },
    {
        "high": "6228.77",
        "vol": "333",
        "low": "6228.77",
        "idx": 1587632100,
        "close": "6228.77",
        "open": "6228.77"
    }
]
Parameter
Type
Example
Describe

idx

long

1538728740000

Open time (timestamp,ms)

open

float

36.00

Open price

close

float

33.00

Close price

high

float

36.00

Highest price

low

float

30.00

Lowest price

vol

float

2456.11

Trade volume


Trade

Security: TRADE

The interface in Trade requires API-key and signature for access.


Create new order

POST https://openapi.xxx.com/sapi/v1/order

Rate Limit: 100times/2s

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

User API-KEY

X-CH-TS*

integer

Timestamp

Request Body

Name
Type
Description

symbol*

string

Symbol name, Case-insensitivet E.g.BTCUSDT or btcusdt

volume*

number

Order quantity, there is a precision limit, the precision is configured by the administrator

side*

string

Order side, BUY/SELL

type*

string

Order type, LIMIT/MARKET

price

number

Order price, for LIMIT orders must be sent, there is a precision limit, the precision is configured by the administrator

newClientOrderId

string

The field is a third-party identifier and is not involved in the exchange's business logic or stored in the database. It is only returned as-is in the response. (Note: This field is not the exchange’s business order ID, please distinguish accordingly)

{
    "symbol": "ETHUSDT",
    "side": "BUY",
    "executedQty": 0,
    "orderId": [
        "2012274607240433332"
    ],
    "price": 0,
    "origQty": 0.01,
    "clientOrderId": "1212",
    "transactTime": 1704959985403,
    "type": "MARKET",
    "status": "NEW"
}
Parameter
Type
Example
Describe

orderId

long

150695552109032492

Order ID (system generated)

clientOrderId

string

213443

Order ID (sent by user)

symbol

string

BTCUSDT

Uppercase symbol name

transactTime

integer

1273774892913

The time of place order

price

float

4765.29

Order price

origQty

float

1.01

Order volume

executedQty

float

1.01

The number of already deal order

type

string

LIMIT

Type of the orderLIMIT/MARKET

side

string

BUY

Side of the orderBUY/ SELL

status

string

New Order

Order status:New Order(new order or not transaction yet)


Test New Order

POST https://openapi.xxx.com/sapi/v1/order/test

Test new order creation and signature/recvWindow length. Creates and validates a new order but does not send the order into the matching engine.

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

Usr API-KEY

X-CH-TS*

integer

Timestamp

Request Body

Name
Type
Description

symbol*

string

Uppercase symbol name E.g.BTCUSDT

volume*

number

Order quantity, with precision limits, configured by the administrator

side*

string

Order side , BUY/SELL

type*

string

Order type, LIMIT/MARKET

price

number

Order price, for LIMIT orders must be sent, there is a precision limit, configured by the administrator

newClientOrderId

string

The field is a third-party identifier and is not involved in the exchange's business logic or stored in the database. It is only returned as-is in the response. (Note: This field is not the exchange’s business order ID, please distinguish accordingly)

{}

Batch Orders

POST https://openapi.xxx.com/sapi/v1/batchOrders

Rate Limit : 50times/2s Maximum 10 orders in one batch order request

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

User API-KEY

X-CH-TS*

integer

Timestamp

Request Body

Name
Type
Description

orders*

array

Batch order param, Maxinum 10 orders

symbol*

string

Uppercase symbol name E.g. BTCUSDT

{
    "ids": [
        165964665990709251,
        165964665990709252,
        165964665990709253
    ]
}
Parameter
Type
Example
Describe

price

float

1000.00

Trade pice

volume

float

20.10

Trade volume

side

string

BUY/SELL

Order side

batchType

string

LIMIT/MARKET

Order type

symbol

string

ETHUSDT

Uppercase symbol name

Example of request
{"symbol":"ETHUSDT","orders":[{"side":"BUY","price":1980.00,"volume":1,"batchType":"MARKET"}]}

Query Order

GET https://openapi.xxx.com/sapi/v1/order

Rate Limit: 20 times/2s

Query Parameters

Name
Type
Description

orderId*

string

Order id

symbol*

string

Lowercase symbol name E.g.ethusdt

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

User API-KEY

X-CH-TS*

integer

Timestamp

{
    "symbol": "ethusdt",
    "side": "BUY",
    "executedQty": 0E-16,
    "orderId": 53,
    "price": 20200.00,
    "origQty": 0.024,
    "avgPrice": 0E-16,
    "transactTime": 1672274311107,
    "type": "LIMIT",
    "status": "PENDING_CANCEL"
}
Parameter
Type
Example
Describe

orderId

long

150695552109032492

Order ID(system generated)

clientOrderId

string

213443

Order ID(sent by user)

symbol

string

ethusdt

Lowercase symbol name

price

float

4765.29

Order price

origQty

float

1.01

Order volume

executedQty

float

1.01

The number of already deal order

avgPrice

float

4754.24

The average price of already deal order

type

string

LIMIT

Order type :LIMIT/MARKET

transactTime

long

1672274311107

Timestamp

side

string

BUY

Order side: BUY/SELL

status

string

New Order

Order status: New Order (new order, no transaction), Partially Filled(partial transaction), Filled (full transaction), Cancelled (cancelled), Partially Filled/Cancelled (partial transaction but order canceled).


Cancel Order

POST https://openapi.xxx.com/sapi/v1/cancel

Rate Limit: 100times/2s

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

User API-KEY

X-CH-TS*

integer

Timestamp

Request Body

Name
Type
Description

orderId*

string

Order id

symbol*

string

Lowercase symbol name E.g. ethusdt

{
    "symbol": "ethusdt",
    "orderId": [
        "1938321163093079425"
    ],
    "status": "PENDING_CANCEL"
}
Parameter
Type
Example
Describe

orderId

long

150695552109032492

Order ID(system generated)

symbol

string

ethusdt

Lowercase symbol name

status

string

To be Cancelled

Order Status:To be Cancelled


Batch Cancel Order

POST https://openapi.xxx.com/sapi/v1/batchCancel

Rate Limit: 50times/2s Every batch cancel request contains at most 10 orders

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

User API-KEY

X-CH-TS*

integer

Timestamp

Request Body

Name
Type
Description

symbol*

string

Uppercase symbol name E.g. BTCUSDT

orderIds*

array

Collection of order IDs to be canceled. The order id must be of numeric type rather than String type. e.g.[123,456]

Return successful
{
    "success": [
        165964665990709251,
        165964665990709252,
        165964665990709253
    ],
    "failed": [ //Cancellation failure is usually because the order does not exist or the order status has reached the final state.
        165964665990709250  
    ]
}
Return failed
{} //Usually it is because the order number is wrong and you need to check whether the content in orderIds is correct.

Current Open Orders

GET https://openapi.xxx.com/sapi/v1/openOrders

Rate Limit: 20times/2s

Query Parameters

Name
Type
Description

symbol*

string

Lowercase symbol name E.g. ethusdt

limit*

integer

Maximum 1000

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

User API-KEY

X-CH-TS*

integer

Timestamp

[
    {
        "symbol": "ETHUSDT",
        "side": "BUY",
        "executedQty": "0",
        "orderId": 1938321163093077686,
        "price": "0",
        "origQty": "0.10",
        "avgPrice": "0",
        "time": 1701240367864,
        "type": "MARKET",
        "status": "NEW_"
    },
    {
        "symbol": "ETHUSDT",
        "side": "BUY",
        "executedQty": "0",
        "orderId": 1938321163093078022,
        "price": "0",
        "origQty": "0.01",
        "avgPrice": "0",
        "time": 1701243281850,
        "type": "MARKET",
        "status": "NEW_"
    }
]
Parameter
Type
Example
Describe

orderId

long

150695552109032492

Order ID(system generated)

symbol

string

BTCUSDT

Uppercase symbol name

price

float

4765.29

Order price

origQty

float

1.01

Order volume

executedQty

float

1.01

The number of already deal order

avgPrice

float

4754.24

The average price of already deal order

type

string

LIMIT

Order type :LIMIT/MARKET

time

long

1701243281850

Timestamp

side

string

BUY

Order side BUY/ SELL

status

string

New Order

Order status: New Order (new order, no transaction), Partially Filled(partial transaction), Filled (full transaction), Cancelled (cancelled), Partially Filled/Cancelled (partial transaction but order canceled).


Trading records

GET https://openapi.xxx.com/sapi/v1/myTrades

Rate Limit: 20times/2s

Query Parameters

Name
Type
Description

symbol*

string

Uppercase symbol name E.g. BTCUSDT

limit*

string

Default100; Maximum 1000

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

User API-KEY

X-CH-TS*

integer

Timestamp

[
    {
        "symbol": "ETHUSDT",
        "side": "BUY",
        "fee": "0.00000000428",
        "isMaker": false,
        "isBuyer": true,
        "bidId": 1954603951049381893,
        "bidUserId": 10083,
        "feeCoin": "ETH",
        "price": "2334",
        "qty": "0.00000428",
        "askId": 1856176838352995447,
        "id": 159,
        "time": 1701623660989,
        "isSelf": false,
        "askUserId": 10671
    },
    {
        "symbol": "ETHUSDT",
        "side": "BUY",
        "fee": "0.00000004284",
        "isMaker": false,
        "isBuyer": true,
        "bidId": 1938321163093068889,
        "bidUserId": 10083,
        "feeCoin": "ETH",
        "price": "2334",
        "qty": "0.00004284",
        "askId": 1856176838352995447,
        "id": 158,
        "time": 1701165091964,
        "isSelf": false,
        "askUserId": 10671
    }
]
Parameter
Type
Example
Describe

symbol

string

ETHBTC

Uppercase symbol name

id

integer

28457

Trade id

bidId

long

150695552109032492

Buy side order ID

askId

long

150695552109032493

Sell side order ID

price

integer

4.01

Trade timestamp

qty

float

12

Trade volume

time

number

1499865549590

Trade timestamp

isBuyer

boolean

true

true= Buyer false= Seller

isMaker

boolean

false

true=Maker false=Taker

feeCoin

string

ETH

Trade fee coin

fee

number

0.01

Trade fee

bidUserId

integer

10083

Buy side user id

askUserId

integer

10094

Sell side user id

isSelf

boolean

false

self deal status true = is self deal false = not self deal

side

string

BUY

Taker order side: BUY/SELL


Account

Security: USER_DATA

The interface in Trade requires API-key and signature for access.


Account Information

GET https://openapi.xxx.com/sapi/v1/account

Rate Limit: 20times/2s

Headers

Name
Type
Description

X-CH-SIGN*

string

Sign

X-CH-APIKEY*

string

User API-KEY

X-CH-TS*

integer

Timestamp

{
    "balances": [
        {
            "asset": "ABAT",
            "free": "10.00",
            "locked": "20.00"
        },
        {
            "asset": "DOT",
            "free": "10.00",
            "locked": "10.00"
        },
        {
            "asset": "TT",
            "free": "50.00",
            "locked": "50.00"
        }
]
Parameter
Type
Describe

balances

[]

The collection or account balance

Parameter
Type
Example
Describe

asset

string

USDT

Coin name

free

float

1000.30

Account available amount

locked

float

400

Account frozen amount

PreviousEnum TypeNextFutures Trading API

Last updated 6 months ago