Spot Trading

Public Security Type: None Interfaces under "Public" can be freely accessed without API keys or signatures.

Test Connectivity GET https://api.xxx.com/spot/open/sapi/v1/ping

Test connectivity to the REST API. Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/TestConnectivity.java

text {}

Check Server Time GET https://api.xxx.com/spot/open/sapi/v1/time

Get server time. Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/CheckServerTime.java

java { "timezone": "GMT+08:00", "serverTime": 1595563624731 }

Trading Pair List GET https://api.xxx.com/spot/open/sapi/v1/symbols

Get all available trading pairs. Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/PairsList.java

java { "symbols": [ { "quantityPrecision": 3, "symbol": "sccadai", "pricePrecision": 6, "baseAsset": "SCCA", "quoteAsset": "DAI" }, ... // Other pairs ] }

Response: Name Type Example Description symbol string BTCUSDT Trading pair name baseAsset string BTC Base currency quoteAsset string USDT Quote currency pricePrecision integer 2 Price precision quantityPrecision integer 6 Quantity precision Market Data Security Type: None Market data interfaces require no authentication.

Order Book GET https://api.xxx.com/spot/open/sapi/v1/depth

Get order book depth data. Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/Depth.java

Query Parameters Name Type Description limit* integer Default 100; Max 100 symbol* string Trading pair, e.g. BTCUSDT

java { "bids": [ // Buy orders (price descending) ["3.90000000", "431.00000000"], // [Price, Quantity] ["4.00000000", "431.00000000"] ], "asks": [ // Sell orders (price ascending) ["4.00000200", "12.00000000"], ["5.10000000", "28.00000000"] ] }

Response: Name Type Example Description time long 1595563624731 Current timestamp (ms) bids list As above Buy-side order book entries asks list As above Sell-side order book entries 24hr Ticker GET https://api.xxx.com/spot/open/sapi/v1/ticker

24-hour price change statistics. Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/Ticker.java

Query Parameters Name Type Description symbol* string Trading pair, e.g. BTCUSDT

java { "high": "9279.0301", // High price "vol": "1302", // Volume "last": "9200", // Last price "low": "9279.0301", // Low price "rose": "0", // Price change "time": 1595563624731 // Timestamp }

Recent Trades GET https://api.xxx.com/spot/open/sapi/v1/trades

Get recent market trades. Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/RecentTradesList.java

Query Parameters Name Type Description symbol* string Trading pair, e.g. BTCUSDT limit* string Default 100; Max 1000

java { "list":[ { "price": "3.00000100", "qty": "11.00000000", "time": 1499865549590, "side": "BUY" // Taker side } ] }

Kline/Candlestick Data GET https://api.xxx.com/spot/open/sapi/v1/klines

Get historical candlestick data. Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/KlineCandlestickData.java

Query Parameters Name Type Description symbol* string Trading pair, e.g. BTCUSDT interval* string Kline interval: 1min,5min,15min,30min,60min,1day,1week,1month limit* integer Default 100; Max 300

java [ { "high": "6228.77", "vol": "111", "low": "6228.77", "idx": 1594640340, // Open time "close": "6228.77", "open": "6228.77" }, ... // Other intervals ]

Trading Security Type: TRADE Requires API key and signature authentication.

Create New Order POST https://api.xxx.com/spot/open/sapi/v1/order

Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/NewOrder.java Rate Limit: 100 requests/2s

Headers Header Name Type Description X-CH-SIGN* string Signature X-CH-APIKEY* string Your API Key X-CH-TS* integer Timestamp Request Body Parameter Type Description symbol* string Trading pair, e.g. BTCUSDT volume* number Order quantity side* string BUY or SELL type* string LIMIT or MARKET price number Required for LIMIT orders newClientOrderId string Custom order ID recvWindow integer Time window (ms)

java { 'symbol': 'LXTUSDT', 'orderId': '150695552109032492', 'clientOrderId': '157371322565051', 'transactTime': '1573713225668', 'price': '0.005452', 'origQty': '110', 'executedQty': '0', 'status': 'NEW', 'type': 'LIMIT', 'side': 'SELL' }

Test New Order POST https://api.xxx.com/spot/open/sapi/v1/order/test

Validate order parameters without execution. Demo: https://github.com/exchange2021/openapidemo/blob/master/src/main/java/com/spot/TestNewOrder.java

Headers & Parameters: Same as New Order

text {}

Batch Orders POST https://api.xxx.com/spot/open/sapi/v1/batchOrders

Rate Limit: 50 requests/2s (Max 10 orders per batch)

Request Body Name Type Description orders* array Order data (Max 10) symbol* string Trading pair, e.g. BTCUSDT Order Field: Name Type Example Description price float 1000 Price volume float 20.1 Quantity side string BUY/SELL Direction batchType string LIMIT/MARKET Order type

java { "ids": [ // System-generated order IDs 165964665990709251, 165964665990709252, 165964665990709253 ] }

Query Order GET https://api.xxx.com/spot/open/sapi/v1/order

Rate Limit: 20 requests/2s

Query Parameters Name Type Description orderId* string System order ID newClientOrderId string Custom order ID symbol* string Trading pair Headers: Authentication required

java { 'orderId': '499890200602846976', 'clientOrderId': '157432755564968', 'symbol': 'BHTUSDT', 'price': '0.01', 'origQty': '50', 'executedQty': '0', 'avgPrice': '0', 'status': 'NEW', 'type': 'LIMIT', 'side': 'BUY', 'transactTime': '1574327555669' }

Cancel Order POST https://api.xxx.com/spot/open/sapi/v1/cancel

Rate Limit: 100 requests/2s

Request Body Name Type Description orderId* string System order ID newClientOrderId string Custom order ID symbol* string Trading pair

java { 'symbol': 'BHTUSDT', 'clientOrderId': '0', 'orderId': '499890200602846976', 'status': 'CANCELED' }

Batch Cancel Orders POST https://api.xxx.com/spot/open/sapi/v1/batchCancel

Rate Limit: 50 requests/2s (Max 10 orders)

Request Body Name Type Description symbol* string Trading pair orderIds* array Order IDs, e.g. [123,456]

java { "success": [165964665990709251, ...], // Canceled orders "failed": [165964665990709250] // Failed (order not found/terminal state) }

Current Open Orders GET https://api.xxx.com/spot/open/sapi/v1/openOrders

Rate Limit: 20 requests/2s

Query Parameters Name Type Description symbol* string Trading pair limit* integer Default 100; Max 1000 Headers: Authentication required

java [ { 'orderId': '499902955766523648', 'symbol': 'BHTUSDT', 'price': '0.01', 'origQty': '50', 'executedQty': '0', 'avgPrice': '0', 'status': 'NEW', 'type': 'LIMIT', 'side': 'BUY', 'time': '1574329076202' }, ... // Other orders ]

Account Trade List GET https://api.xxx.com/spot/open/sapi/v1/myTrades

Rate Limit: 20 requests/2s

Query Parameters Name Type Description symbol* string Trading pair limit* string Default 100; Max 1000 fromId* integer Start trade ID for pagination

java [ { "symbol": "ETHBTC", "id": 100211, // Trade ID "bidId": 150695552109032492, // Buyer order ID "askId": 150695552109032493, // Seller order ID "price": "4.00000100", "qty": "12.00000000", "time": 1499865549590, // Trade timestamp "isBuyer": true, // True = Account was buyer "isMaker": false, // True = Maker order "feeCoin": "ETH", // Fee currency "fee": "0.001" // Fee amount }, ... // Other trades ]

Account Security Type: USER_DATA Requires authentication.

Account Information GET https://api.xxx.com/spot/open/sapi/v1/account

Rate Limit: 20 requests/2s

Headers: Authentication required

java { 'balances': [ { 'asset': 'BTC', 'free': '0.5', // Available balance 'locked': '0.1' // Locked balance }, { 'asset': 'ETH', 'free': '10', 'locked': '2' }, ... // Other assets ] }

Last updated