NAV
中文

Overview

Welcome to our V5 API documentation. Okcoin provides REST and WebSocket APIs to suit your trading needs.
The V5 API is only applicable to the Unified account.

V5 API Key Creation

Please refer to my api page regarding V5 API Key creation.

Production Trading Services

The Production Trading URL:

Transaction timeouts

Orders may not be processed in time due to network delay or busy Okcoin servers. You can configure the expiry time of the request using expTime if you want the order request to be discarded after a specific time.

If expTime is specified in the requests for Place (multiple) orders or Amend (multiple) orders, the request will not be processed if the current system time of the server is after the expTime.

You should synchronize with our system time. Use Get system time to obtain the current system time.

REST

Set the following parameters in the request header

Parameter Type Required Description
expTime String No Request effective deadline. Unix timestamp format in milliseconds, e.g. 1597026383085

The following endpoints are supported:

Request Example

curl -X 'POST' \
  'https://www.okcoin.com/api/v5/trade/order' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'OK-ACCESS-KEY: *****' \
  -H 'OK-ACCESS-SIGN: *****'' \
  -H 'OK-ACCESS-TIMESTAMP: *****'' \
  -H 'OK-ACCESS-PASSPHRASE: *****'' \
  -H 'expTime: 1597026383085' \   // request effective deadline
  -d '{
  "instId": "BTC-USDT",
  "tdMode": "cash",
  "side": "buy",
  "ordType": "limit",
  "px": "1000",
  "sz": "0.01"
}'

WebSocket

The following parameters are set in the request

Parameter Type Required Description
expTime String No Request effective deadline. Unix timestamp format in milliseconds, e.g. 1597026383085

The following endpoints are supported:

Request Example

{
    "id": "1512",
    "op": "order",
    "expTime":"1597026383085",  // request effective deadline
    "args": [{
        "side": "buy",
        "instId": "BTC-USDT",
        "tdMode": "isolated",
        "ordType": "market",
        "sz": "100"
    }]
}

REST API

Authentication

Generating an APIKey

Create an APIKey on the website before signing any requests. After creating an APIKey, keep the following information safe:

The system returns randomly-generated APIKeys and SecretKeys. You will need to provide the Passphrase to access the API. We store the salted hash of your Passphrase for authentication. We cannot recover the Passphrase if you have lost it. You will need to create a new set of APIKey.

Making Requests

All private REST requests must contain the following headers:

Request bodies should have content type application/json and be in valid JSON format.

Signature

Signing Messages

The OK-ACCESS-SIGN header is generated as follows:

Example: sign=CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(timestamp + 'GET' + '/api/v5/account/balance?ccy=BTC', SecretKey))

The timestamp value is the same as the OK-ACCESS-TIMESTAMP header with millisecond ISO format, e.g. 2020-12-08T09:08:57.715Z.

The request method should be in UPPERCASE: e.g. GET and POST.

The requestPath is the path of requesting an endpoint.

Example: /api/v5/account/balance

The body refers to the String of the request body. It can be omitted if there is no request body (frequently the case for GET requests).

Example: {"instId":"BTC-USDT","lever":"5","mgnMode":"isolated"}

The SecretKey is generated when you create an APIKey.

Example: 22582BD0CFF14C41EDBF1AB98506286D

Trade

All Trade API endpoints require authentication.

Place order

You can place an order only if you have sufficient funds.

Rate Limit: 60 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/order

Request Example

 place order for SPOT
 POST /api/v5/trade/order
 body
 {
    "instId":"BTC-USD",
    "tdMode":"cash",
    "clOrdId":"b15",
    "side":"buy",
    "ordType":"limit",
    "px":"2.15",
    "sz":"2"
}

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
tdMode String Yes Trade mode
Margin mode cross isolated
Non-Margin mode cash
clOrdId String No Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
tag String No Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
side String Yes Order side, buy sell
ordType String Yes Order type
market: Market order
limit: Limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
sz String Yes Quantity to buy or sell
px String Conditional Order price. Only applicable to limit,post_only,fok,ioc order.
tgtCcy String No Whether the target currency uses the quote or base currency.
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
banAmend Boolean No Whether to disallow the system from amending the size of the SPOT Market Order.
Valid options: true or false. The default value is false.
If true, system will not amend and reject the market order if user does not have sufficient funds.
Only applicable to SPOT Market Orders

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "clOrdId": "oktswap6",
      "ordId": "312269865356374016",
      "tag": "",
      "sCode": "0",
      "sMsg": ""
    }
  ]
}

Response Parameters

Parameter Type Description
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
tag String Order tag
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Place multiple orders

Place orders in batches. Maximum 20 orders can be placed per request. Request parameters should be passed in the form of an array.

Rate Limit: 300 orders per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/batch-orders

Request Example

 batch place order for SPOT
 POST /api/v5/trade/batch-orders
 body
 [
    {
        "instId":"BTC-USD",
        "tdMode":"cash",
        "clOrdId":"b15",
        "side":"buy",
        "ordType":"limit",
        "px":"2.15",
        "sz":"2"
    },
    {
        "instId":"BTC-USD",
        "tdMode":"cash",
        "clOrdId":"b15",
        "side":"buy",
        "ordType":"limit",
        "px":"2.15",
        "sz":"2"
    }
]

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
tdMode String Yes Trade mode
Non-Margin mode cash
clOrdId String No Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
tag String No Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
side String Yes Order side buy sell
ordType String Yes Order type
market: Market order
limit: Limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
sz String Yes Quantity to buy or sell
px String Conditional Order price. Only applicable to limit,post_only,fok,ioc order.
tgtCcy String No Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
banAmend Boolean No Whether to disallow the system from amending the size of the SPOT Market Order.
Valid options: true or false. The default value is false.
If true, system will not amend and reject the market order if user does not have sufficient funds.
Only applicable to SPOT Market Orders

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "clOrdId":"oktswap6",
            "ordId":"12345689",
            "tag":"",
            "sCode":"0",
            "sMsg":""
        },
        {
            "clOrdId":"oktswap7",
            "ordId":"12344",
            "tag":"",
            "sCode":"0",
            "sMsg":""
        },
     .......
    ]
}

Response Parameters

Parameter Type Description
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
tag String Order tag
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Cancel order

Cancel an incomplete order.

Rate Limit: 60 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/cancel-order

Request Example

POST /api/v5/trade/cancel-order
body
{
    "ordId":"2510789768709120",
    "instId":"BTC-USD"
}

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
ordId String Conditional Order ID
Either ordId or clOrdId is required. If both are passed, ordId will be used.
clOrdId String Conditional Client Order ID as assigned by the client

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "clOrdId":"oktswap6",
            "ordId":"12345689",
            "sCode":"0",
            "sMsg":""
        }
    ]
}

Response Parameters

Parameter Type Description
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Cancel multiple orders

Cancel incomplete orders in batches. Maximum 20 orders can be canceled per request. Request parameters should be passed in the form of an array.

Rate Limit: 300 orders per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/cancel-batch-orders

Request Example

POST /api/v5/trade/cancel-batch-orders
body
[
    {
        "instId":"BTC-USD",
        "ordId":"12312"
    },
    {
        "instId":"BTC-USD",
        "ordId":"1212"
    }
]

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
ordId String Conditional Order ID
Either ordId or clOrdId is required. If both are passed, ordId will be used.
clOrdId String Conditional Client Order ID as assigned by the client

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "clOrdId":"oktswap6",
            "ordId":"12345689",
            "sCode":"0",
            "sMsg":""
        },
        {
            "clOrdId":"oktswap7",
            "ordId":"12344",
            "sCode":"0",
            "sMsg":""
        },
     .......
    ]
}

Response Parameters

Parameter Type Description
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Amend order

Amend an incomplete order.

Rate Limit: 60 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/amend-order

Request Example

POST /api/v5/trade/amend-order
body
{
    "ordId":"2510789768709120",
    "newSz":"2",
    "instId":"BTC-USD"
}

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID
cxlOnFail Boolean No Whether the order needs to be automatically canceled when the order amendment fails
Valid options: false or true, the default is false.
ordId String Conditional Order ID
Either ordId or clOrdId is required. If both are passed, ordId will be used.
clOrdId String Conditional Client Order ID as assigned by the client
reqId String No Client Request ID as assigned by the client for order amendment
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
The response will include the corresponding reqId to help you identify the request if you provide it in the request.
newSz String Conditional New quantity after amendment. Either newSz or newPx is required. When amending a partially-filled order, the newSz should include the amount that has been filled.
newPx String Conditional New price after amendment.

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
         "clOrdId":"",
         "ordId":"12344",
         "reqId":"b12344",
         "sCode":"0",
         "sMsg":""
        }
    ]
}

Response Parameters

Parameter Type Description
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
reqId String Client Request ID as assigned by the client for order amendment.
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Amend multiple orders

Amend incomplete orders in batches. Maximum 20 orders can be amended per request. Request parameters should be passed in the form of an array.

Rate Limit: 300 orders per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/amend-batch-orders

Request Example

POST /api/v5/trade/amend-batch-orders
body
[
    {
        "ordId":"2510789768709120",
        "newSz":"2",
        "instId":"BTC-USD"
    },
    {
        "ordId":"2510789768709121",
        "newSz":"2",
        "instId":"BTC-USD"
    }
]

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID
cxlOnFail Boolean No Whether the order needs to be automatically canceled when the order amendment fails
false true, the default is false.
ordId String Conditional Order ID
Either ordId or clOrdIdis required, if both are passed, ordId will be used.
clOrdId String Conditional Client Order ID as assigned by the client
reqId String No Client Request ID as assigned by the client for order amendment
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
The response will include the corresponding reqId to help you identify the request if you provide it in the request.
newSz String Conditional New quantity after amendment. Either newSz or newPx is required. When amending a partially-filled order, the newSz should include the amount that has been filled.
newPx String Conditional New price after amendment.

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "clOrdId":"oktswap6",
            "ordId":"12345689",
            "reqId":"b12344",
            "sCode":"0",
            "sMsg":""
        },
        {
            "clOrdId":"oktswap7",
            "ordId":"12344",
            "reqId":"b12344",
            "sCode":"0",
            "sMsg":""
        },
     .......
    ]
}

Response Parameters

Parameter Type Description
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
reqId String Client Request ID as assigned by the client for order amendment.
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Get order details

Retrieve order details.

Rate Limit: 60 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

GET /api/v5/trade/order

Request Example

GET /api/v5/trade/order?ordId=2510789768709120&instId=BTC-USD

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
ordId String Conditional Order ID
Either ordId or clOrdId is required, if both are passed, ordId will be used
clOrdId String Conditional Client Order ID as assigned by the client

Response Example

{
    "code": "0",
    "data": [
        {
            "accFillSz": "1.6342",
            "avgPx": "0.9995",
            "cTime": "1672814726198",
            "category": "normal",
            "ccy": "",
            "clOrdId": "",
            "fee": "-0.00245007435",
            "feeCcy": "USD",
            "fillPx": "0.9995",
            "fillSz": "1.6342",
            "fillTime": "1672814726201",
            "instId": "USDT-USD",
            "instType": "SPOT",
            "lever": "",
            "ordId": "530758662663180288",
            "ordType": "market",
            "pnl": "0",
            "posSide": "net",
            "px": "",
            "rebate": "0",
            "rebateCcy": "USDT",
            "reduceOnly": "false",
            "side": "sell",
            "slOrdPx": "",
            "slTriggerPx": "",
            "slTriggerPxType": "",
            "source": "",
            "state": "filled",
            "sz": "1.6342",
            "tag": "",
            "tdMode": "cash",
            "tgtCcy": "base_ccy",
            "tpOrdPx": "",
            "tpTriggerPx": "",
            "tpTriggerPxType": "",
            "tradeId": "3225651",
            "uTime": "1672814726203"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
instType String Instrument type
SPOT
instId String Instrument ID
tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
ccy String Margin currency. Not enabled. Please disregard.
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
tag String Order tag
px String Price
sz String Quantity to buy or sell
pnl String Profit and loss. Not enabled. Please disregard.
ordType String Order type
market: Market order
limit: Limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
side String Order side
posSide String Position side. Not enabled. Please disregard.
tdMode String Trade mode
accFillSz String Accumulated fill quantity
fillPx String Last filled price. If none is filled, it will return 0.
tradeId String Last traded ID
fillSz String Last filled quantity
fillTime String Last filled time
avgPx String Average filled price. If none is filled, it will return 0.
state String State
canceled
live
partially_filled
filled
lever String Leverage. Not enabled. Please disregard.
tpTriggerPx String Take-profit trigger price.
tpTriggerPxType String Take-profit trigger price type.
last: last price
tpOrdPx String Take-profit order price.
slTriggerPx String Stop-loss trigger price.
slTriggerPxType String Stop-loss trigger price type.
last: last price
slOrdPx String Stop-loss order price.
feeCcy String Fee currency
fee String Fee and rebate
It is accumulated fee charged by the platform. It is always negative, e.g. -0.01.
rebateCcy String Rebate currency
source String Order source
13:The generated limit order after the strategy order is triggered
rebate String Rebate amount, only applicable to spot, the reward of placing orders from the platform (rebate) given to user who has reached the specified trading level. If there is no rebate, this field is "".
category String Category
normal
uTime String Update time, Unix timestamp format in milliseconds, e.g. 1597026383085
cTime String Creation time, Unix timestamp format in milliseconds, e.g. 1597026383085

Get order List

Retrieve all incomplete orders under the current account.

Rate Limit: 60 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/trade/orders-pending

Request Example

GET /api/v5/trade/orders-pending?ordType=post_only,fok,ioc&instType=SPOT

Request Parameters

Parameter Type Required Description
instType String No Instrument type
SPOT
instId String No Instrument ID, e.g. BTC-USD
ordType String No Order type
market: Market order
limit: Limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
state String No State
live
partially_filled
after String No Pagination of data to return records earlier than the requested ordId
before String No Pagination of data to return records newer than the requested ordId
limit String No Number of results per request. The maximum is 100; The default is 100

Response Example

{
    "code": "0",
    "msg": "",
    "data": [
        {
            "accFillSz": "0",
            "avgPx": "",
            "cTime": "1618235248028",
            "category": "normal",
            "ccy": "",
            "clOrdId": "",
            "fee": "0",
            "feeCcy": "BTC",
            "fillPx": "",
            "fillSz": "0",
            "fillTime": "",
            "instId": "BTC-USDT",
            "instType": "SPOT",
            "lever": "5.6",
            "ordId": "301835739059335168",
            "ordType": "limit",
            "pnl": "0",
            "posSide": "net",
            "px": "59200",
            "rebate": "0",
            "rebateCcy": "USDT",
            "side": "buy",
            "slOrdPx": "",
            "slTriggerPx": "",
            "slTriggerPxType": "last",
            "state": "live",
            "sz": "1",
            "tag": "",
            "tgtCcy": "",
            "tdMode": "cross",
            "source":"",
            "tpOrdPx": "",
            "tpTriggerPx": "",
            "tpTriggerPxType": "last",
            "tradeId": "",
            "uTime": "1618235248028"
        }
    ]
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
ccy String Margin currency. Not enabled. Please disregard.
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
tag String Order tag
px String Price
sz String Quantity to buy or sell
pnl String Profit and loss. Not enabled. Please disregard.
ordType String Order type
market: Market order
limit: Limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
side String Order side
posSide String Position side. Not enabled. Please disregard.
tdMode String Trade mode
accFillSz String Accumulated fill quantity
fillPx String Last filled price
tradeId String Last trade ID
fillSz String Last filled quantity
fillTime String Last filled time
avgPx String Average filled price. If none is filled, it will return 0.
state String State
live
partially_filled
lever String Leverage. Not enabled. Please disregard.
tpTriggerPx String Take-profit trigger price.
tpTriggerPxType String Take-profit trigger price type.
last: last price
tpOrdPx String Take-profit order price.
slTriggerPx String Stop-loss trigger price.
slTriggerPxType String Stop-loss trigger price type.
last: last price
slOrdPx String Stop-loss order price.
feeCcy String Fee currency
fee String Fee and rebate
For spot, it is accumulated fee charged by the platform. It is always negative, e.g. -0.01.
rebateCcy String Rebate currency
source String Order source
13:The generated limit order after the strategy order is triggered
rebate String Rebate amount, only applicable to spot, the reward of placing orders from the platform (rebate) given to user who has reached the specified trading level. If there is no rebate, this field is "".
category String Category
normal
uTime String Update time, Unix timestamp format in milliseconds, e.g. 1597026383085
cTime String Creation time, Unix timestamp format in milliseconds, e.g. 1597026383085

Get order history (last 7 days)

Retrieve the completed order data for the last 7 days, and the incomplete orders that have been canceled are only reserved for 2 hours.

Rate Limit: 40 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/trade/orders-history

Request Example

GET /api/v5/trade/orders-history?ordType=post_only,fok,ioc&instType=SPOT

Request Parameters

Parameter Type Required Description
instType String yes Instrument type
SPOT
instId String No Instrument ID, e.g. BTC-USD
ordType String No Order type
market: market order
limit: limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
state String No State
canceled
filled
after String No Pagination of data to return records earlier than the requested ordId
before String No Pagination of data to return records newer than the requested ordId
limit String No Number of results per request. The maximum is 100; The default is 100

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "instType": "SPOT",
      "instId": "BTC-USD",
      "ccy": "",
      "ordId": "312269865356374016",
      "clOrdId": "b1",
      "tag": "",
      "px": "999",
      "sz": "3",
      "ordType": "limit",
      "side": "buy",
      "posSide": "net",
      "tdMode": "cash",
      "accFillSz": "0",
      "fillPx": "0",
      "tradeId": "0",
      "fillSz": "0",
      "fillTime": "0",
      "state": "filled",
      "avgPx": "0",
      "lever": "",
      "tpTriggerPx": "",
      "tpTriggerPxType": "last",
      "tpOrdPx": "",
      "slTriggerPx": "",
      "slTriggerPxType": "last",
      "slOrdPx": "",
      "feeCcy": "",
      "fee": "",
      "rebateCcy": "",
      "source":"",
      "rebate": "",
      "tgtCcy":"",
      "pnl": "",
      "category": "",
      "uTime": "1597026383085",
      "cTime": "1597026383085"
    }
  ]
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
ccy String Margin currency. Not enabled. Please disregard.
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
tag String Order tag
px String Price
sz String Quantity to buy or sell
ordType String Order type
market: market order
limit: limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
side String Order side
posSide String Position side. Not enabled. Please disregard.
tdMode String Trade mode
accFillSz String Accumulated fill quantity
fillPx String Last filled price. If none is filled, it will return 0.
tradeId String Last trade ID
fillSz String Last filled quantity
fillTime String Last filled time
avgPx String Average filled price. If none is filled, it will return 0.
state String State
canceled
filled
lever String Leverage. Not enabled. Please disregard.
tpTriggerPx String Take-profit trigger price.
tpTriggerPxType String Take-profit trigger price type.
last: last price
tpOrdPx String Take-profit order price.
slTriggerPx String Stop-loss trigger price.
slTriggerPxType String Stop-loss trigger price type.
last: last price
slOrdPx String Stop-loss order price.
feeCcy String Fee currency
fee String Fee and rebate
For spot, it is accumulated fee charged by the platform. It is always negative, e.g. -0.01.
rebateCcy String Rebate currency
source String Order source
13:The generated limit order after the strategy order is triggered
rebate String Rebate amount, only applicable to spot, the reward of placing orders from the platform (rebate) given to user who has reached the specified trading level. If there is no rebate, this field is "".
pnl String Profit and loss. Not enabled. Please disregard.
category String Category
normal
uTime String Update time, Unix timestamp format in milliseconds, e.g. 1597026383085
cTime String Creation time, Unix timestamp format in milliseconds, e.g. 1597026383085

Get order history (last 3 months)

Retrieve the completed order data of the last 3 months.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/trade/orders-history-archive

Request Example

GET /api/v5/trade/orders-history-archive?ordType=post_only,fok,ioc&instType=SPOT

Request Parameters

Parameter Type Required Description
instType String yes Instrument type
SPOT
instId String No Instrument ID, e.g. BTC-USD
ordType String No Order type
market: Market order
limit: Limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
state String No State
canceled
filled
after String No Pagination of data to return records earlier than the requested ordId
before String No Pagination of data to return records newer than the requested ordId
limit String No Number of results per request. The maximum is 100; The default is 100

Response Example

{
    "code": "0",
    "data": [
        {
            "accFillSz": "1.6342",
            "avgPx": "0.9995",
            "cTime": "1672814726198",
            "category": "normal",
            "ccy": "",
            "clOrdId": "",
            "fee": "-0.00245007435",
            "feeCcy": "USD",
            "fillPx": "0.9995",
            "fillSz": "1.6342",
            "fillTime": "1672814726201",
            "instId": "USDT-USD",
            "instType": "SPOT",
            "lever": "",
            "ordId": "530758662663180288",
            "ordType": "market",
            "pnl": "0",
            "posSide": "",
            "px": "",
            "rebate": "0",
            "rebateCcy": "USDT",
            "reduceOnly": "false",
            "side": "sell",
            "slOrdPx": "",
            "slTriggerPx": "",
            "slTriggerPxType": "",
            "source": "",
            "state": "filled",
            "sz": "1.6342",
            "tag": "",
            "tdMode": "cash",
            "tgtCcy": "base_ccy",
            "tpOrdPx": "",
            "tpTriggerPx": "",
            "tpTriggerPxType": "",
            "tradeId": "3225651",
            "uTime": "1672814726859"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
ccy String Margin currency. Not enabled. Please disregard.
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
tag String Order tag
px String Price
sz String Quantity to buy or sell
ordType String Order type
market: Market order
limit: Limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
side String Order side
posSide String Position side. Not enabled. Please disregard.
tdMode String Trade mode
accFillSz String Accumulated fill quantity
fillPx String Last filled price. If none is filled, it will return 0.
tradeId String Last trade ID
fillSz String Last filled quantity
fillTime String Last filled time
avgPx String Average filled price. If none is filled, it will returns 0.
state String State
canceled
filled
lever String Leverage. Not enabled. Please disregard.
tpTriggerPx String Take-profit trigger price.
tpTriggerPxType String Take-profit trigger price type.
last: last price
tpOrdPx String Take-profit order price.
slTriggerPx String Stop-loss trigger price.
slTriggerPxType String Stop-loss trigger price type.
last: last price
slOrdPx String Stop-loss order price.
feeCcy String Fee currency
fee String Fee and rebate
For spot, it is accumulated fee charged by the platform. It is always negative, e.g. -0.01.
source String Order source
13:The generated limit order after the strategy order is triggered
rebateCcy String Rebate currency
rebate String Rebate amount, only applicable to spot, the reward of placing orders from the platform (rebate) given to user who has reached the specified trading level. If there is no rebate, this field is "".
pnl String Profit and loss. Not enabled. Please disregard.
category String Category
normal
uTime String Update time, Unix timestamp format in milliseconds, e.g. 1597026383085
cTime String Creation time, Unix timestamp format in milliseconds, e.g. 1597026383085

Get transaction details (last 3 days)

Retrieve recently-filled transaction details in the last 3 day.

Rate Limit: 60 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/trade/fills

Request Example

GET /api/v5/trade/fills

Request Parameters

Parameter Type Required Description
instType String No Instrument type
SPOT
instId String No Instrument ID, e.g. BTC-USD
ordId String No Order ID
after String No Pagination of data to return records earlier than the requested billId
before String No Pagination of data to return records newer than the requested billId
begin String No Filter with a begin timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085
end String No Filter with an end timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085
limit String No Number of results per request. The maximum is 100; The default is 100

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "instType": "SPOT",
      "instId": "BTC-USD",
      "tradeId": "123",
      "ordId": "312269865356374016",
      "clOrdId": "b16",
      "billId": "1111",
      "tag": "",
      "fillPx": "999",
      "fillSz": "3",
      "side": "buy",
      "posSide": "net",
      "execType": "M",
      "feeCcy": "",
      "fee": "",
      "ts": "1597026383085"
    },
    {
      "instType": "SPOT",
      "instId": "BTC-USD",
      "tradeId": "123",
      "ordId": "312269865356374016",
      "clOrdId": "b16",
      "billId": "1111",
      "tag": "",
      "fillPx": "999",
      "fillSz": "3",
      "side": "buy",
      "posSide": "net",
      "execType": "M",
      "feeCcy": "",
      "fee": "",
      "ts": "1597026383085"
    }
  ]
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
tradeId String Last trade ID
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
billId String Bill ID
tag String Order tag
fillPx String Last filled price
fillSz String Last filled quantity
side String Order side, buy sell
posSide String Position side. Not enabled. Please disregard.
execType String Liquidity taker or maker, T: taker M: maker
feeCcy String Fee currency
fee String Fee
ts String Data generation time, Unix timestamp format in milliseconds, e.g. 1597026383085.

Get transaction details (last 3 months)

Retrieve recently-filled transaction details in the last 3 months.

Rate Limit: 10 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/trade/fills-history

Request Example

GET /api/v5/trade/fills-history

Request Parameters

Parameter Type Required Description
instType String YES Instrument type
SPOT
instId String No Instrument ID, e.g. BTC-USD
ordId String No Order ID
after String No Pagination of data to return records earlier than the requested billId
before String No Pagination of data to return records newer than the requested billId
begin String No Filter with a begin timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085
end String No Filter with an end timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085
limit String No Number of results per request. The maximum is 100; The default is 100

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "instType": "SPOT",
      "instId": "BTC-USD",
      "tradeId": "123",
      "ordId": "312269865356374016",
      "clOrdId": "b16",
      "billId": "1111",
      "tag": "",
      "fillPx": "999",
      "fillSz": "3",
      "side": "buy",
      "posSide": "net",
      "execType": "M",
      "feeCcy": "",
      "fee": "",
      "ts": "1597026383085"
    },
    {
      "instType": "SPOT",
      "instId": "BTC-USD",
      "tradeId": "123",
      "ordId": "312269865356374016",
      "clOrdId": "b16",
      "billId": "1111",
      "tag": "",
      "fillPx": "999",
      "fillSz": "3",
      "side": "buy",
      "posSide": "net",
      "execType": "M",
      "feeCcy": "",
      "fee": "",
      "ts": "1597026383085"
    }
  ]
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
tradeId String Last trade ID
ordId String Order ID
clOrdId String Client Order ID as assigned by the client
billId String Bill ID
tag String Order tag
fillPx String Last filled price
fillSz String Last filled quantity
side String Order side, buy sell
posSide String Position side. Not enabled. Please disregard.
execType String Liquidity taker or maker, T: taker M: maker
feeCcy String Fee currency
fee String Fee
ts String Data generation time, Unix timestamp format in milliseconds, e.g. 1597026383085.

Place algo order

The algo order includes trigger order, oco order, conditional order,iceberg order, twap order and trailing order.

Rate Limit: 20 requests per 2 seconds

Derivatives rate limit rule: UserID + (instrumentType + underlying)

Spot & Margin rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/order-algo

Request Example

POST /api/v5/trade/order-algo
body
{
    "instId":"BTC-USDT",
    "tdMode":"cash",
    "side":"buy",
    "ordType":"conditional",
    "sz":"2",
    "tpTriggerPx":"15",
    "tpOrdPx":"18"
}

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
tdMode String Yes Trade mode
Non-Margin mode cash
side String Yes Order side, buy sell
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order
move_order_stop: Trailing order
iceberg: Iceberg order
twap: TWAP order
sz String Yes Quantity to buy or sell
tag String No Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
tgtCcy String No Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT traded with Market buy conditional order
Default is quote_ccy for buy, base_ccy for sell
clOrdId String No Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

Stop Order

Parameter Type Required Description
tpTriggerPx String No Take-profit trigger price
If you fill in this parameter, you should fill in the take-profit order price as well.
tpTriggerPxType String No Take-profit trigger price type

last: last price
The Default is last
tpOrdPx String No Take-profit order price
If you fill in this parameter, you should fill in the take-profit trigger price as well.
If the price is -1, take-profit will be executed at the market price.
slTriggerPx String No Stop-loss trigger price
If you fill in this parameter, you should fill in the stop-loss order price.
slTriggerPxType String No Stop-loss trigger price type

last: last price
The Default is last
slOrdPx String No Stop-loss order price
If you fill in this parameter, you should fill in the stop-loss trigger price.
If the price is -1, stop-loss will be executed at the market price.

Trigger Order

Parameter Type Required Description
triggerPx String Yes Trigger price
orderPx String Yes Order Price
If the price is -1, the order will be executed at the market price.
triggerPxType String No Trigger price type

last: last price
The Default is last

Trailing Stop Order

Parameter Type Required Description
callbackRatio String Conditional Callback price ratio , e.g. 0.01

Either callbackRatio or callbackSpread is allowed to be passed.
callbackSpread String Conditional Callback price variance
activePx String No Active price

Iceberg Order

Parameter Type Required Description
pxVar String Conditional Price ratio
Either pxVar or pxSpread is allowed to be passed.
pxSpread String Conditional Price variance
szLimit String Yes Average amount
pxLimit String Yes Price Limit

TWAP Order

Parameter Type Required Description
pxVar String Conditional Price ratio
Either pxVar or pxSpread is allowed to be passed.
pxSpread String Conditional Price variance
szLimit String Yes Average amount
pxLimit String Yes Price Limit
timeInterval String Yes Time interval

Learn more about Iceberg Order & TWAP Order

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "algoId": "12345689",
      "clOrdId": "",
      "sCode": "0",
      "sMsg": ""
    }
  ]
}

Response Parameters

Parameter Type Description
algoId String Algo ID
clOrdId String Client Order ID as assigned by the client
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Cancel algo order

Cancel unfilled algo orders (not including Iceberg order, TWAP order, Trailing Stop order). A maximum of 10 orders can be canceled per request. Request parameters should be passed in the form of an array.

Rate Limit: 20 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/cancel-algos

Request Example

POST /api/v5/trade/cancel-algos
body
[
    {
        "algoId":"198273485",
        "instId":"BTC-USD"
    },
    {
        "algoId":"198273485",
        "instId":"BTC-USD"
    }
]

Request Parameters

Parameter Type Required Description
algoId String Yes Algo ID
instId String Yes Instrument ID, e.g. BTC-USD

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "algoId":"1234",
            "sCode":"0",
            "sMsg":""
        }
    ]
}

Response Parameters

Parameter Type Description
algoId String Order ID
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Cancel advance algo order

Cancel unfilled algo orders (including Iceberg order, TWAP order, Trailing Stop order). A maximum of 10 orders can be canceled per request. Request parameters should be passed in the form of an array.

Rate Limit: 20 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

HTTP Request

POST /api/v5/trade/cancel-advance-algos

Request Example

POST /api/v5/trade/cancel-advance-algos
body
[
    {
        "algoId":"198273485",
        "instId":"BTC-USD"
    },
    {
        "algoId":"198273485",
        "instId":"BTC-USD"
    }
]

Request Parameters

Parameter Type Required Description
algoId String Yes Algo ID
instId String Yes Instrument ID, e.g. BTC-USD

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "algoId":"1234",
            "sCode":"0",
            "sMsg":""
        }
    ]
}

Response Parameters

Parameter Type Description
algoId String Order ID
sCode String The code of the event execution result, 0 means success.
sMsg String Rejection message if the request is unsuccessful.

Get algo order list

Retrieve a list of untriggered Algo orders under the current account.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/trade/orders-algo-pending

Request Example

GET /api/v5/trade/orders-algo-pending?ordType=conditional

Request Parameters

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order
move_order_stop: Trailing order
iceberg: Iceberg order
twap: TWAP order
algoId String No Algo ID
clOrdId String No Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
instType String No Instrument type
SPOT
instId String No Instrument ID, e.g. BTC-USD
after String No Pagination of data to return records earlier than the requested algoId.
before String No Pagination of data to return records newer than the requested algoId.
limit String No Number of results per request. The maximum is 100; The default is 100

Response Example

{
    "code": "0",
    "data": [
        {
            "activePx": "",
            "actualPx": "",
            "actualSide": "",
            "actualSz": "0",
            "algoId": "492453578716610560",
            "cTime": "1663682082511",
            "callbackRatio": "",
            "callbackSpread": "",
            "ccy": "",
            "clOrdId": "hahawang",
            "instId": "BTC-USD",
            "instType": "SPOT",
            "lever": "",
            "moveTriggerPx": "",
            "ordId": "0",
            "ordPx": "",
            "ordType": "conditional",
            "posSide": "net",
            "pxLimit": "",
            "pxSpread": "",
            "pxVar": "",
            "side": "buy",
            "slOrdPx": "-1",
            "slTriggerPx": "22000",
            "slTriggerPxType": "last",
            "state": "live",
            "sz": "10",
            "szLimit": "",
            "tag": "",
            "tdMode": "cash",
            "tgtCcy": "",
            "timeInterval": "",
            "tpOrdPx": "",
            "tpTriggerPx": "",
            "tpTriggerPxType": "",
            "triggerPx": "",
            "triggerPxType": "",
            "triggerTime": ""
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
ccy String Margin currency. Not enabled. Please disregard.
ordId String Order ID
algoId String Algo ID
clOrdId String Client Order ID as assigned by the client
sz String Quantity to buy or sell
ordType String Order type
side String Order side
posSide String Position side. Not enabled. Please disregard.
tdMode String Trade mode
tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT traded with Market order
state String State,live pause partially_effective
lever String Leverage. Not enabled. Please disregard.
tpTriggerPx String Take-profit trigger price
tpTriggerPxType String Take-profit trigger price type.
last: last price
tpOrdPx String Take-profit order price
slTriggerPx String Stop-loss trigger price
slTriggerPxType String Stop-loss trigger price type.
last: last price
slOrdPx String Stop-loss order price
triggerPx String Trigger price
triggerPxType String Trigger price type.
last: last price
ordPx String Order price
actualSz String Actual order quantity
tag String Order tag
actualPx String Actual order price
actualSide String Actual trigger side
tp: take profit sl: stop loss
triggerTime String Trigger time, Unix timestamp format in milliseconds, e.g. 1597026383085
pxVar String Price ratio
Only applicable to iceberg order or twap order
pxSpread String Price variance
Only applicable to iceberg order or twap order
szLimit String Average amount
Only applicable to iceberg order or twap order
pxLimit String Price Limit
Only applicable to iceberg order or twap order
timeInterval String Time interval
Only applicable to twap order
callbackRatio String Callback price ratio
Only applicable to move_order_stop order
callbackSpread String Callback price variance
Only applicable to move_order_stop order
activePx String Active price
Only applicable to move_order_stop order
moveTriggerPx String Trigger price
Only applicable to move_order_stop order
cTime String Creation time, Unix timestamp format in milliseconds, e.g. 1597026383085

Get algo order history

Retrieve a list of all algo orders under the current account in the last 3 months.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/trade/orders-algo-history

Request Example

GET /api/v5/trade/orders-algo-history?state=effective&ordType=conditional

Request Parameters

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order
move_order_stop: Trailing order
iceberg: Iceberg order
twap: TWAP order
state String Conditional State
effective
canceled
order_failed
Either state or algoId is requied
algoId String Conditional Algo ID
Either state or algoId is required.
instType String No Instrument type
SPOT
instId String No Instrument ID, e.g. BTC-USD
after String No Pagination of data to return records earlier than the requested algoId
before String No Pagination of data to return records new than the requested algoId
limit String No Number of results per request. The maximum is 100; The default is 100

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "instType":"SPOT",
            "instId":"BTC-USD",
            "ordId":"123445",
            "ccy":"",
            "clOrdId":"",
            "algoId":"1234",
            "sz":"999",
            "ordType":"oco",
            "side":"buy",
            "posSide":"net",
            "tdMode":"cash",
            "tgtCcy": "",
            "state":"effective",
            "lever":"",
            "tpTriggerPx":"",
            "tpTriggerPxType":"",
            "tpOrdPx":"",
            "slTriggerPx":"",
            "slTriggerPxType":"",
            "triggerPx":"99",
            "triggerPxType":"last",
            "ordPx":"12",
            "actualSz":"",
            "actualPx":"",
            "actualSide":"",
            "pxVar":"",
            "pxSpread":"",
            "pxLimit":"",
            "szLimit":"",
            "tag": "adadadadad",
            "timeInterval":"",
            "callbackRatio":"",
            "callbackSpread":"",
            "activePx":"",
            "moveTriggerPx":"",
            "triggerTime":"1597026383085",
            "cTime":"1597026383000"
        },
        {
            "instType":"SPOT",
            "instId":"BTC-USD",
            "ordId":"123445",
            "ccy":"",
            "clOrdId":"",
            "algoId":"1234",
            "sz":"999",
            "ordType":"oco",
            "side":"buy",
            "posSide":"net",
            "tdMode":"cash",
            "tgtCcy": "",
            "state":"effective",
            "lever":"",
            "tpTriggerPx":"",
            "tpTriggerPxType":"",
            "tpOrdPx":"",
            "slTriggerPx":"",
            "slTriggerPxType":"",
            "triggerPx":"99",
            "triggerPxType":"last",
            "ordPx":"12",
            "actualSz":"",
            "actualPx":"",
            "actualSide":"",
            "pxVar":"",
            "pxSpread":"",
            "pxLimit":"",
            "szLimit":"",
            "tag": "adadadadad",
            "timeInterval":"",
            "callbackRatio":"",
            "callbackSpread":"",
            "activePx":"",
            "moveTriggerPx":"",
            "triggerTime":"1597026383085",
            "cTime":"1597026383000"
        }
    ]
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
ccy String Margin currency. Not enabled. Please disregard.
ordId String Order ID
algoId String Algo ID
clOrdId String Client Order ID as assigned by the client
sz String Quantity to buy or sell
ordType String Order type
side String Order side
posSide String Position side. Not enabled. Please disregard.
tdMode String Trade mode
tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
state String State
effective
canceled
order_failed
lever String Leverage. Not enabled. Please disregard.
tpTriggerPx String Take-profit trigger price.
tpTriggerPxType String Take-profit trigger price type.
last: last price
tpOrdPx String Take-profit order price.
slTriggerPx String Stop-loss trigger price.
slTriggerPxType String Stop-loss trigger price type.
last: last price
slOrdPx String Stop-loss order price.
triggerPx String trigger price.
triggerPxType String trigger price type.
last: last price
ordPx String Order price
actualSz String Actual order quantity
actualPx String Actual order price
tag String Order tag
actualSide String Actual trigger side, tp: take profit sl: stop loss
triggerTime String Trigger time, Unix timestamp format in milliseconds, e.g. 1597026383085
pxVar String Price ratio
Only applicable to iceberg order or twap order
pxSpread String Price variance
Only applicable to iceberg order or twap order
szLimit String Average amount
Only applicable to iceberg order or twap order
pxLimit String Price Limit
Only applicable to iceberg order or twap order
timeInterval String Time interval
Only applicable to twap order
callbackRatio String Callback price ratio
Only applicable to move_order_stop order
callbackSpread String Callback price variance
Only applicable to move_order_stop order
activePx String Active price
Only applicable to move_order_stop order
moveTriggerPx String Trigger price
Only applicable to move_order_stop order
cTime String Creation time Unix timestamp format in milliseconds, e.g. 1597026383085

Funding

The API endpoints of Funding require authentication.

Get currencies

Retrieve a list of all currencies.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/currencies

Request Example

GET /api/v5/asset/currencies

Request Parameters

Parameters Types Required Description
ccy String No Single currency or multiple currencies (no more than 20) separated with comma, e.g. BTC or BTC,ETH.

Response Example

{
    "code": "0",
    "data": [
        {
            "canDep": true,
            "canInternal": false,
            "canWd": true,
            "ccy": "EUR",
            "chain": "EUR-fiat",
            "depQuotaFixed": "",
            "depQuoteDailyLayer2": "",
            "logoLink": "https://static.okcoin.com/cdn/assets/imgs/218/3CE0A0023386E9EA.png",
            "mainNet": true,
            "maxFee": "0",
            "maxWd": "1586886",
            "minDep": "0.00000001",
            "minDepArrivalConfirm": "0",
            "minFee": "0",
            "minWd": "0",
            "minWdUnlockConfirm": "0",
            "name": "Euro",
            "needTag": false,
            "usedDepQuotaFixed": "",
            "usedWdQuota": "0",
            "wdQuota": "1000000",
            "wdTickSz": "4"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
ccy String Currency, e.g. BTC
name String Chinese name of currency
logoLink String Logo link of currency
chain String Chain name, e.g. USDT-ERC20, USDT-TRC20, USDT-Omni
canDep Boolean Availability to deposit from chain.
false: not available true: available
canWd Boolean Availability to withdraw to chain.
false: not available true: available
canInternal Boolean Availability to internal transfer.
false: not available true: available
minDep String Minimum deposit amount of the currency in a single transaction
minWd String Minimum withdrawal amount of the currency in a single transaction
maxWd String Maximum amount of currency withdrawal in a single transaction
wdTickSz String Withdrawal precision, indicating the number of digits after the decimal point
wdQuota String Withdrawal limit in the past 24 hours, unit in USD
usedWdQuota String Amount of currency withdrawal used in the past 24 hours, unit in USD
minFee String Minimum withdrawal fee
maxFee String Maximum withdrawal fee
mainNet Boolean If current chain is main net then return true, otherwise return false
needTag Boolean Whether tag/memo information is required for withdrawal
minDepArrivalConfirm String Minimum number of blockchain confirmations to acknowledge fund deposit. Account is credited after that but the deposit cannot be withdrawn
minWdUnlockConfirm String Minimum number of blockchain confirmations required for withdrawal of a deposit
depQuotaFixed String Fixed deposit limit, unit in BTC
Return empty string if there is no deposit limit
usedDepQuotaFixed String Used amount of fixed deposit quota, unit in BTC
Return empty string if there is no deposit limit

Get balance

Retrieve the balances of all the assets and the amount that is available or on hold.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/balances

Request Example

GET /api/v5/asset/balances

Request Parameters

Parameters Types Required Description
ccy String No Single currency or multiple currencies (no more than 20) separated with comma, e.g. BTC or BTC,ETH.

Response Example

{
    "code": "0",
    "msg": "",
    "data": [{
            "availBal": "37.11827078",
            "bal": "37.11827078",
            "ccy": "ETH",
            "frozenBal": "0"
        }
    ]
}

Response Parameters

Parameter Type Description
ccy String Currency
bal String Balance
frozenBal String Frozen balance
availBal String Available balance

Get account asset valuation

View account asset valuation

Rate Limit: 1 request 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/asset-valuation

Request Example

GET /api/v5/asset/asset-valuation

Request Parameters

Parameters Types Required Description
ccy String No Asset valuation calculation unit
BTC
USD, CNY, JP, KRW, RUB, EUR
VND, IDR, INR, PHP, THB, TRY
AUD, SGD, ARS, SAR, AED, IQD
The default is the valuation in BTC.

Response Example

{
    "code": "0",
    "data": [
        {
            "details": {
                "classic": "124.6",
                "earn": "1122.73",
                "funding": "0.09",
                "trading": "2544.28"
            },
            "totalBal": "3790.09",
            "ts": "1637566660769"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
totalBal String Valuation of total account assets
ts String Unix timestamp format in milliseconds, e.g.1597026383085
details Array Asset valuation details for each account
> funding String Funding account
> trading String Unified account
> classic String Classic account
> earn String Earn account

Funds transfer

Only API keys with Trade privilege can call this endpoint.

This endpoint supports the transfer of funds between your funding account and trading account, and from the master account to sub-accounts.

Rate Limit: 1 request per second

Rate limit rule: UserID + Currency

HTTP Request

POST /api/v5/asset/transfer

Request Example

Transfer 1.5 USD from funding account to Trading account when current account is master-account
POST /api/v5/asset/transfer
body
{
    "ccy":"USD",
    "amt":"1.5",
    "from":"6",
    "to":"18"
}

Transfer 1.5 USD from funding account to subAccount when current account is master-account
POST /api/v5/asset/transfer
body
{
    "ccy":"USD",
    "type":"1",
    "amt":"1.5",
    "from":"6",
    "to":"6",
    "subAcct":"mini"
}

Request Parameters

Parameter Type Required Description
ccy String Yes Currency, e.g. USD
amt String Yes Amount to be transferred
from String Yes The remitting account
1: Classic account 6: Funding account, 18: Unified account
to String Yes The beneficiary account
1: Classic account 6: Funding account, 18: Unified account
subAcct String Conditional Name of the sub-account
When type is 1 or 2, sub-account is required.
type String No Transfer type
0: transfer within account
1: master account to sub-account (Only applicable to APIKey from master account)
2: sub-account to master account (Only applicable to APIKey from master account)
3: sub-account to master account (Only applicable to APIKey from sub-account)
The default is 0.
clientId String No Client-supplied ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "transId": "754147",
      "ccy": "USD",
      "clientId": "",
      "from": "6",
      "amt": "0.1",
      "to": "18"
    }
  ]
}

Response Parameters

Response Example

Parameter Type Description
transId String Transfer ID
clientId String Client-supplied ID
ccy String Currency
from String The remitting account
amt String Transfer amount
to String The beneficiary account

Get funds transfer state

Retrieve the transfer state data of the last 2 weeks.

Rate Limit: 1 request per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/transfer-state

Request Example

GET /api/v5/asset/transfer-state?transId=1&type=1

Request Parameters

Parameter Type Required Description
transId String Conditional Transfer ID
Either transId or clientId is required. If both are passed, transId will be used.
clientId String Conditional Client-supplied ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
type String No Transfer type
0: transfer within account
1: master account to sub-account (Only applicable to APIKey from master account)
2: sub-account to master account (Only applicable to APIKey from master account)
3: sub-account to master account (Only applicable to APIKey from sub-account)
The default is 0

Response Example

{
    "code": "0",
    "data": [
        {
            "amt": "1.5",
            "ccy": "USDT",
            "clientId": "",
            "from": "18",
            "instId": "", //deprecated
            "state": "success",
            "subAcct": "test",
            "to": "6",
            "toInstId": "", //deprecated
            "transId": "1",
            "type": "1"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
transId String Transfer ID
clientId String Client-supplied ID
ccy String Currency, e.g. USDT
amt String Amount to be transferred
type String Transfer type
0: transfer within account
1: master account to sub-account (Only applicable to APIKey from master account)
2: sub-account to master account (Only applicable to APIKey from master account)
3: sub-account to master account (Only applicable to APIKey from sub-account)
from String The remitting account
6: Funding account 18: Unified account
to String The beneficiary account
6: Funding account 18: Unified account
subAcct String Name of the sub-account
instId String deprecated
toInstId String deprecated
state String Transfer state
success, pending, failed

Asset bills details

Query the billing record. You can get the latest 1 month historical data.

Rate Limit: 6 Requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/bills

Request Example

GET /api/v5/asset/bills

GET /api/v5/asset/bills?type=1

Request Parameters

Parameter Type Required Description
ccy String No Currency
type String No Bill type
1: Deposit
2: Withdrawal
13: Canceled withdrawal
20: Transfer to sub account
21: Transfer from sub account
22: Transfer out from sub to master account
23: Transfer in from master to sub account
37: Transfer to spot
38: Transfer from spot
clientId String No Client-supplied ID for transfer or withdrawal
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
after String No Pagination of data to return records earlier than the requested ts, Unix timestamp format in milliseconds, e.g. 1597026383085
before String No Pagination of data to return records newer than the requested ts, Unix timestamp format in milliseconds, e.g. 1597026383085
limit String No Number of results per request. The maximum is 100. The default is 100.

Response Example

{
    "code": "0",
    "msg": "",
    "data": [{
        "billId": "12344",
        "ccy": "BTC",
        "clientId": "",
        "balChg": "2",
        "bal": "12",
        "type": "1",
        "ts": "1597026383085"
    }]
}

Response Parameters

Parameter Type Description
billId String Bill ID
ccy String Account balance currency
clientId String Client-supplied ID for transfer or withdrawal
balChg String Change in balance at the account level
bal String Balance at the account level
type String Bill type
ts String Creation time, Unix timestamp format in milliseconds, e.g.1597026383085

Lightning deposits

Users can create up to 10,000 different invoices within 24 hours.

Rate Limit: 2 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/deposit-lightning

Request Example

GET /api/v5/asset/deposit-lightning?ccy=BTC&amt=0.01

Request Parameters

Parameter Type Required Description
ccy String Yes Token symbol. Currently only BTC is supported.
amt String Yes Deposit amount between 0.000001 - 0.1
to String No Receiving account
6: Funding account
18: Unified account
If empty, will default to funding account.

Response Example

{
    "code": "0",
    "data": [
        {
            "cTime": "1631171307612",
            "invoice": "lnbc100u1psnnvhtpp5yq2x3q5hhrzsuxpwx7ptphwzc4k4wk0j3stp0099968m44cyjg9sdqqcqzpgxqzjcsp5hzzdszuv6yv6yw5svctl8kc8uv6y77szv5kma2kuculj86tk3yys9qyyssqd8urqgcensh9l4zwlwr3lxlcdqrlflvvlwldutm6ljx486h7lylqmd06kky6scas7warx69sregzrx20ffmsr4sp865x3wasrjd8ttgqrlx3tr"
        }
    ],
    "msg": ""
}

Response Example

Parameter Type Description
invoice String Invoice text
cTime String Invoice creation time

Get deposit address

Retrieve the deposit addresses of currencies, including previously-used addresses.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/deposit-address

Request Example

GET /api/v5/asset/deposit-address?ccy=BTC

Request Parameters

Parameter Type Required Description
ccy String Yes Currency, e.g. BTC

Response Example

{
    "code": "0",
    "data": [
        {
            "chain": "BTC-Bitcoin",
            "ctAddr": "",
            "ccy": "BTC",
            "to": "6",
            "addr": "39XNxK1Ryqgg3Bsyn6HzoqV4Xji25pNkv6",
            "selected": true
        },
        {
            "chain": "BTC-OKC",
            "ctAddr": "",
            "ccy": "BTC",
            "to": "6",
            "addr": "0x66d0edc2e63b6b992381ee668fbcb01f20ae0428",
            "selected": true
        },
        {
            "chain": "BTC-ERC20",
            "ctAddr": "5807cf",
            "ccy": "BTC",
            "to": "6",
            "addr": "0x66d0edc2e63b6b992381ee668fbcb01f20ae0428",
            "selected": true
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
addr String Deposit address
tag String Deposit tag (This will not be returned if the currency does not require a tag for deposit)
memo String Deposit memo (This will not be returned if the currency does not require a payment_id for deposit)
pmtId String Deposit payment ID (This will not be returned if the currency does not require a payment_id for deposit)
addrEx Object Deposit address attachment (This will not be returned if the currency does not require this)
e.g. TONCOIN attached tag name is comment, the return will be {'comment':'123456'}
ccy String Currency, e.g. BTC
chain String Chain name, e.g. USDT-ERC20, USDT-TRC20, USDT-Omni
to String The beneficiary account
6: Funding account 18: Trading account
selected Boolean Return true if the current deposit address is selected by the website page
ctAddr String Last 6 digits of contract address

Get deposit history

Retrieve the deposit records according to the currency, deposit status, and time range in reverse chronological order. The 100 most recent records are returned by default.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/deposit-history

Request Example


GET /api/v5/asset/deposit-history

Query deposit history from 2022-06-01 to 2022-07-01
GET /api/v5/asset/deposit-history?ccy=BTC&after=1654041600000&before=1656633600000

Request Parameters

Parameter Type Required Description
ccy String No Currency, e.g. BTC
depId String No Deposit ID
txId String No Hash record of the deposit
type String No Deposit Type
3: internal transfer
4: deposit from chain
state String No Status of deposit
0: waiting for confirmation
1: deposit credited
2: deposit successful
8: pending due to temporary deposit suspension on this crypto currency
12: account or deposit is frozen
13: sub-account deposit interception
after String No Pagination of data to return records earlier than the requested ts, Unix timestamp format in milliseconds, e.g. 1654041600000
before String No Pagination of data to return records newer than the requested ts, Unix timestamp format in milliseconds, e.g. 1656633600000
limit string No Number of results per request. The maximum is 100; The default is 100

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "actualDepBlkConfirm": "17",
      "amt": "135.705808",
      "ccy": "USDT",
      "chain": "USDT-TRC20",
      "depId": "34579090",
      "from": "",
      "state": "2",
      "to": "TN4hxxxxxxxxxxxizqs",
      "ts": "1655251200000",
      "txId": "16f36383292f451xxxxxxxxxxxxxxx584f3391642d988f97"
    }
  ]
}

Response Parameters

Parameter Type Description
ccy String Currency
chain String Chain name
amt String Deposit amount
from String Only the internal Okcoin account is returned, not the address on the blockchain.
to String Deposit address
txId String Hash record of the deposit
ts String Time that the deposit is credited, Unix timestamp format in milliseconds, e.g. 1655251200000
state String Status of deposit
0: waiting for confirmation
1: deposit credited
2: deposit successful
8: pending due to temporary deposit suspension on this crypto currency
12: account or deposit is frozen
13: sub-account deposit interception
depId String Deposit ID
actualDepBlkConfirm String Actual amount of blockchain confirm in a single deposit

Withdrawal

Withdrawal of tokens. Sub-account does not support withdrawal.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

POST /api/v5/asset/withdrawal

Request Example

POST /api/v5/asset/withdrawal
body
{
    "amt":"1",
    "fee":"0.0005",
    "dest":"4",
    "ccy":"BTC",
    "chain":"BTC-Bitcoin",
    "toAddr":"17DKe3kkkkiiiiTvAKKi2vMPbm1Bz3CMKw"
}

Request Parameters

Parameter Type Required Description
ccy String Yes Currency, e.g. USD
amt String Yes Withdrawal amount
dest String Yes Withdrawal method
3: internal
4: on chain
toAddr String Yes If your dest is 4,toAddr should be a trusted crypto currency address. Some crypto currency addresses are formatted as 'address:tag', e.g. 'ARDOR-7JF3-8F2E-QUWZ-CAN7F:123456'
If your dest is 3,toAddr should be a recipient address which can be email, phone or login account name.
fee String Yes Transaction fee
chain String Conditional Chain name
There are multiple chains under some currencies, such as USDT has USDT-ERC20, USDT-TRC20, and USDT-Omni.
If the parameter is not filled in, the default will be the main chain.
clientId String No Client-supplied ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

Response Example

{
    "code": "0",
    "msg": "",
    "data": [{
        "amt": "0.1",
        "wdId": "67485",
        "ccy": "BTC",
        "clientId": "",
        "chain": "BTC-Bitcoin"
    }]
}

Response Parameters

Parameter Type Description
ccy String Currency
chain String Chain name, e.g. USDT-ERC20, USDT-TRC20, USDT-Omni
amt String Withdrawal amount
wdId String Withdrawal ID
clientId String Client-supplied ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

Lightning withdrawals

The maximum withdrawal amount is 0.1 BTC per request, and 1 BTC in 24 hours. The minimum withdrawal amount is approximately 0.000001 BTC. Sub-account does not support withdrawal.

Rate Limit: 2 requests per second

Rate limit rule: UserID

HTTP Request

POST /api/v5/asset/withdrawal-lightning

Request Example

POST /api/v5/asset/withdrawal-lightning
body
{
    "ccy":"BTC",
    "invoice":"lnbc100u1psnnvhtpp5yq2x3q5hhrzsuxpwx7ptphwzc4k4wk0j3stp0099968m44cyjg9sdqqcqzpgxqzjcsp5hz"
}

Request Parameters

Parameter Type Required Description
ccy String Yes Token symbol. Currently only BTC is supported.
invoice String Yes Invoice text
memo String No Lightning withdrawal memo

Response Example

{
        "code": "0",
        "msg": "",
        "data": [{
                "wdId": "121212",
                "cTime": "1597026383085"
        }]
}

Response Parameters

Parameter Type Description
wdId String Withdrawal ID
cTime String Withdrawal ID creation time

Cancel withdrawal

You can cancel normal withdrawal requests, but you cannot cancel withdrawal requests on Lightning.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

POST /api/v5/asset/cancel-withdrawal

Request Example

POST /api/v5/asset/cancel-withdrawal
body {
   "wdId":"1123456"
}

Request Parameters

Parameter Type Required Description
wdId String Yes Withdrawal ID

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "wdId": "1123456"   
    }
  ]
}

Response Parameters

Parameter Type Description
wdId String Withdrawal ID

Get withdrawal history

Retrieve the withdrawal records according to the currency, withdrawal status, and time range in reverse chronological order. The 100 most recent records are returned by default.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/asset/withdrawal-history

Request Example


GET /api/v5/asset/withdrawal-history

Query withdrawal history from 2022-06-01 to 2022-07-01
GET /api/v5/asset/withdrawal-history?ccy=BTC&after=1654041600000&before=1656633600000

Request Parameters

Parameter Type Required Description
ccy String No Currency, e.g. BTC
wdId String No Withdrawal ID
clientId String No Client-supplied ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
txId String No Hash record of the deposit
type String No Withdrawal type
3: internal transfer
4: withdrawal to chain
state String No Status of withdrawal
-3: pending cancel -2: canceled -1: failed
0: pending 1:sending 2: sent
3: awaiting email verification
4: awaiting manual verification
5: awaiting identity verification
after String No Pagination of data to return records earlier than the requested ts, Unix timestamp format in milliseconds, e.g. 1654041600000
before String No Pagination of data to return records newer than the requested ts, Unix timestamp format in milliseconds, e.g. 1656633600000
limit String No Number of results per request. The maximum is 100; The default is 100

Response Example

{
  "code": "0",
  "msg": "",
  "data": [
    {
      "chain": "ETH-Ethereum",
      "fee": "0.007",
      "ccy": "ETH",
      "clientId": "",
      "amt": "0.029809",
      "txId": "0x35c******b360a174d",
      "from": "156****359",
      "to": "0xa30d1fab********7CF18C7B6C579",
      "state": "2",
      "ts": "1655251200000",
      "wdId": "15447421"
    }
  ]
}

Response Parameters

Parameter Type Description
ccy String Currency
chain String Chain name, e.g. USDT-ERC20, USDT-TRC20, USDT-Omni
amt String Token amount
ts String Time the withdrawal request was submitted, Unix timestamp format in milliseconds, e.g. 1655251200000.
from String Remitting address
User account ID will be shown for Okcoin addresses.
to String Receiving address
tag String Some currencies require a tag for withdrawals. This is not returned if not required.
pmtId String Some currencies require a payment ID for withdrawals. This is not returned if not required.
memo String Some currencies require this parameter for withdrawals. This is not returned if not required.
addrEx Object Withdrawal address attachment (This will not be returned if the currency does not require this) e.g. TONCOIN attached tag name is comment, the return will be {'comment':'123456'}
txId String Hash record of the withdrawal.
This parameter will returned "" for internal transfers.
fee String Withdrawal fee
state String Status of withdrawal
-3: pending cancel -2: canceled -1: failed
0: pending 1:sending 2: sent
3: awaiting email verification
4: awaiting manual verification
5: awaiting identity verification
wdId String Withdrawal ID
clientId String Client-supplied ID

Account

The API endpoints of Account require authentication.

Get balance

Retrieve a list of assets (with non-zero balance), remaining balance, and available amount in the trading account.

Rate Limit: 10 requests per 2 seconds

Rate limit rule: UserID

HTTP Requests

GET /api/v5/account/balance

Request Example

Get the balance of all assets in the account
GET /api/v5/account/balance

Get the balance of BTC and ETH assets in the account
GET /api/v5/account/balance?ccy=BTC,ETH

Request Parameters
Parameters Types Required Description
ccy String No Single currency or multiple currencies (no more than 20) separated with comma, e.g. BTC or BTC,ETH.

Response Example

{
    "code": "0",
    "data": [
        {
            "adjEq": "",
            "details": [
                {
                    "availBal": "1.63427",
                    "availEq": "",
                    "cashBal": "1.63427",
                    "ccy": "USD",
                    "crossLiab": "",
                    "disEq": "0",
                    "eq": "1.63427",
                    "eqUsd": "1.63427",
                    "fixedBal": "0",
                    "frozenBal": "0",
                    "interest": "",
                    "isoEq": "",
                    "isoLiab": "",
                    "isoUpl": "",
                    "liab": "",
                    "maxLoan": "",
                    "mgnRatio": "",
                    "notionalLever": "",
                    "ordFrozen": "0",
                    "spotInUseAmt": "",
                    "stgyEq": "0",
                    "twap": "0",
                    "uTime": "1672814264380",
                    "upl": "",
                    "uplLiab": ""
                }
            ],
            "imr": "",
            "isoEq": "",
            "mgnRatio": "",
            "mmr": "",
            "notionalUsd": "",
            "ordFroz": "",
            "totalEq": "1.63427",
            "uTime": "1672814275772"
        }
    ],
    "msg": ""
}
Response Parameters
Parameters Types Description
uTime String Update time of account information, millisecond format of Unix timestamp, e.g. 1597026383085
totalEq String Total equity in USD
isoEq String Isolated margin equity in USD. Not enabled. Please disregard.
adjEq String Adjusted / Effective equity in USD . Not enabled. Please disregard.
ordFroz String Cross margin frozen for pending orders in USD. Not enabled. Please disregard.
imr String Frozen equity for open positions and pending orders in USD. Not enabled. Please disregard.
mmr String Maintenance margin requirement in USD. Not enabled. Please disregard.
mgnRatio String Margin ratio in USD. Not enabled. Please disregard.
notionalUsd String Notional value of positions in USD. Not enabled. Please disregard.
details Array Detailed asset information in all currencies
> ccy String Currency
> eq String Equity of the currency
> cashBal String Cash balance
> uTime String Update time of currency balance information, Unix timestamp format in milliseconds, e.g. 1597026383085
> isoEq String Isolated margin equity of the currency. Not enabled. Please disregard.
> availEq String Available equity of the currency . Not enabled. Please disregard.
> disEq String Discount equity of the currency in USD.
> availBal String Available balance of the currency
> frozenBal String Frozen balance of the currency
> ordFrozen String Margin frozen for open orders
> liab String Liabilities of the currency. Not enabled. Please disregard.
> upl String Unrealized profit and loss of the currency. Not enabled. Please disregard.
> uplLiab String Liabilities due to Unrealized loss of the currency. Not enabled. Please disregard.
> crossLiab String Cross liabilities of the currency. Not enabled. Please disregard.
> isoLiab String Isolated liabilities of the currency. Not enabled. Please disregard.
> mgnRatio String Margin ratio of the currency. Not enabled. Please disregard.
> interest String Interest of the currency. Not enabled. Please disregard.
> twap String Risk indicator of auto liability repayment. Not enabled. Please disregard.
> maxLoan String Max loan of the currency. Not enabled. Please disregard.
> eqUsd String Equity in USD of the currency
> notionalLever String Leverage of the currency. Not enabled. Please disregard.
> stgyEq String Strategy equity
> isoUpl String Isolated unrealized profit and loss of the currency. Not enabled. Please disregard.
> spotInUseAmt String Spot in use amount. Not enabled. Please disregard.

Distribution of applicable fields are as follows:

Parameters Simple
uTime Yes
totalEq Yes
isoEq
adjEq
ordFroz
imr
mmr
mgnRatio
notionalUsd
details
> ccy Yes
> eq Yes
> cashBal Yes
> uTime Yes
> isoEq
> availEq
> disEq Yes
> availBal Yes
> frozenBal Yes
> ordFrozen Yes
> liab
> upl
> uplLiab
> crossLiab
> isoLiab
> mgnRatio
> interest
> twap
> maxLoan
> eqUsd Yes
> notionalLever
> stgyEq Yes
> isoUpl

Get bills details (last 7 days)

Retrieve the bills of the account. The bill refers to all transaction records that result in changing the balance of an account. Pagination is supported, and the response is sorted with the most recent first. This endpoint can retrieve data from the last 7 days.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/account/bills

Request Example

GET /api/v5/account/bills

Request Parameters

Parameter Type Required Description
instType String No Instrument type
SPOT
ccy String No Bill currency
type String No Bill type
1: Transfer 2: Trade
subType String No Bill subtype
1: Buy 2: Sell 11: Transfer in 12: Transfer out
after String No Pagination of data to return records earlier than the requested bill ID.
before String No Pagination of data to return records newer than the requested bill ID.
begin String No Filter with a begin timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085
end String No Filter with an end timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085
limit String No Number of results per request. The maximum is 100. The default is 100.

Response Example

{
    "code": "0",
    "data": [
        {
            "bal": "1.63093282565",
            "balChg": "1.63093282565",
            "billId": "530758662684151809",
            "ccy": "USD",
            "execType": "T",
            "fee": "-0.00245007435",
            "from": "",
            "instId": "USDT-USD",
            "instType": "SPOT",
            "mgnMode": "cash",
            "notes": "",
            "ordId": "530758662663180288",
            "pnl": "0",
            "posBal": "0",
            "posBalChg": "0",
            "subType": "1",
            "sz": "1.6333829",
            "to": "",
            "ts": "1672814726203",
            "type": "2"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
instType String Instrument type
billId String Bill ID
type String Bill type
subType String Bill subtype
ts String Creation time, Unix timestamp format in milliseconds, e.g.1597026383085
balChg String Change in balance amount at the account level
posBalChg String Change in balance amount at the position level. Not enabled. Please disregard.
bal String Balance at the account level
posBal String Balance at the position level. Not enabled. Please disregard.
sz String Quantity
ccy String Account balance currency
pnl String Profit and loss. Not enabled. Please disregard.
fee String Fee
Negative number represents the user transaction fee charged by the platform.
Positive number represents rebate.
mgnMode String Margin mode. Not enabled. Please disregard.
instId String Instrument ID, e.g. BTC-USD
ordId String Order ID
When bill type is not trade, the field returns ""
execType String Liquidity taker or maker, T:taker M:maker
from String The remitting account
6: FUNDING 18: Trading account
Only applicable to transfer. When bill type is not transfer, the field returns "".
to String The beneficiary account
6: FUNDING 18: Trading account
Only applicable to transfer. When bill type is not transfer, the field returns "".
notes String Notes
Only applicable to transfer. When bill type is not transfer, the field returns "".

Get bills details (last 3 months)

Retrieve the account’s bills. The bill refers to all transaction records that result in changing the balance of an account. Pagination is supported, and the response is sorted with most recent first. This endpoint can retrieve data from the last 3 months.

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/account/bills-archive

Request Example

GET /api/v5/account/bills-archive

Request Parameters

Parameter Type Required Description
instType String No Instrument type
SPOT
ccy String No Bill currency
type String No Bill type
1: Transfer 2: Trade
subType String No Bill subtype
1: Buy 2: Sell 11: Transfer in 12: Transfer out
after String No Pagination of data to return records earlier than the requested bill ID.
before String No Pagination of data to return records newer than the requested bill ID.
begin String No Filter with a begin timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085
end String No Filter with an end timestamp. Unix timestamp format in milliseconds, e.g. 1597026383085
limit String No Number of results per request. The maximum is 100. The default is 100.

Response Example

{
    "code": "0",
    "data": [
        {
            "bal": "1.63093282565",
            "balChg": "1.63093282565",
            "billId": "530758662684151809",
            "ccy": "USD",
            "execType": "T",
            "fee": "-0.00245007435",
            "from": "",
            "instId": "USDT-USD",
            "instType": "SPOT",
            "mgnMode": "cash",
            "notes": "",
            "ordId": "530758662663180288",
            "pnl": "0",
            "posBal": "0",
            "posBalChg": "0",
            "subType": "1",
            "sz": "1.6333829",
            "to": "",
            "ts": "1672814726203",
            "type": "2"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
instType String Instrument type
billId String Bill ID
type String Bill type
subType String Bill subtype
ts String Creation time, Unix timestamp format in milliseconds, e.g.1597026383085
balChg String Change in balance amount at the account level
posBalChg String Change in balance amount at the position level. Not enabled. Please disregard.
bal String Balance at the account level
posBal String Balance at the position level. Not enabled. Please disregard.
sz String Quantity
ccy String Account balance currency
pnl String Profit and loss. Not enabled. Please disregard.
fee String Fee
Negative number represents the user transaction fee charged by the platform.
Positive number represents rebate.
mgnMode String Margin mode. Not enabled. Please disregard.
instId String Instrument ID, e.g. BTC-USD
ordId String Order ID
When bill type is not trade, the field returns ""
execType String Liquidity taker or maker, T:taker M:maker
from String The remitting account
6: FUNDING 18: Trading account
Only applicable to transfer. When bill type is not transfer, the field returns "".
to String The beneficiary account
6: FUNDING 18: Trading account
Only applicable to transfer. When bill type is not transfer, the field returns "".
notes String Notes
Only applicable to transfer. When bill type is not transfer, the field returns "".

Get account configuration

Retrieve current account configuration.

Rate Limit: 5 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/account/config

Request Example

GET /api/v5/account/config

Request Parameters

none

Response Example

{
    "code": "0",
    "data": [
        {
            "acctLv": "1",
            "autoLoan": false,
            "ctIsoMode": "automatic",
            "greeksType": "PA",
            "level": "Lv1",
            "levelTmp": "",
            "mgnIsoMode": "automatic",
            "posMode": "net_mode",
            "spotOffsetType": "",
            "uid": "1300041872592896"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
uid String Account ID
acctLv String Account level
1: Simple
posMode String Position mode. Not enabled. Please disregard.
autoLoan Boolean Whether to borrow coins automatically. Not enabled. Please disregard.
greeksType String Current display type of Greeks. Not enabled. Please disregard.
level String The user level of the current real trading volume on the platform, e.g Lv1
levelTmp String Temporary experience user level of special users. Not enabled. Please disregard.
ctIsoMode String Contract isolated margin trading settings. Not enabled. Please disregard.
mgnIsoMode String Margin isolated margin trading settings. Not enabled. Please disregard.
spotOffsetType String Risk offset type. Not enabled. Please disregard.

The following table is the relation between the level value and tier displayed on the website

level value Tier displayed on the website
Lv1~Lv5 P0
VIP1 P1
VIP2 P2
VIP3 P3
VIP4 P4
VIP5 P5
VIP6 P6
VIP7 P7
VIP8 P8
VIP9 P9
VIP10 P10

Get maximum buy/sell amount or open amount

Rate Limit: 20 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/account/max-size

Request Example

GET /api/v5/account/max-size?instId=BTC-USD&tdMode=cash

Request Parameters

Parameter Type Required Description
instId String Yes Single instrument or multiple instruments (no more than 5) separated with comma, e.g. BTC-USD
tdMode String Yes Trade mode cash
px String No Price
When the price is not specified, it will be calculated according to the last traded price.
The parameter will be ignored when multiple instruments are specified.

Response Example

{
    "code": "0",
    "data": [
        {
            "ccy": "",
            "instId": "BTC-USD",
            "maxBuy": "0.0000965776484683",
            "maxSell": "0"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
instId String Instrument ID
ccy String Currency used for margin. Not enabled. Please disregard.
maxBuy String SPOT: The maximum quantity in base currency that you can buy
maxSell String SPOT: The maximum quantity in quote currency that you can sell

Get maximum available tradable amount

Rate Limit: 20 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/account/max-avail-size

Request Example

GET /api/v5/account/max-avail-size?instId=BTC-USD&tdMode=cash

Request Parameters

Parameter Type Required Description
instId String Yes Single instrument or multiple instruments (no more than 5) separated with comma, e.g. BTC-USDT,ETH-USDT
tdMode String Yes Trade mode cash

Response Example

{
    "code": "0",
    "data": [
        {
            "availBuy": "1.63093282565",
            "availSell": "0",
            "instId": "BTC-USD"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
instId String Instrument ID
availBuy String Amount available to buy
availSell String Amount available to sell

Get fee rates

Rate Limit: 5 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/account/trade-fee

Request Example

GET /api/v5/account/trade-fee?instType=SPOT

Request Parameters

Parameter Type Required Description
instType String Yes Instrument type
SPOT
instId String No Instrument ID, e.g. BTC-USDT

Response Example

{
    "code": "0",
    "data": [
        {
            "category": "1",
            "delivery": "",
            "exercise": "",
            "instType": "SPOT",
            "level": "Lv1",
            "maker": "-0.001",
            "makerU": "",
            "makerUSDC": "-0.001",
            "taker": "-0.0015",
            "takerU": "",
            "takerUSDC": "-0.0015",
            "ts": "1672825392244"
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
level String Fee rate Level
taker String Taker fee rate
maker String Maker fee rate
takerU String Taker fee rate of USDT-margined contracts. Not enabled. Please disregard.
makerU String Maker fee rate of USDT-margined contracts. Not enabled. Please disregard.
delivery String Delivery fee rate. Not enabled. Please disregard.
exercise String Fee rate for exercising the option. Not enabled. Please disregard.
instType String Instrument type
takerUSDC String Taker fee rate for the USDC trading pairs. Not enabled. Please disregard.
makerUSDC String Maker fee rate for the USDC trading pairs. Not enabled. Please disregard.
ts String Data return time, Unix timestamp format in milliseconds, e.g. 1597026383085
category String Currency category. Note: this parameter is already deprecated

The following table is the relation between the level value and tier displayed on the website

level value Tier displayed on the website
Lv1~Lv5 P0
VIP1 P1
VIP2 P2
VIP3 P3
VIP4 P4
VIP5 P5
VIP6 P6
VIP7 P7
VIP8 P8
VIP9 P9
VIP10 P10

Get maximum withdrawals

Retrieve the maximum transferable amount from trading account to funding account. If no currency is specified, the transferable amount of all owned currencies will be returned.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: UserID

HTTP Request

GET /api/v5/account/max-withdrawal

Request Example

GET /api/v5/account/max-withdrawal

Request Parameters

Parameter Type Required Description
ccy String No Single currency or multiple currencies (no more than 20) separated with comma, e.g. BTC or BTC,ETH.

Response Example

{
    "code": "0",
    "data": [
        {
            "ccy": "USD",
            "maxWd": "1.63093282565",
            "maxWdEx": "",
            "spotOffsetMaxWd": "",
            "spotOffsetMaxWdEx": ""
        },
        {
            "ccy": "USDT",
            "maxWd": "0.00007",
            "maxWdEx": "",
            "spotOffsetMaxWd": "",
            "spotOffsetMaxWdEx": ""
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
ccy String Currency
maxWd String Max withdrawal
maxWdEx String Max withdrawal (including borrowed assets under Multi-currency margin). Not enabled. Please disregard.
spotOffsetMaxWd String Max withdrawal under Spot-Derivatives risk offset mode (excluding borrowed assets under Portfolio margin). Not enabled. Please disregard.
spotOffsetMaxWdEx String Max withdrawal under Spot-Derivatives risk offset mode (including borrowed assets under Portfolio margin). Not enabled. Please disregard.

OTC-Desk RFQ API

Available Pairs

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/otc/rfq/instruments

Request Example

GET /api/v5/otc/rfq/instruments

Request Parameters

None

Response Example

{
    "code": "0",
    "data": [
        {
            "instruments": [
                {
                    "baseCcy": "BTC",
                    "baseCcyIcon": "https://static.coinall.ltd/cdn/oksupport/asset/currency/icon/btc.png",
                    "baseSingleMin": "0.257",
                    "instId": "BTC-USD",
                    "quoteCcy": "USD",
                    "quoteCcyIcon": "https://static.coinall.ltd/cdn/assets/imgs/218/7775D0B35AA6AF73.png",
                    "quoteSingleMin": "10000"
                }
            ],
            "ts": "1623727445510"
        }
    ],
    "msg": ""
}

Response Parameters

Parameters Parameters types Description
ts String Data update time Unix timestamp in milliseconds, such as: 1597026383085
instruments Array List of token pairs for trading
>instId String Trading pair
>baseCcy String Base currency, such as BTC in BTC-USD, BTC in BTC-USDT
>baseSingleMin String Minimium tradable amount for base currency
>baseCcyIcon String Icon link for base currency
>quoteCcy String Quote currency, such as USD in BTC-USD, USDT in BTC-USDT
>quoteSingleMin String Minimium tradable amount for quote currency
>quoteCcyIcon String Icon link for quote currency

Request Quote

Query current market quotation information

Rate Limit: 3 requests per second

Rate limit rule: UserID

HTTP Request

POST /api/v5/otc/rfq/quote

Request Example

POST /api/v5/otc/rfq/quote
body
{
    "baseCcy": "BTC",
    "quoteCcy": "USD",
    "side": "sell",
    "rfqSz": "1000",
    "rfqSzCcy": "USD"
}

Request Parameters

Parameters Parameters types Required Description
baseCcy String Yes Base currency, such as BTC in BTC-USD
quoteCcy String Yes Quote currency, such as USD in BTC-USD
side String Yes Side buy:buy sell:sell Buy & sell: two_way
From the perspective of a customer, it describes the transaction side of baseCcy
rfqSz String Yes Amount
rfqSzCcy String Yes Token
clQReqId String No Client-defined quote request ID, order id, with only length limitation
clQReqTs String No Client rfq sending time, Unix timestamp in milliseconds.

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
     {
        "quoteTs":"1597026383085",
        "ttlMs":"1000",
        "clQReqId":"6666",
        "quoteId":"123133",
        "baseCcy":"BTC",
        "quoteCcy":"USDT",
        "side":"buy",
        "origRfqSz":"0.55",
        "rfqSz":"0.5",
        "rfqSzCcy":"BTC",
        "bidPx":"10790",
        "bidBaseSz":"0.5",
        "bidQuoteSz":"5395",
        "askPx":"10800",
        "askBaseSz":"54000",
        "askQuoteSz":"5"
    }
  ]
}

Response Parameters

Parameters Parameters types Description
quoteTs String Time of quote generation, Unix timestamp in milliseconds
ttlMs String Time to expiry for the quote in milliseconds
clQReqId String Client-defined quote request ID
quoteId String Quote ID, as the input in a transaction request
baseCcy String Base currency, such as BTC in BTC-USDT
quoteCcy String Quote currency, such as USDT in BTC-USDT
side String Side buy:buy sell:sell Buy & sell: two_way
origRfqSz String Original amount
rfqSz String Amount can be quoted
rfqSzCcy String Token can be quoted
bidPx String Bid price
bidBaseSz String The amount of baseCcy that a customer may need to pay. This field is only valid when the quotation request is Sell or TwoWay
bidQuoteSz String The amount of quoteCcy that a customer may obtain. This field is only valid when the quotation request is Sell or TwoWay
askPx String Ask price
askBaseSz String The amount of baseCcy that a customer may obtain. This field is only valid when the quotation request is Buy or TwoWay
askQuoteSz String The amount of quoteCcy that a customer may need to pay. This field is only valid when the quotation request is Buy or TwoWay

Place Order

Rate Limit: 3 requests per second

Rate limit rule: UserID

HTTP Request

POST /api/v5/otc/rfq/trade

Request Example

POST /api/v5/otc/rfq/trade
body
{
    "clTReqId": "5111",
    "quoteId": "12638308",
    "baseCcy": "BTC",
    "quoteCcy": "USD",
    "side": "buy",
    "Sz": "2",
    "szCcy": "BTC"
}

Request Parameters

Parameters Parameters types Required Description
clTReqId String Yes Client-defined trade request ID
clTReqTs String No Client rfq sending time, Unix timestamp in milliseconds
quoteId String Yes Quotation number returned by quotation query.
baseCcy String Yes Base currency, such as BTC in BTC-USD
quoteCcy String Yes Quote currency, such as USD in BTC-USD
side String Yes Side buy:buy sell:sell
sz String Yes Amount
szCcy String Yes Token

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
     {
        "ts":"1597026383085",
        "tradeId":"159",
        "quoteId":"126383085",
        "clTReqId":"5111",
        "state":"live",
        "instId":"BTC-USDT",
        "baseCcy":"BTC",
        "quoteCcy":"USDT",
        "side":"buy",
        "px":"0.55",
        "filledBaseSz":"",
        "filledTermSz":"1"
    }
  ]
}

Response Parameters

Parameters Parameters types Description
ts String Unix timestamp in milliseconds
tradeId String Transaction ID
quoteId String Quotation ID returned by quotation query
clTReqId String User-defined ID
state String Order status,
PendingNew: the transaction has been created
FullyFilled: the order is completely filled
Rejected: the transaction is rejected
instId String Trading pair
baseCcy String Base currency, such as BTC in BTC-USDT
quoteCcy String Quote currency, such as USDT in BTC-USDT
side String Side buy:buy sell:sell
px String Price
filledBaseSz String Size of order
filledQuoteSz String Size of order

Order Details

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/otc/rfq/trade

Request Example

GET/api/v5/otc/rfq/trade?tradeId=134

Request Parameters

Parameters Parameters types Required Description
clTReqId String Optional Client-defined trade request ID
tradeId String Optional Order ID. One of clTReqId and tradeId must be filled in. If the user passes both values, only the tradeId parameter will be checked.

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
     {
        "ts":"1597026383085",
        "tradeId":"159",
        "quoteId":"126383085",
        "clTReqId":"5111",
        "state":"FullyFilled",
        "instId":"BTC-USDT",
        "baseCcy":"BTC",
        "quoteCcy":"USDT",
        "side":"buy",
        "px":"0.55",
        "filledBaseSz":"",
        "filledTermSz":"1"
    }
  ]
}

Response Parameters

Parameters Parameters types Description
ts String Unix timestamp in milliseconds
tradeId String Transaction ID
quoteId String Quotation ID returned by quotation query
clTReqId String User-defined ID
state String Order status,
PendingNew: the transaction has been created
FullyFilled: the order is completely filled
Rejected: the transaction is rejected
instId String Trading pair
baseCcy String Base currency, such as BTC in BTC-USDT
quoteCcy String Quote currency, such as USDT in BTC-USDT
side String Side buy:buy sell:sell
px String Trading price
filledBaseSz String Size of order
filledQuoteSz String Size of order

Order History

Rate Limit: 6 requests per second

Rate limit rule: UserID

HTTP Request

GET /api/v5/otc/rfq/history

Request Example

GET /api/v5/otc/rfq/history

Request Parameters

Parameters Parameters types Required Description
begin String No Start of trading time, Unix timestamp in milliseconds
end String No End of trading time, Unix timestamp in milliseconds.
pageSz String No Returned quantity per page, default 100
pageIdx String No Which page does it currently belong to, the default value is 0

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "ts":"1597026383085",
            "pageIdx":"1",
            "totalPageCnt":"160",
            "totalRecordCnt":"1590",
            "trades":[
                {
                    "ts":"1597026383085",
                    "tradeTs":"1597026383085",
                    "tradeId":"13085",
                    "clTReqId":"",
                    "instId":"BTC-USDT",
                    "side":"buy",
                    "px":"3085",
                    "baseCcy":"BTC",
                    "baseSz":"85",
                    "quoteCcy":"USD",
                    "quoteSz":"38"
                },
                 {
                    "ts":"1597026383085",
                    "tradeTs":"1597026383085",
                    "tradeId":"13085",
                    "clTReqId":"",
                    "instId":"BTC-USDT",
                    "side":"buy",
                    "px":"3085",
                    "baseCcy":"BTC",
                    "baseSz":"85",
                    "quoteCcy":"USD",
                    "quoteSz":"38"
                }
            ]
        }
    ]
}

Response Parameters

Parameters Parameters types Description
ts String Unix timestamp in milliseconds
pageIdx String Which page does it currently belong to, the default value is 0
totalPageCnt String Pages in total
totalRecordCnt String Items in total
trades Array Transaction history list
>ts String Record generation time, Unix timestamp in milliseconds
>tradeTs String Transaction ID
>tradeId String Client-defined ID
>clTReqId String Amount can be quoted
>instId String Trading pair
>side String Side buy: buy sell: sell
>px String Price
>baseCcy String Base currency, such as BTC in BTC-USDT
>baseSz String Amount of base currency
>quoteCcy String Quote currency, such as USDT in BTC-USDT
>quoteSz String Amount of quote currency

SubAccount

The API endpoints of SubAccount require authentication.

View sub-account list

Applies to master accounts only

Rate limit:2 requests per 2 seconds

Rate limit rule: UserID

HTTP request

GET /api/v5/users/subaccount/list

Request sample

GET /api/v5/users/subaccount/list

Request parameters

Parameter Type Required Description
enable String No Sub-account status, true: Normal ; false: Frozen
subAcct String No Sub-account name
after String No If you query the data prior to the requested creation time ID, the value will be a Unix timestamp in millisecond format.
before String No If you query the data after the requested creation time ID, the value will be a Unix timestamp in millisecond format.
limit String No Number of results per request. The maximum is 100. The default is 100.

Returned results

{
    "code":"0",
    "msg":"",
    "data":[
                   {
                      "enable":true,
                      "subAcct":"test-1",
                      "type":"1",
                      "label":"trade futures",
                      "mobile":"1818181",
                      "gAuth":true,
                      "canTransOut": true,
                      "ts":"1597026383085"
                   },
                   {
                      "enable":false,
                      "type":"1",
                      "subAcct":"test-2",
                      "label":"trade spot",
                      "mobile":"1818199",
                      "gAuth":true,
                      "canTransOut": false,
                      "ts":"1597026383082"
                   }

    ]
}

Response parameters

Parameter name Type Description
type String Sub-account type 1:Standard sub-account 2:Custody trading sub-account
enable Boolean Sub-account status true: Normal ; false:Frozen
subAcct String Sub-account name
label String Sub-account note
mobile String Mobile number that linked with the sub-account.
gAuth Boolean If the sub-account switches on the Google Authenticator for login authentication. true: On ; false: Off
canTransOut Boolean Whether the sub-account has the right to transfer out.
false: cannot transfer out
true: can transfer
. Not enabled. Please disregard.
ts String Sub-account creation time, Unix timestamp in millisecond format. e.g. 1597026383085

Query the APIKey of a sub-account

Applies to master accounts only

Rate limit:1 request per second

Rate limit rule: UserID

HTTP request

GET /api/v5/users/subaccount/apikey

Request sample

Get /api/v5/users/subaccount/apikey?subAcct=panpanBroker2

Request parameters

Parameter Type Required Description
subAcct String Yes Sub-account name
apiKey String No API public key

Returned results

    "code":"0",
    "msg":"",
    "data":[
        {
            "label":"v5",
            "apiKey":"arg13sdfgs",
            "perm":"read_only,trade",
            "ip":"1.1.1.1,2.2.2.2",
            "ts":"1597026383085"
        },
        {
            "label":"v5.1",
            "apiKey":"arg13sdfgs",
            "perm":"read_only",
            "ip":"1.1.1.1,2.2.2.2",
            "ts":"1597026383085"
        }
    ]
}

Response parameters

Parameter name Type Description
label String APIKey note
apiKey String API public key
perm String APIKey access read_only:Read only ;trade :Trade
ip String IP address that linked with APIKey
ts String Creation time

Get sub-account trading balance

Query detailed balance info of Trading Account of a sub-account via the master account (applies to master accounts only)

Rate limit:2 requests per 2 seconds

Rate limit rule: UserID

HTTP request

GET /api/v5/account/subaccount/balances

Request sample

GET /api/v5/account/subaccount/balances?subAcct=test1

Request parameters

Parameter Type Required Description
subAcct String Yes Sub-account name

Returned result

{
    "code": "0",
    "data": [
        {
            "adjEq": "10679688.0460531643092577",
            "details": [
                {
                    "availBal": "",
                    "availEq": "9930359.9998",
                    "cashBal": "9930359.9998",
                    "ccy": "USDT",
                    "crossLiab": "0",
                    "disEq": "9439737.0772999514",
                    "eq": "9930359.9998",
                    "eqUsd": "9933041.196999946",
                    "frozenBal": "0",
                    "interest": "0",
                    "isoEq": "0",
                    "isoLiab": "0",
                    "liab": "0",
                    "maxLoan": "10000",
                    "mgnRatio": "",
                    "notionalLever": "",
                    "ordFrozen": "0",
                    "twap": "0",
                    "uTime": "1620722938250",
                    "upl": "0",
                    "uplLiab": "0"
                },
                {
                    "availBal": "",
                    "availEq": "33.6799714158199414",
                    "cashBal": "33.2009985",
                    "ccy": "BTC",
                    "crossLiab": "0",
                    "disEq": "1239950.9687532129092577",
                    "eq": "33.771820625136023",
                    "eqUsd": "1239950.9687532129092577",
                    "frozenBal": "0.0918492093160816",
                    "interest": "0",
                    "isoEq": "0",
                    "isoLiab": "0",
                    "liab": "0",
                    "maxLoan": "1453.92289531493594",
                    "mgnRatio": "",
                    "notionalLever": "",
                    "ordFrozen": "0",
                    "twap": "0",
                    "uTime": "1620722938250",
                    "upl": "0.570822125136023",
                    "uplLiab": "0"
                }
            ],
            "imr": "3372.2942371050594217",
            "isoEq": "0",
            "mgnRatio": "70375.35408747017",
            "mmr": "134.8917694842024",
            "notionalUsd": "33722.9423710505978888",
            "ordFroz": "0",
            "totalEq": "11172992.1657531589092577",
            "uTime": "1623392334718"
        }
    ],
    "msg": ""
}

Response parameters

Parameters Types Description
uTime String The latest time to get account information, millisecond format of Unix timestamp, e.g. 1597026383085
totalEq String Total equity in USD
isoEq String Isolated margin equity in USD. Not enabled. Please disregard.
adjEq String Adjusted / Effective equity in USD. Not enabled. Please disregard.
ordFroz String Margin frozen for pending cross orders in USD. Not enabled. Please disregard.
imr String Frozen equity for open positions and pending orders in USD. Not enabled. Please disregard.
mmr String Maintenance margin requirement in USD. Not enabled. Please disregard.
mgnRatio String Margin ratio in USD. Not enabled. Please disregard.
notionalUsd String Notional value of positions in USD. Not enabled. Please disregard.
details Array Detailed asset information in all currencies
> ccy String Currency
> eq String Equity of the currency
> cashBal String Cash Balance
> uTime String Update time, Unix timestamp format in milliseconds, e.g. 1597026383085
> isoEq String Isolated margin equity of the currency. Not enabled. Please disregard.
> availEq String Available equity of the currency. Not enabled. Please disregard.
> disEq String Discount equity of the currency in USD
> availBal String Available balance of the currency
> frozenBal String Frozen balance of the currency
> ordFrozen String Margin frozen for open orders
> liab String Liabilities of the currency. Not enabled. Please disregard.
> upl String Unrealized profit and loss of the currency. Not enabled. Please disregard.
> uplLiab String Liabilities due to Unrealized loss of the currency. Not enabled. Please disregard.
> crossLiab String Cross Liabilities of the currency. Not enabled. Please disregard.
> isoLiab String Isolated Liabilities of the currency. Not enabled. Please disregard.
> mgnRatio String Margin ratio of the currency. Not enabled. Please disregard.
> interest String Interest of the currency. Not enabled. Please disregard.
> twap String System's forced repayment(TWAP) indicator. Not enabled. Please disregard.
> maxLoan String Max loan of the currency. Not enabled. Please disregard.
> eqUsd String Equity usd of the currency
> notionalLever String Leverage of the currency. Not enabled. Please disregard.

Get sub-account funding balance

Query detailed balance info of Funding Account of a sub-account via the master account (applies to master accounts only)

Rate limit:2 requests per 2 seconds

Rate limit rule: UserID

HTTP request

GET /api/v5/asset/subaccount/balances

Request sample

GET/api/v5/asset/subaccount/balances?subAcct=test1

Request parameters

Parameter Type Required Description
subAcct String Yes Sub-account name
ccy String No Single currency or multiple currencies (no more than 20) separated with comma, e.g. BTC or BTC,ETH.

Returned result

{
    "code": "0",
    "msg": "",
    "data": [{
            "availBal": "37.11827078",
            "bal": "37.11827078",
            "ccy": "ETH",
            "frozenBal": "0"
        }
    ]
}

Response parameters

Parameter Type Description
ccy String Currency
bal String Balance
frozenBal String Frozen balance
availBal String Available balance

History of sub-account transfer

Applies to master accounts only.
Retrieve the transfer data for the last 3 months.

Rate limit:6 requests per second

Rate limit rule: UserID

HTTP request

GET /api/v5/asset/subaccount/bills

Request sample

GET /api/v5/asset/subaccount/bills

Request parameters

Parameter Type Required Description
ccy String No Currency, such as BTC
type String No 0: Transfers from master account to sub-account ;1 : Transfers from sub-account to master account.
subAcct String No Sub-account name
after String No If you query the data prior to the requested bill ID, the value will be a Unix timestamp in millisecond format.
before String No If you query the data after the requested bill ID, the value will be a Unix timestamp in millisecond format.
limit String No Number of results per request. The maximum is 100. The default is 100.

Returned results

{
    "code": "0",
    "msg": "",
    "data": [{
                "billId": "12344",
                "type":"1",
                "ccy": "BTC",
                "amt":"2",
                "subAcct":"test-1",
                "ts":"1597026383085"
    }]
}

Response parameters

Parameter name Type Description
billId String Bill ID
ccy String Account balance currency
amt String Transfer amount
type String Bill type
subAcct String Sub-account name
ts String Sub-account creation time with Unix timestamp in millisecond format,1597026383085 e.g., 1597026383085

Master accounts manage the transfers between sub-accounts

Applies to master accounts only

Rate limit:1 request per second

Rate limit rule: UserID

HTTP request

POST /api/v5/asset/subaccount/transfer

Request sample

POST /api/v5/asset/subaccount/transfer
body
{
    "ccy":"USD",
    "amt":"1.5",
    "from":"6",
    "to":"6",
    "fromSubAccount":"test-1",
    "toSubAccount":"test-2"
}

Request parameters

Parameter Type Required Description
ccy String Yes Currency
amt String Yes Transfer amount
from String Yes 6:Funding Account 18:Trading account
to String Yes 6:Funding Account 18:Trading account
fromSubAccount String Yes Sub-account name of the account that transfers funds out.
toSubAccount String Yes Sub-account name of the account that transfers funds in.

Returned results

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "transId":"12345",
        }
    ]
}

Response parameters

Parameter name Type Description
transId String Transfer ID

Market data

The API endpoints of Market Data do not require authentication.

Get tickers

Retrieve the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/tickers

Request Example

GET /api/v5/market/tickers?instType=SPOT

Request Parameters

Parameter Type Required Description
instType String Yes Instrument type
SPOT

Response Example

{
    "code": "0",
    "msg": "",
    "data": [
        {
            "instType": "SPOT",
            "instId": "BTC-USD",
            "last": "16848.15",
            "lastSz": "0.0005",
            "askPx": "16849.01",
            "askSz": "0.0401",
            "bidPx": "16848.15",
            "bidSz": "0.017",
            "open24h": "16761.08",
            "high24h": "16943.44",
            "low24h": "16629.04",
            "volCcy24h": "2993092.015",
            "vol24h": "178.2431",
            "ts": "1672841403093",
            "sodUtc0": "16688.74",
            "sodUtc8": "16700.35"
        },
        {
            "instType": "SPOT",
            "instId": "ETH-USD",
            "last": "1252.02",
            "lastSz": "0.1727",
            "askPx": "1251.95",
            "askSz": "0.2296",
            "bidPx": "1251.81",
            "bidSz": "0.1699",
            "open24h": "1217.86",
            "high24h": "1260",
            "low24h": "1206.08",
            "volCcy24h": "4766566.0992",
            "vol24h": "3860.2722",
            "ts": "1672841403094",
            "sodUtc0": "1214.45",
            "sodUtc8": "1211.18"
        }
    ]
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
last String Last traded price
lastSz String Last traded size
askPx String Best ask price
askSz String Best ask size
bidPx String Best bid price
bidSz String Best bid size
open24h String Open price in the past 24 hours
high24h String Highest price in the past 24 hours
low24h String Lowest price in the past 24 hours
volCcy24h String 24h trading volume, with a unit of currency.
The value is the quantity in quote currency.
vol24h String 24h trading volume, with a unit of contract.
The value is the quantity in base currency.
sodUtc0 String Open price in the UTC 0
sodUtc8 String Open price in the UTC 8
ts String Ticker data generation time, Unix timestamp format in milliseconds, e.g. 1597026383085

Get ticker

Retrieve the latest price snapshot, best bid/ask price, and trading volume in the last 24 hours.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/ticker

Request Example

GET /api/v5/market/ticker?instId=BTC-USD

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD

Response Example

{
    "code": "0",
    "msg": "",
    "data": [
        {
            "instType": "SPOT",
            "instId": "BTC-USD",
            "last": "16838.49",
            "lastSz": "0.237",
            "askPx": "16836.62",
            "askSz": "0.0431",
            "bidPx": "16835.97",
            "bidSz": "0.2",
            "open24h": "16764.37",
            "high24h": "16943.44",
            "low24h": "16629.04",
            "volCcy24h": "2991370.9916",
            "vol24h": "178.1375",
            "ts": "1672841618814",
            "sodUtc0": "16688.74",
            "sodUtc8": "16700.35"
        }
    ]
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID
last String Last traded price
lastSz String Last traded size
askPx String Best ask price
askSz String Best ask size
bidPx String Best bid price
bidSz String Best bid size
open24h String Open price in the past 24 hours
high24h String Highest price in the past 24 hours
low24h String Lowest price in the past 24 hours
volCcy24h String 24h trading volume, with a unit of currency.
The value is the quantity in quote currency.
vol24h String 24h trading volume, with a unit of contract.
The value is the quantity in base currency.
sodUtc0 String Open price in the UTC 0
sodUtc8 String Open price in the UTC 8
ts String Ticker data generation time, Unix timestamp format in milliseconds, e.g. 1597026383085.

Get order book

Retrieve order book of the instrument.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/books

Request Example

GET /api/v5/market/books?instId=BTC-USD

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
sz String No Order book depth per side. Maximum 400, e.g. 400 bids + 400 asks
Default returns to 1 depth data

Response Example

{
    "code": "0",
    "msg": "",
    "data": [
        {
            "asks": [
                [
                    "41006.8",
                    "0.60038921",
                    "0",
                    "1"
                ]
            ],
            "bids": [
                [
                    "41006.3",
                    "0.30178218",
                    "0",
                    "2"
                ]
            ],
            "ts": "1629966436396"
        }
    ]
}

Response Parameters

Parameter Type Description
asks Array Order book on sell side
bids Array Order book on buy side
ts String Order book generation time

Get order lite book

Retrieve order top 25 book of the instrument more quickly

Rate Limit: 6 requests per 1 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/books-lite

Request Example

GET /api/v5/market/books-lite?instId=BTC-USD

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD

Response Example

{
    "code": "0",
    "msg": "",
    "data": [
        {
            "asks": [
                [
                    "41006.8",
                    "0.60038921",
                    "0",
                    "1"
                ]
            ],
            "bids": [
                [
                    "41006.3",
                    "0.30178218",
                    "0",
                    "2"
                ]
            ],
            "ts": "1629966436396"
        }
    ]
}

Response Parameters

Parameter Type Description
asks Array Order book on sell side
bids Array Order book on buy side
ts String Order book generation time

Get candlesticks

Retrieve the candlestick charts. This endpoint can retrieve the latest 1,440 data entries. Charts are returned in groups based on the requested bar.

Rate Limit: 40 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/candles

Request Example

GET /api/v5/market/candles?instId=BTC-USD

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
bar String No Bar size, the default is 1m
e.g. [1m/3m/5m/15m/30m/1H/2H/4H]
Hong Kong time opening price k-line:[6H/12H/1D/2D/3D/1W/1M/3M]
UTC time opening price k-line:[/6Hutc/12Hutc/1Dutc/2Dutc/3Dutc/1Wutc/1Mutc/3Mutc]
after String No Pagination of data to return records earlier than the requested ts
before String No Pagination of data to return records newer than the requested ts
limit String No Number of results per request. The maximum is 300. The default is 100.

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
     [
        "1597026383085",
        "3.721",
        "3.743",
        "3.677",
        "3.708",
        "8422410",
        "22698348.04828491",
        "12698348.04828491",
        "0"
    ],
    [
        "1597026383085",
        "3.731",
        "3.799",
        "3.494",
        "3.72",
        "24912403",
        "67632347.24399722",
        "37632347.24399722",
        "1"
    ]
    ]
}

Response Parameters

Parameter Type Description
ts String Opening time of the candlestick, Unix timestamp format in milliseconds, e.g. 1597026383085
o String Open price
h String highest price
l String Lowest price
c String Close price
vol String Trading volume, the value is the quantity in base currency.
volCcy String Trading volume, the value is the quantity in quote currency.
volCcyQuote String Trading volume, the value is the quantity in quote currency. Not enabled. Please disregard.
confirm String The state of candlesticks.
0 represents that it is uncompleted, 1 represents that it is completed.

Get candlesticks history

Retrieve history candlestick charts from recent years.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/history-candles

Request Example

GET /api/v5/market/history-candles?instId=BTC-USD

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
after String No Pagination of data to return records earlier than the requested ts
before String No Pagination of data to return records newer than the requested ts
bar String No Bar size, the default is 1m
e.g. [1m/3m/5m/15m/30m/1H/2H/4H]
Hong Kong time opening price k-line:[6H/12H/1D/2D/3D/1W/1M/3M]
UTC time opening price k-line:[6Hutc/12Hutc/1Dutc/2Dutc/3Dutc/1Wutc/1Mutc/3Mutc]
limit String No Number of results per request. The maximum is 100. The default is 100.

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
     [
        "1597026383085",
        "3.721",
        "3.743",
        "3.677",
        "3.708",
        "8422410",
        "22698348.04828491",
        "12698348.04828491",
        "1"
    ],
    [
        "1597026383085",
        "3.731",
        "3.799",
        "3.494",
        "3.72",
        "24912403",
        "67632347.24399722",
        "37632347.24399722",
        "1"
    ]
    ]
}

Response Parameters

Parameter Type Description
ts String Opening time of the candlestick, Unix timestamp format in milliseconds, e.g. 1597026383085
o String Open price
h String Highest price
l String Lowest price
c String Close price
vol String Trading volume, the value is the quantity in base currency.
volCcy String Trading volume, the value is the quantity in quote currency.
volCcyQuote String Trading volume, the value is the quantity in quote currency. Not enabled. Please disregard.
confirm String The state of candlesticks.
0 represents that it is uncompleted, 1 represents that it is completed.

Get trades

Retrieve the recent transactions of an instrument.

Rate Limit: 100 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/trades

Request Example

GET /api/v5/market/trades?instId=BTC-USD

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
limit String No Number of results per request. The maximum is 500; The default is 100

Response Example

{
    "code": "0",
    "msg": "",
    "data": [
        {
            "instId": "BTC-USD",
            "side": "sell",
            "sz": "0.00001",
            "px": "29963.2",
            "tradeId": "242720720",
            "ts": "1654161646974"
        },
        {
            "instId": "BTC-USD",
            "side": "sell",
            "sz": "0.00001",
            "px": "29964.1",
            "tradeId": "242720719",
            "ts": "1654161641568"
        }
    ]
}

Response Parameters

Parameter Type Description
instId String Instrument ID
tradeId String Trade ID
px String Trade price
sz String Trade quantity
side String Trade side
buy
sell
ts String Trade time, Unix timestamp format in milliseconds, e.g. 1597026383085.

Get trades history

Retrieve the recent transactions of an instrument from the last 3 months with pagination.

Rate Limit: 10 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/history-trades

Request Example

GET /api/v5/market/history-trades?instId=BTC-USD

Request Parameters

Parameter Type Required Description
instId String Yes Instrument ID, e.g. BTC-USD
type String No Pagination Type
1: tradeId 2: timestamp
The default is 1
after String No Pagination of data to return records earlier than the requested tradeId or ts.
before String No Pagination of data to return records newer than the requested tradeId.
Do not support timestamp for pagination
limit String No Number of results per request. The maximum and default both are 100

Response Example

{
    "code": "0",
    "msg": "",
    "data": [
        {
            "instId": "BTC-USD",
            "side": "sell",
            "sz": "0.00001",
            "px": "29963.2",
            "tradeId": "242720720",
            "ts": "1654161646974"
        },
        {
            "instId": "BTC-USD",
            "side": "sell",
            "sz": "0.00001",
            "px": "29964.1",
            "tradeId": "242720719",
            "ts": "1654161641568"
        }
    ]
}

Response Parameters

Parameter Type Description
instId String Instrument ID
tradeId String Trade ID
px String Trade price
sz String Trade quantity
side String Trade side
buy
sell
ts String Trade time, Unix timestamp format in milliseconds, e.g. 1597026383085.

Get 24H total volume

The 24-hour trading volume is calculated on a rolling basis, using USD as the pricing unit.

Rate Limit: 2 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/platform-24-volume

Request Example

GET /api/v5/market/platform-24-volume

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
     {
         "volCny": "230900886396766",
         "volUsd": "34462818865189",
         "ts": "1657856040389"
     }
  ]
}

Response Parameters

Parameter Type Description
volUsd String 24-hour total trading volume on the platform in "USD"
volCny String 24-hour total trading volume on the platform in "CNY"
ts String Data return time, Unix timestamp format in milliseconds, e.g. 1597026383085

Get oracle

Get the crypto price of signing using Open Oracle smart contract.

Rate Limit: 1 request per 5 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/open-oracle

Request Example

GET /api/v5/market/open-oracle

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
        {
            "messages":[
                "0x000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000616d3b1400000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000e70528b800000000000000000000000000000000000000000000000000000000000000006707269636573000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034254430000000000000000000000000000000000000000000000000000000000"
            ],
            "prices":{
                "BTC":"62014"
            },
            "signatures":[
                "0xf18330e59eaf42373c2c40f1f9e24113ba21d4ed734dd3ed3bc1d12290fa74ba5623fca1113c5d245a1202dc065e333615b90f810f12132ce4a1ecacb8c6b24a000000000000000000000000000000000000000000000000000000000000001b"
            ],
            "timestamp":"1634548500"
        }
    ]
}

Response Parameters

Parameter Type Description
messages String ABI-encoded values [kind, timestamp, key, value], where kind equals 'prices', timestamp is the time when price was obtained, key is the asset ticker (e.g. btc) and value is the asset price.
prices String Readable asset prices
signatures String Ethereum-compatible ECDSA signatures for each message
timestamp String Time of latest datapoint, Unix timestamp, e.g. 1597026387

Get exchange rate

This interface provides the average exchange rate data for 2 weeks

Rate Limit: 1 request per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/market/exchange-rate

Request Example

GET /api/v5/market/exchange-rate

Response Example

{
    "code": "0",
    "msg": "",
    "data": [ {
            "usdCny": "6.44"
}]
}

Response Parameters

Parameter Type Description
usdCny String Exchange rate

Public data

The API endpoints of Public Data do not require authentication.

Get instruments

Retrieve a list of instruments with open contracts.

Rate Limit: 20 requests per 2 seconds

Rate limit rule: IP + instrumentType

HTTP Request

GET /api/v5/public/instruments

Request Example

GET /api/v5/public/instruments?instType=SPOT

Request Parameters

Parameter Type Required Description
instType String Yes Instrument type
SPOT
instId String No Instrument ID

Response Example

{
    "code": "0",
    "data": [
        {
            "alias": "",
            "baseCcy": "BTC",
            "category": "1",
            "ctMult": "",
            "ctType": "",
            "ctVal": "",
            "ctValCcy": "",
            "expTime": "",
            "instFamily": "",
            "instId": "BTC-USD",
            "instType": "SPOT",
            "lever": "",
            "listTime": "1671521075000",
            "lotSz": "0.0001",
            "maxIcebergSz": "99999999999999",
            "maxLmtSz": "99999999999999",
            "maxMktSz": "1000000",
            "maxStopSz": "1000000",
            "maxTriggerSz": "99999999999999",
            "maxTwapSz": "99999999999999",
            "minSz": "0.0001",
            "optType": "",
            "quoteCcy": "USD",
            "settleCcy": "",
            "state": "live",
            "stk": "",
            "tickSz": "0.01",
            "uly": ""
        }
    ],
    "msg": ""
}

Response Parameters

Parameter Type Description
instType String Instrument type
instId String Instrument ID, e.g. BTC-USD
uly String Underlying. Not enabled. Please disregard.
instFamily String Instrument family. Not enabled. Please disregard.
category String Fee schedule. Not enabled. Please disregard.
baseCcy String Base currency, e.g. BTC inBTC-USD
quoteCcy String Quote currency, e.g. USD in BTC-USD
settleCcy String Settlement and margin currency. Not enabled. Please disregard.
ctVal String Contract value. Not enabled. Please disregard.
ctMult String Contract multiplier. Not enabled. Please disregard.
ctValCcy String Contract value currency. Not enabled. Please disregard.
optType String Option type. Not enabled. Please disregard.
stk String Strike price. Not enabled. Please disregard.
listTime String Listing time, Unix timestamp format in milliseconds, e.g. 1597026383085
expTime String Expiry time, Unix timestamp format in milliseconds, e.g. 1597026383085. Not enabled. Please disregard.
lever String Max Leverage. Not enabled. Please disregard.
tickSz String Tick size, e.g. 0.0001
lotSz String Lot size, e.g. BTC-USD: 1
minSz String Minimum order size
ctType String Contract type
linear: linear contract
inverse: inverse contract. Not enabled. Please disregard.
alias String Alias. Not enabled. Please disregard.
state String Instrument status
live
suspend
preopen
maxLmtSz String The maximum order quantity of the spot limit order
maxMktSz String The maximum order quantity of the spot market order
maxTwapSz String The maximum order quantity of the spot twap order
maxIcebergSz String The maximum order quantity of the spot iceBerg order
maxTriggerSz String The maximum order quantity of the spot trigger order
maxStopSz String The maximum order quantity of the spot stop order

Get system time

Retrieve API server time.

Rate Limit: 10 requests per 2 seconds

Rate limit rule: IP

HTTP Request

GET /api/v5/public/time

Request Example

GET /api/v5/public/time

Response Example

{
    "code":"0",
    "msg":"",
    "data":[
    {
        "ts":"1597026383085"
    }
  ]
}

Response Parameters

Parameter Type Description
ts String System time, Unix timestamp format in milliseconds, e.g. 1597026383085

Status

Get event status of system upgrade

Rate Limit: 1 request per 5 seconds

HTTP Requests

GET /api/v5/system/status

Request Example

GET /api/v5/system/status

GET /api/v5/system/status?state=canceled

Request Parameters

Parameters Types Required Description
state String No System maintenance status,scheduled: waiting; ongoing: processing; pre_open: pre_open; completed: completed ;canceled: canceled.
Generally, pre_open last about 10 minutes. There will be pre_open when the time of upgrade is too long.
If this parameter is not filled, the data with status scheduled, ongoing and pre_open will be returned by default

Response Example

{
    "code": "0",
    "msg": "",
    "data": [{
        "title": "Spot System Upgrade",
        "state": "scheduled",
        "begin": "1620723600000",
        "end": "1620724200000",
        "href": "",
        "serviceType": "1",
        "system": "classic",
        "scheDesc": ""       
    }]
}

Response Parameters

Parameters Types Description
title String The title of system maintenance instructions
state String System maintenance status
begin String Begin time of system maintenance, Unix timestamp format in milliseconds, e.g. 1617788463867
end String Time of resuming trading totally. Unix timestamp format in milliseconds, e.g. 1617788463867.
It is expected end time before completed, changed to actual end time after completed.
preOpenBegin String The time of pre_open. Canceling orders, placing Post Only orders, and transferring funds to trading accounts are back after preOpenBegin.
href String Hyperlink for system maintenance details, if there is no return value, the default value will be empty. e.g. “”
serviceType String Service type, 0:WebSocket ; 1:Classic account 5:Unified account; 99: Others (e.g. Suspend partial instruments)
system String System, classic: Classic account unified: Unified account
scheDesc String Rescheduled description, e.g. Rescheduled from 2021-01-26T16:30:00.000Z to 2021-01-28T16:30:00.000Z

WebSocket API

Overview

WebSocket is a new HTML5 protocol that achieves full-duplex data transmission between the client and server, allowing data to be transferred effectively in both directions. A connection between the client and server can be established with just one handshake. The server will then be able to push data to the client according to preset rules. Its advantages include:

Connect

Connection instructions:

Connection limit: 1 request per second

When subscribing to a public channel, use the address of the public service. When subscribing to a private channel, use the address of the private service

Subscription limit: 240 times per hour

Login

Rate Limit: 1 request per second Applicable to single-account login
Rate Limit: 1 request per 15 seconds Applicable to multi-account batch login

Request Example

{
  "op": "login",
  "args": [
    {
      "apiKey": "985d5b66-57ce-40fb-b714-afc0b9787083",
      "passphrase": "123456",
      "timestamp": "1538054050",
      "sign": "7L+zFQ+CEgGu5rzCj4+BdV2/uUHGqddA9pI6ztsRRPs="
    },
    {
      "apiKey"    : "86126n98-57ce-40fb-b714-afc0b9787083",
      "passphrase" :"123456",
      "timestamp" :"1538054050",
      "sign" :"7L+zFQ+CEgGu5rzCj4+BdV2/uUHGqddA9pI6ztsRRPs=" 
     }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, login
args Array Yes List of account to login, the maximum is 100
> apiKey String Yes APIKey
> passphrase String Yes APIKey password
> timestamp String Yes Unix Epoch time, the unit is seconds
> sign String Yes Signature string

Successful Response Example

{
  "event": "login",
  "code": "0",
  "msg": ""
}

Failure Response Example

{
  "event": "error",
  "code": "60009",
  "msg": "Login failed."
}

Response Example When Partially Successful

{
    "event": "login",
    "code": "60022",
    "msg": "Bulk login partially succeeded",
    "data":[
        {"apiKey": "86126n98-57ce-40fb-b714-afc0b9787083"}
    ]
}

Response parameters

Parameter Type Required Description
event String Yes Operation, login error
code String No Error code
msg String No Error message
data Object No List returned after login failure
> apiKey String Yes APIKey returned after login failure

api_key: Unique identification for invoking API. Requires user to apply one manually.

passphrase: APIKey password

timestamp: the Unix Epoch time, the unit is seconds

sign: signature string, the signature algorithm is as follows:

First concatenate timestamp, method, requestPath, strings, then use HMAC SHA256 method to encrypt the concatenated string with SecretKey, and then perform Base64 encoding.

secretKey: The security key generated when the user applies for APIKey, e.g. : 22582BD0CFF14C41EDBF1AB98506286D

Example of timestamp: const timestamp = '' + Date.now() / 1,000

Among sign example: sign=CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(timestamp +'GET'+'/users/self/verify', secretKey))

method: always 'GET'.

requestPath : always '/users/self/verify'

Subscribe

Subscription Instructions

Request format description

{
  "op": "subscribe",
  "args": ["<SubscriptionTopic>"]
}

WebSocket channels are divided into two categories: public and private channels.

Public channels -- No authentication is required, include tickers channel, K-Line channel, limit price channel, order book channel, and mark price channel etc.

Private channels -- including account channel, order channel, and position channel, etc -- require log in.

Users can choose to subscribe to one or more channels, and the total length of multiple channels cannot exceed 4,096 bytes.

Request Example

{
    "op":"subscribe",
    "args":[
        {
            "channel":"tickers",
            "instId":"BTC-USD"
        },
        {
            "channel":"candle1m",
            "instId":"BTC-USD"
        }
    ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name
> instType String No Instrument type
SPOT
> uly String No Underlying
> instId String No Instrument ID

Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "tickers",
    "instId": "BTC-USD"
  }
}

Return parameters

Parameter Type Required Description
event String Yes Event, subscribe error
arg Object No Subscribed channel
> channel String Yes Channel name
> instType String No Instrument type
SPOT
> uly String No Underlying
> instId String No Instrument ID
code String No Error code
msg String No Error message

Unsubscribe

Unsubscribe from one or more channels.

Request format description

{
  "op": "unsubscribe",
  "args": ["< SubscriptionTopic> "]
}

Request Example

{
  "op": "unsubscribe",
  "args": [
    {
      "channel": "tickers",
      "instId": "BTC-USD"
    },
    {
      "channel": "candle1m",
      "instId": "BTC-USD"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, unsubscribe
args Array Yes List of channels to unsubscribe from
> channel String Yes Channel name
> instType String No Instrument type
SPOT
> uly String No Underlying
> instId String No Instrument ID

Response Example

{
  "event": "unsubscribe",
  "arg": {
    "channel": "tickers",
    "instId": "BTC-USD"
  }
}

Response parameters

Parameter Type Required Description
event String Yes Event, unsubscribe error
arg Object No Unsubscribed channel
> channel String Yes Channel name
> instType String No Instrument type
SPOT
> uly String No Underlying
> instId String No Instrument ID
code String No Error code
msg String No Error message

Trade

The WebSocket Trade APIs require authentication.

Place order

You can place an order only if you have sufficient funds.

Rate Limit: 60 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

Request Example

{
    "id": "1512",
    "op": "order",
    "args": [{
        "side": "buy",
        "instId": "BTC-USDT",
        "tdMode": "cash",
        "ordType": "market",
        "sz": "100"
    }]
}

Request Parameters

Parameter Type Required Description
id String Yes Unique identifier of the message
Provided by client. It will be returned in response message for identifying the corresponding request.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
op String Yes Operation, e.g. order
args Array Yes Request parameters
> instId String Yes Instrument ID,e.g. BTC-USD
> tdMode String Yes Trade mode
Non-Margin mode cash
> clOrdId String No Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
> tag String No Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
> side String Yes Order side, buy sell
> ordType String Yes Order type
market: market order
limit: limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
> sz String Yes Quantity to buy or sell.
> px String Conditional Order price
Only applicable to limit,post_only,fok,ioc order.
> tgtCcy String No Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
> banAmend Boolean No Whether to disallow the system from amending the size of the SPOT Market Order.
Valid options: true or false. The default value is false.
If true, system will not amend and reject the market order if user does not have sufficient funds.
Only applicable to SPOT Market Orders
expTime String No Request effective deadline. Unix timestamp format in milliseconds, e.g. 1597026383085
Successful Response Example
{
  "id": "1512",
  "op": "order",
  "data": [
    {
      "clOrdId": "",
      "ordId": "12345689",
      "tag": "",
      "sCode": "0",
      "sMsg": ""
    }
  ],
  "code": "0",
  "msg": ""
}

Failure Response Example

{
  "id": "1512",
  "op": "order",
  "data": [
    {
      "clOrdId": "",
      "ordId": "",
      "tag": "",
      "sCode": "5XXXX",
      "sMsg": "not exist"
    }
  ],
  "code": "1",
  "msg": ""
}

Response Example When Format Error

{
  "id": "1512",
  "op": "order",
  "data": [],
  "code": "60013",
  "msg": "Invalid args"
}

Response Parameters

Parameter Type Description
id String Unique identifier of the message
op String Operation
code String Error Code
msg String Error message
data Array Data
> ordId String Order ID
> clOrdId String Client Order ID as assigned by the client
> tag String Order tag
> sCode String Order status code, 0 means success
> sMsg String Order status message

Place multiple orders

Place orders in a batch. Maximum 20 orders can be placed per request

Rate Limit: 300 orders per 2 seconds

Spot rate limit rule: UserID + instrumentID

Request Example

{
  "id": "1513",
  "op": "batch-orders",
  "args": [
    {
        "instId":"BTC-USD",
        "tdMode":"cash",
        "clOrdId":"b15",
        "side":"buy",
        "ordType":"limit",
        "px":"2.15",
        "sz":"2"
    },
    {
        "instId":"BTC-USD",
        "tdMode":"cash",
        "clOrdId":"b15",
        "side":"buy",
        "ordType":"limit",
        "px":"2.15",
        "sz":"2"
    }
  ]
}

Request Parameters

Parameter Type Required Description
id String Yes Unique identifier of the message
Provided by client. It will be returned in response message for identifying the corresponding request.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
op String Yes Operation, e.g. batch-orders
args Array Yes Request Parameters
> instId String Yes Instrument ID, e.g. BTC-USDT
> tdMode String Yes Trade mode
Non-Margin mode cash
> clOrdId String No Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
> tag String No Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
> side String Yes Order side, buy sell
> ordType String Yes Order type
market: market order
limit: limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
> sz String Yes Quantity to buy or sell.
> px String Conditional Price
Only applicable to limit,post_only,fok,ioc order.
> tgtCcy String No Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
> banAmend Boolean No Whether to disallow the system from amending the size of the SPOT Market Order.
Valid options: true or false. The default value is false.
If true, system will not amend and reject the market order if user does not have sufficient funds.
Only applicable to SPOT Market Orders
expTime String No Request effective deadline. Unix timestamp format in milliseconds, e.g. 1597026383085

Response Example When All Succeed

{
  "id": "1513",
  "op": "batch-orders",
  "data": [
    {
      "clOrdId": "",
      "ordId": "12345689",
      "tag": "",
      "sCode": "0",
      "sMsg": ""
    },
    {
      "clOrdId": "",
      "ordId": "12344",
      "tag": "",
      "sCode": "0",
      "sMsg": ""
    }
  ],
  "code": "0",
  "msg": ""
}

Response Example When Partially Successful

{
  "id": "1513",
  "op": "batch-orders",
  "data": [
    {
      "clOrdId": "",
      "ordId": "12345689",
      "tag": "",
      "sCode": "0",
      "sMsg": ""
    },
    {
      "clOrdId": "",
      "ordId": "",
      "tag": "",
      "sCode": "5XXXX",
      "sMsg": "Insufficient margin"
    }
  ],
  "code": "2",
  "msg": ""
}

Response Example When All Failed

{
  "id": "1513",
  "op": "batch-orders",
  "data": [
    {
      "clOrdId": "oktswap6",
      "ordId": "",
      "tag": "",
      "sCode": "5XXXX",
      "sMsg": "Insufficient margin"
    },
    {
      "clOrdId": "oktswap7",
      "ordId": "",
      "tag": "",
      "sCode": "5XXXX",
      "sMsg": "Insufficient margin"
    }
  ],
  "code": "1",
  "msg": ""
}

Response Example When Format Error

{
  "id": "1513",
  "op": "batch-orders",
  "data": [],
  "code": "60013",
  "msg": "Invalid args"
}

Response Parameters

Parameter Type Description
id String Unique identifier of the message
op String Operation
code String Error Code
msg String Error message
data Array Data
> ordId String Order ID
> clOrdId String Client Order ID as assigned by the client
> tag String Order tag
> sCode String Order status code, 0 means success
> sMsg String Order status message

Cancel order

Cancel an incomplete order

Rate Limit: 60 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

Request Example

{
  "id": "1514",
  "op": "cancel-order",
  "args": [
    {
      "instId": "BTC-USD",
      "ordId": "2510789768709120"
    }
  ]
}

Request Parameters

Parameter Type Required Description
id String Yes Unique identifier of the message
Provided by client. It will be returned in response message for identifying the corresponding request.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
op String Yes Operation, e.g. cancel-order
args Array Yes Request Parameters
> instId String Yes Instrument ID
> ordId String Conditional Order ID
Either ordId or clOrdId is required, if both are passed, ordId will be used
> clOrdId String Conditional Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

Successful Response Example

{
  "id": "1514",
  "op": "cancel-order",
  "data": [
    {
      "clOrdId": "",
      "ordId": "2510789768709120",
      "sCode": "0",
      "sMsg": ""
    }
  ],
  "code": "0",
  "msg": ""
}

Failure Response Example

{
  "id": "1514",
  "op": "cancel-order",
  "data": [
    {
      "clOrdId": "",
      "ordId": "2510789768709120",
      "sCode": "5XXXX",
      "sMsg": "Order not exist"
    }
  ],
  "code": "1",
  "msg": ""
}

Response Example When Format Error

{
  "id": "1514",
  "op": "cancel-order",
  "data": [],
  "code": "60013",
  "msg": "Invalid args"
}

Response Parameters

Parameter Type Description
id String Unique identifier of the message
op String Operation
code String Error Code
msg String Error message
data Array Data
> ordId String Order ID
> clOrdId String Client Order ID as assigned by the client
> sCode String Order status code, 0 means success
> sMsg String Order status message

Cancel multiple orders

Cancel incomplete orders in batches. Maximum 20 orders can be canceled per request.

Rate Limit: 300 orders per 2 seconds

Spot rate limit rule: UserID + instrumentID

Request Example

{
  "id": "1515",
  "op": "batch-cancel-orders",
  "args": [
    {
      "instId": "BTC-USD",
      "ordId": "2517748157541376"
    },
    {
      "instId": "LTC-USD",
      "ordId": "2517748155771904"
    }
  ]
}

Request Parameters

Parameter Type Required Description
id String Yes Unique identifier of the message
Provided by client. It will be returned in response message for identifying the corresponding request.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
op String Yes Operation, e.g. batch-cancel-orders
args Array Yes Request Parameters
> instId String Yes Instrument ID
> ordId String Conditional Order ID
Either ordId or clOrdId is required, if both are passed, ordId will be used
> clOrdId String Conditional Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

Response Example When All Succeed

{
  "id": "1515",
  "op": "batch-cancel-orders",
  "data": [
    {
      "clOrdId": "oktswap6",
      "ordId": "2517748157541376",
      "sCode": "0",
      "sMsg": ""
    },
    {
      "clOrdId": "oktswap7",
      "ordId": "2517748155771904",
      "sCode": "0",
      "sMsg": ""
    }
  ],
  "code": "0",
  "msg": ""
}

Response Example When partially successfully

{
  "id": "1515",
  "op": "batch-cancel-orders",
  "data": [
    {
      "clOrdId": "oktswap6",
      "ordId": "2517748157541376",
      "sCode": "0",
      "sMsg": ""
    },
    {
      "clOrdId": "oktswap7",
      "ordId": "2517748155771904",
      "sCode": "5XXXX",
      "sMsg": "order not exist"
    }
  ],
  "code": "2",
  "msg": ""
}

Response Example When All Failed

{
  "id": "1515",
  "op": "batch-cancel-orders",
  "data": [
    {
      "clOrdId": "oktswap6",
      "ordId": "2517748157541376",
      "sCode": "5XXXX",
      "sMsg": "order not exist"
    },
    {
      "clOrdId": "oktswap7",
      "ordId": "2517748155771904",
      "sCode": "5XXXX",
      "sMsg": "order not exist"
    }
  ],
  "code": "1",
  "msg": ""
}

Response Example When Format Error

{
  "id": "1515",
  "op": "batch-cancel-orders",
  "data": [],
  "code": "60013",
  "msg": "Invalid args"
}

Response Parameters

Parameter Type Description
id String Unique identifier of the message
op String Operation
code String Error Code
msg String Error message
data Array Data
> ordId String Order ID
> clOrdId String Client Order ID as assigned by the client
> sCode String Order status code, 0 means success
> sMsg String Order status message

Amend order

Amend an incomplete order.

Rate Limit: 60 requests per 2 seconds

Spot rate limit rule: UserID + instrumentID

Request Example

{
  "id": "1512",
  "op": "amend-order",
  "args": [
    {
      "instId": "BTC-USD",
      "ordId": "2510789768709120",
      "newSz": "2"
    }
  ]
}

Request Parameters

Parameter Type Required Description
id String Yes Unique identifier of the message
Provided by client. It will be returned in response message for identifying the corresponding request.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
op String Yes Operation, e.g. amend-order
args Array Yes Request Parameters
> instId String Yes Instrument ID
> cxlOnFail Boolean No Whether the order needs to be automatically canceled when the order amendment fails
Valid options: false or true, the default is false.
> ordId String Conditional Order ID
Either ordId or clOrdId is required, if both are passed, ordId will be used.
> clOrdId String Conditional Client Order ID as assigned by the client
> reqId String No Client Request ID as assigned by the client for order amendment
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
> newSz String Conditional New quantity after amendment. Either newSz or newPx is required. When amending a partially-filled order, the newSz should include the amount that has been filled.
> newPx String Conditional New price after amendment.
expTime String No Request effective deadline. Unix timestamp format in milliseconds, e.g. 1597026383085

Successful Response Example

{
  "id": "1512",
  "op": "amend-order",
  "data": [
    {
      "clOrdId": "",
      "ordId": "2510789768709120",
      "reqId": "b12344",
      "sCode": "0",
      "sMsg": ""
    }
  ],
  "code": "0",
  "msg": ""
}

Failure Response Example

{
  "id": "1512",
  "op": "amend-order",
  "data": [
    {
      "clOrdId": "",
      "ordId": "2510789768709120",
      "reqId": "b12344",
      "sCode": "5XXXX",
      "sMsg": "order not exist"
    }
  ],
  "code": "1",
  "msg": ""
}

Response Example When Format Error

{
  "id": "1512",
  "op": "amend-order",
  "data": [],
  "code": "60013",
  "msg": "Invalid args"
}

Response Parameters

Parameter Type Description
id String Unique identifier of the message
op String Operation
code String Error Code
msg String Error message
data Array Data
> ordId String Order ID
> clOrdId String Client Order ID as assigned by the client
> reqId String Client Request ID as assigned by the client for order amendment
> sCode String Order status code, 0 means success
> sMsg String Order status message

Amend multiple orders

Amend incomplete orders in batches. Maximum 20 orders can be amended per request.

Rate Limit: 300 orders per 2 seconds

Spot rate limit rule: UserID + instrumentID

Request Example

{
  "id": "1513",
  "op": "batch-amend-orders",
  "args": [
    {
      "instId": "BTC-USD",
      "ordId": "12345689",
      "newSz": "2"
    },
    {
      "instId": "BTC-USD",
      "ordId": "12344",
      "newSz": "2"
    }
  ]
}

Request Parameters

Parameter Type Required Description
id String Yes Unique identifier of the message
Provided by client. It will be returned in response message for identifying the corresponding request.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
op String Yes Operation, e.g. batch-amend-orders
args Array Yes Request Parameters
> instId String Yes Instrument ID
> cxlOnFail Boolean No Whether the order needs to be automatically canceled when the order amendment fails
Valid options: false or true, the default is false.
> ordId String Conditional Order ID
Either ordId or clOrdId is required, if both are passed, ordId will be used.
> clOrdId String Conditional Client Order ID as assigned by the client
> reqId String No Client Request ID as assigned by the client for order amendment
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
> newSz String Conditional New quantity after amendment. Either newSz or newPx is required. When amending a partially-filled order, the newSz should include the amount that has been filled.
> newPx String Conditional New price after amendment.
expTime String No Request effective deadline. Unix timestamp format in milliseconds, e.g. 1597026383085

Response Example When All Succeed

{
  "id": "1513",
  "op": "batch-amend-orders",
  "data": [
    {
      "clOrdId": "oktswap6",
      "ordId": "12345689",
      "reqId": "b12344",
      "sCode": "0",
      "sMsg": ""
    },
    {
      "clOrdId": "oktswap7",
      "ordId": "12344",
      "reqId": "b12344",
      "sCode": "0",
      "sMsg": ""
    }
  ],
  "code": "0",
  "msg": ""
}

Response Example When All Failed

{
  "id": "1513",
  "op": "batch-amend-orders",
  "data": [
    {
      "clOrdId": "",
      "ordId": "12345689",
      "reqId": "b12344",
      "sCode": "5XXXX",
      "sMsg": "order not exist"
    },
    {
      "clOrdId": "oktswap7",
      "ordId": "",
      "reqId": "b12344",
      "sCode": "5XXXX",
      "sMsg": "order not exist"
    }
  ],
  "code": "1",
  "msg": ""
}

Response Example When Partially Successful

{
  "id": "1513",
  "op": "batch-amend-orders",
  "data": [
    {
      "clOrdId": "",
      "ordId": "12345689",
      "reqId": "b12344",
      "sCode": "0",
      "sMsg": ""
    },
    {
      "clOrdId": "oktswap7",
      "ordId": "",
      "reqId": "b12344",
      "sCode": "5XXXX",
      "sMsg": "order not exist"
    }
  ],
  "code": "2",
  "msg": ""
}

Response Example When Format Error

{
  "id": "1513",
  "op": "batch-amend-orders",
  "data": [],
  "code": "60013",
  "msg": "Invalid args"
}

Response Parameters

Parameter Type Description
id String Unique identifier of the message
op String Operation
code String Error Code
msg String Error message
data Array Data
> ordId String Order ID
> clOrdId String Client Order ID as assigned by the client
> reqId String Client Request ID as assigned by the client for order amendment
If the user provides reqId in the request, the corresponding reqId will be returned
> sCode String Order status code, 0 means success
> sMsg String Order status message

Private channel

Account channel

Retrieve account information. Data will be pushed when triggered by events such as placing order, canceling order, transaction execution, etc. It will also be pushed in regular interval according to subscription granularity.

Request Example : single

{
  "op": "subscribe",
  "args": [
    {
      "channel": "account",
      "ccy": "BTC"
    }
  ]
}

Request Example

{
  "op": "subscribe",
  "args": [
    {
      "channel": "account"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, account
> ccy String No Currency

Successful Response Example : single

{
  "event": "subscribe",
  "arg": {
    "channel": "account",
    "ccy": "BTC"
  }
}

Successful Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "account"
  }
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"account\", \"ccy\" : \"BTC\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Operation, subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name, account
> ccy String No Currency
code String No Error code
msg String No Error message

Push Data Example: single

{
    "arg": {
        "channel": "account",
        "uid": "1300041872592896"
    },
    "data": [
        {
            "adjEq": "",
            "details": [
                {
                    "availBal": "1.63093282565",
                    "availEq": "",
                    "cashBal": "1.63093282565",
                    "ccy": "USD",
                    "coinUsdPrice": "1",
                    "crossLiab": "",
                    "disEq": "0",
                    "eq": "1.63093282565",
                    "eqUsd": "1.63093282565",
                    "fixedBal": "0",
                    "frozenBal": "0",
                    "interest": "",
                    "isoEq": "",
                    "isoLiab": "",
                    "isoUpl": "",
                    "liab": "",
                    "maxLoan": "",
                    "mgnRatio": "",
                    "notionalLever": "",
                    "ordFrozen": "0",
                    "spotInUseAmt": "",
                    "stgyEq": "0",
                    "twap": "0",
                    "uTime": "1672814726203",
                    "upl": ""
                }
            ],
            "imr": "",
            "isoEq": "",
            "mgnRatio": "",
            "mmr": "",
            "notionalUsd": "",
            "ordFroz": "",
            "totalEq": "1.63100282285",
            "uTime": "1672814733845"
        }
    ]
}

Push Data Example

{
    "arg": {
        "channel": "account",
        "uid": "1300041872592896"
    },
    "data": [
        {
            "adjEq": "",
            "details": [
                {
                    "availBal": "1.63093282565",
                    "availEq": "",
                    "cashBal": "1.63093282565",
                    "ccy": "USD",
                    "coinUsdPrice": "1",
                    "crossLiab": "",
                    "disEq": "0",
                    "eq": "1.63093282565",
                    "eqUsd": "1.63093282565",
                    "fixedBal": "0",
                    "frozenBal": "0",
                    "interest": "",
                    "isoEq": "",
                    "isoLiab": "",
                    "isoUpl": "",
                    "liab": "",
                    "maxLoan": "",
                    "mgnRatio": "",
                    "notionalLever": "",
                    "ordFrozen": "0",
                    "spotInUseAmt": "",
                    "stgyEq": "0",
                    "twap": "0",
                    "uTime": "1672814726203",
                    "upl": ""
                },
                {
                    "availBal": "0.00007",
                    "availEq": "",
                    "cashBal": "0.00007",
                    "ccy": "USDT",
                    "coinUsdPrice": "0.99996",
                    "crossLiab": "",
                    "disEq": "0",
                    "eq": "0.00007",
                    "eqUsd": "0.0000699972",
                    "fixedBal": "0",
                    "frozenBal": "0",
                    "interest": "",
                    "isoEq": "",
                    "isoLiab": "",
                    "isoUpl": "",
                    "liab": "",
                    "maxLoan": "",
                    "mgnRatio": "",
                    "notionalLever": "",
                    "ordFrozen": "0",
                    "spotInUseAmt": "",
                    "stgyEq": "0",
                    "twap": "0",
                    "uTime": "1672814726203",
                    "upl": ""
                }
            ],
            "imr": "",
            "isoEq": "",
            "mgnRatio": "",
            "mmr": "",
            "notionalUsd": "",
            "ordFroz": "",
            "totalEq": "1.63100282285",
            "uTime": "1672814733845"
        }
    ]
}

Push data parameters

Parameters Types Description
arg Object Successfully subscribed channel
> channel String Channel name
> uid String User Identifier
data Array Subscribed data
> uTime String The latest time to get account information, millisecond format of Unix timestamp, e.g. 1597026383085
> totalEq String Total equity in USD
> isoEq String Isolated margin equity in USD. Not enabled. Please disregard.
> adjEq String Adjusted / Effective equity in USD. Not enabled. Please disregard.
> ordFroz String Margin frozen for pending cross orders in USD. Not enabled. Please disregard.
> imr String Frozen equity for open positions and pending orders in USD. Not enabled. Please disregard.
> mmr String Maintenance margin requirement in USD . Not enabled. Please disregard.
> mgnRatio String Margin ratio in USD . Not enabled. Please disregard.
> notionalUsd String Notional value of positions in USD . Not enabled. Please disregard.
> details Array Detailed asset information in all currencies
>> ccy String Currency
>> eq String Equity of the currency
>> cashBal String Cash Balance
>> uTime String Update time, Unix timestamp format in milliseconds, e.g. 1597026383085
>> isoEq String Isolated margin equity of the currency. Not enabled. Please disregard.
>> availEq String Available equity of the currency. Not enabled. Please disregard.
>> disEq String Discount equity of the currency in USD
>> availBal String Available balance of the currency
>> frozenBal String Frozen balance of the currency
>> ordFrozen String Margin frozen for open orders
>> liab String Liabilities of the currency. Not enabled. Please disregard.
>> upl String Unrealized profit and loss of the currency. Not enabled. Please disregard.
>> uplLiab String Liabilities due to Unrealized loss of the currency. Not enabled. Please disregard.
>> crossLiab String Cross Liabilities of the currency. Not enabled. Please disregard.
>> isoLiab String Isolated Liabilities of the currency. Not enabled. Please disregard.
>> mgnRatio String Margin ratio of the currency. Not enabled. Please disregard.
>> interest String Interest of the currency. Not enabled. Please disregard.
>> twap String System is forced repayment(TWAP) indicator. Not enabled. Please disregard.
>> maxLoan String Max loan of the currency. Not enabled. Please disregard.
>> eqUsd String Equity usd of the currency
>> notionalLever String Leverage of the currency. Not enabled. Please disregard.
>> coinUsdPrice String Price index usd of the currency
>> stgyEq String strategy equity
>> isoUpl String Isolated unrealized profit and loss of the currency. Not enabled. Please disregard.
>> spotInUseAmt String Spot in use amount. Not enabled. Please disregard.

Order channel

Retrieve order information. Data will not be pushed when first subscribed. Data will only be pushed when triggered by events such as placing/canceling order.

Request Example : single

{
    "op": "subscribe",
    "args": [{
        "channel": "orders",
        "instType": "SPOT",
        "instId": "BTC-USD"
    }]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, orders
> instType String Yes Instrument type
SPOT
> instId String No Instrument ID

Successful Response Example : single

{
    "event": "subscribe",
    "arg": {
        "channel": "orders",
        "instType": "SPOT",
        "instId": "BTC-USD"
    }
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"orders\", \"instType\" : \"SPOTT\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name
> instType String Yes Instrument type
SPOT
> instId String No Instrument ID
code String No Error code
msg String No Error message

Push Data Example: single

{
    "arg": {
        "channel": "orders",
        "instType": "SPOT",
        "instId": "ETH-USD",
        "uid": "1300041872592896"
    },
    "data": [
        {
            "accFillSz": "0",
            "amendResult": "",
            "avgPx": "0",
            "cTime": "1672898607313",
            "category": "normal",
            "ccy": "",
            "clOrdId": "",
            "code": "0",
            "execType": "",
            "fee": "0",
            "feeCcy": "ETH",
            "fillFee": "0",
            "fillFeeCcy": "",
            "fillNotionalUsd": "",
            "fillPx": "",
            "fillSz": "0",
            "fillTime": "",
            "instId": "ETH-USD",
            "instType": "SPOT",
            "lever": "0",
            "msg": "",
            "notionalUsd": "0.25",
            "ordId": "531110485559349248",
            "ordType": "limit",
            "pnl": "0",
            "posSide": "",
            "px": "250",
            "rebate": "0",
            "rebateCcy": "USD",
            "reduceOnly": "false",
            "reqId": "",
            "side": "buy",
            "slOrdPx": "",
            "slTriggerPx": "",
            "slTriggerPxType": "last",
            "source": "",
            "state": "live",
            "sz": "0.001",
            "tag": "",
            "tdMode": "cash",
            "tgtCcy": "",
            "tpOrdPx": "",
            "tpTriggerPx": "",
            "tpTriggerPxType": "last",
            "tradeId": "",
            "uTime": "1672898607313"
        }
    ]
}

Push data parameters

Parameter Type Description
arg Object Successfully subscribed channel
> channel String Channel name
> uid String User Identifier
> instType String Instrument type
> instId String Instrument ID
data Array Subscribed data
> instType String Instrument type
> instId String Instrument ID
> tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market orders.
Default is quote_ccy for buy, base_ccy for sell
> ccy String Margin currency. Not enabled. Please disregard.
> ordId String Order ID
> clOrdId String Client Order ID as assigned by the client
> tag String Order tag
> px String Order price
> sz String The original order quantity, SPOT, in the unit of currency;
> notionalUsd String Estimated national value in USD of order
> ordType String Order type
market: market order
limit: limit order
post_only: Post-only order
fok: Fill-or-kill order
ioc: Immediate-or-cancel order
> side String Order side, buy sell
> posSide String Position side. Not enabled. Please disregard.
> tdMode String Trade mode, cash: cash
> fillPx String Last filled price
> tradeId String Last trade ID
> fillSz String Last filled quantity
> fillTime String Last filled time
> fillFee String last filled fee amount or rebate amount:
Negative number represents the user transaction fee charged by the platform;
Positive number represents rebate
> fillFeeCcy String last filled fee currency
> execType String Liquidity taker or maker of the last filled, T: taker M: maker
> accFillSz String Accumulated fill quantity
> fillNotionalUsd String Filled notional value in USD of order
> avgPx String Average filled price. If none is filled, it will return 0.
> state String Order state
canceled
live
partially_filled
filled
> lever String Leverage. Not enabled. Please disregard.
> tpTriggerPx String Take-profit trigger price
> tpTriggerPxType String Take-profit trigger price type.
last: last price
> tpOrdPx String Take-profit order price
> slTriggerPx String Stop-loss trigger price
> slTriggerPxType String Stop-loss trigger price type.
last: last price
> slOrdPx String Stop-loss order price
> feeCcy String Fee currency
SPOT: If you buy, you will receive BTC; if you sell, you will receive USDT
> fee String Fee and rebate
For spot, it is accumulated fee charged by the platform. It is always negative, e.g. -0.01.
> rebateCcy String Rebate currency, if there is no rebate, this field is "".
> rebate String Rebate accumulated amount, only applicable to spot, the reward of placing orders from the platform (rebate) given to user who has reached the specified trading level. If there is no rebate, this field is "".
> pnl String Profit and loss. Not enabled. Please disregard.
> source String Order source
13:The generated limit order after the strategy order is triggered
> category String Category
normal
> uTime String Update time, Unix timestamp format in milliseconds, e.g. 1597026383085
> cTime String Creation time, Unix timestamp format in milliseconds, e.g. 1597026383085
> reqId String Client Request ID as assigned by the client for order amendment. "" will be returned if there is no order amendment.
> amendResult String The result of amending the order
-1: failure
0: success
1: Automatic cancel (due to failed amendment)
When amending the order through API and the amendment failed, -1 will be returned if cxlOnFail is set to false. Otherwise 1 will be returned if cxlOnFail is set to true.
When amending the order through Web/APP and the amendment failed, -1 will be returned.
> code String Error Code, the default is 0
> msg String Error Message, The default is ""

Algo orders channel

Retrieve algo orders (includes trigger order, oco order, conditional order). Data will not be pushed when first subscribed. Data will only be pushed when triggered by events such as placing/canceling order.

Request Example : single

{
    "op": "subscribe",
    "args": [
        {
            "channel": "orders-algo",
            "instType": "SPOT",
            "instId": "BTC-USD"
        }
    ]
}

Request Example

{
    "op": "subscribe",
    "args": [
        {
            "channel": "orders-algo",
            "instType": "SPOT"
        }
    ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, orders-algo
> instType String Yes Instrument type
SPOT
> instId String No Instrument ID

Successful Response Example : single

{
    "event": "subscribe",
    "arg": {
        "channel": "orders-algo",
        "instType": "SPOT",
        "instId": "BTC-USD"
    }
}

Successful Response Example

{
    "event": "subscribe",
    "arg": {
        "channel": "orders-algo",
        "instType": "SPOT"
    }
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"orders-algo\", \"instType\" : \"SPOTT\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name
> instType String Yes Instrument type
SPOT
> instId String No Instrument ID
code String No Error code
msg String No Error message

Push Data Example: single

{
    "arg": {
        "channel": "orders-algo",
        "uid": "77982378738415879",
        "instType": "SPOT",
        "instId": "BTC-USD"
    },
    "data": [{
        "instType": "SPOT",
        "instId": "BTC-USD",
        "ordId": "312269865356374016",
        "ccy": "BTC",
        "clOrdId": "",
        "algoId": "1234",
        "px": "999",
        "sz": "3",
        "tdMode": "cash",
        "tgtCcy": "",
        "notionalUsd": "",
        "ordType": "trigger",
        "side": "buy",
        "posSide": "net",
        "state": "live",
        "lever": "20",
        "tpTriggerPx": "",
        "tpTriggerPxType": "",
        "tpOrdPx": "",
        "slTriggerPx": "",
        "slTriggerPxType": "",
        "triggerPx": "99",
        "triggerPxType": "last",
        "ordPx": "12",
        "tag": "adadadadad",
        "actualSz": "",
        "actualPx": "",
        "actualSide": "",
        "triggerTime": "1597026383085",
        "cTime": "1597026383000"
    }]
}

Response parameters when data is pushed.

Parameter Type Description
arg Object Successfully subscribed channel
> channel String Channel name
> uid String User Identifier
> instType String Instrument type
> instId String Instrument ID
data Array Subscribed data
> instType String Instrument type
> instId String Instrument ID
> ccy String Margin currency. Not enabled. Please disregard.
> ordId String Order ID, the order ID associated with the algo order.
> algoId String Algo ID
> clOrdId String Client Order ID as assigned by the client
> sz String Quantity to buy or sell. SPOT: in the unit of currency.
> ordType String Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order
> side String Order side, buy sell
> posSide String Position side. Not enabled. Please disregard.
> tdMode String Trade mode, cash: cash
> tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
> lever String Leverage. Not enabled. Please disregard.
> state String Order status
live: to be effective
effective: effective
canceled: canceled
order_failed: order failed
> tpTriggerPx String Take-profit trigger price.
> tpTriggerPxType String Take-profit trigger price type.
last: last price
> tpOrdPx String Take-profit order price.
> slTriggerPx String Stop-loss trigger price.
> slTriggerPxType String Stop-loss trigger price type.
last: last price
> slOrdPx String Stop-loss order price.
> triggerPx String Trigger price
> triggerPxType String Trigger price type.
last: last price
> ordPx String Order price
> actualSz String Actual order quantity
> actualPx String Actual order price
> notionalUsd String Estimated national value in USD of order
> tag String Order tag
> actualSide String Actual trigger side
> triggerTime String Trigger time, Unix timestamp format in milliseconds, e.g. 1597026383085
> reduceOnly String Whether the order can only reduce the position size. Valid options: true or false.
> cTime String Creation time, Unix timestamp format in milliseconds, e.g. 1597026383085

Advance algo orders channel

Retrieve advance algo orders (including Iceberg order, TWAP order, Trailing order). Data will be pushed when first subscribed. Data will be pushed when triggered by events such as placing/canceling order.

Request Example : single

{
  "op": "subscribe",
  "args": [
    {
      "channel": "algo-advance",
      "instType": "SPOT",
      "instId": "BTC-USD"
    }
  ]
}

Request Example

{
  "op": "subscribe",
  "args": [
    {
      "channel": "algo-advance",
      "instType": "SPOT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, algo-advance
> instType String Yes Instrument type
SPOT
> instId String No Instrument ID
> algoId String No Algo Order ID

Successful Response Example : single

{
  "event": "subscribe",
  "arg": {
    "channel": "algo-advance",
    "instType": "SPOT",
    "instId": "BTC-USD"
  }
}

Successful Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "algo-advance",
    "instType": "SPOT"
  }
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"algo-advance\", \"instType\" : \"SPOTT\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name
> instType String Yes Instrument type
SPOT
> instId String No Instrument ID
> algoId String No Algo Order ID
code String No Error code
msg String No Error message

Push Data Example: single

{
    "arg":{
        "channel":"algo-advance",
        "uid": "77982378738415879",
        "instType":"SPOT",
        "instId":"BTC-USD"
    },
    "data":[
        {
            "actualPx":"",
            "actualSide":"",
            "actualSz":"0",
            "algoId":"355056228680335360",
            "cTime":"1630924001545",
            "ccy":"",
            "clOrdId": "",
            "count":"1",
            "instId":"BTC-USD",
            "instType":"SPOT",
            "lever":"0",
            "notionalUsd":"",
            "ordPx":"",
            "ordType":"iceberg",
            "pTime":"1630924295204",
            "posSide":"net",
            "pxLimit":"10",
            "pxSpread":"1",
            "pxVar":"",
            "side":"buy",
            "slOrdPx":"",
            "slTriggerPx":"",
            "state":"pause",
            "sz":"0.1",
            "szLimit":"0.1",
            "tdMode":"cash",
            "timeInterval":"",
            "tpOrdPx":"",
            "tpTriggerPx":"",
            "tag": "adadadadad",
            "triggerPx":"",
            "triggerTime":"",
            "callbackRatio":"",
            "callbackSpread":"",
            "activePx":"",
            "moveTriggerPx":""
        }
    ]
}

Response parameters when data is pushed.

Parameter Type Description
arg Object Successfully subscribed channel
> channel String Channel name
> uid String User Identifier
> instType String Instrument type
> instId String Instrument ID
> algoId String Algo Order ID
data Array Subscribed data
> instType String Instrument type
> instId String Instrument ID
> ccy String Margin currency. Not enabled. Please disregard.
> ordId String Order ID, the order ID associated with the algo order.
> algoId String Algo ID
> clOrdId String Client Order ID as assigned by the client
> sz String Quantity to buy or sell. SPOT: in the unit of currency.
> ordType String Order type
iceberg: Iceberg order
twap: TWAP order
move_order_stop: Trailing order
> side String Order side, buy sell
> posSide String Position side. Not enabled. Please disregard.
> tdMode String Trade mode, cash: cash
> tgtCcy String Order quantity unit setting for sz
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT Market Orders
Default is quote_ccy for buy, base_ccy for sell
> lever String Leverage. Not enabled. Please disregard.
> state String Order status
live: to be effective
effective: effective
canceled: canceled
order_failed: order failed
> tpTriggerPx String Take-profit trigger price.
> tpOrdPx String Take-profit order price.
> slTriggerPx String Stop-loss trigger price.
> slOrdPx String Stop-loss order price.
> triggerPx String Trigger price
> ordPx String Order price
> actualSz String Actual order quantity
> actualPx String Actual order price
> notionalUsd String Estimated national value in USD of order
> tag String Order tag
> actualSide String Actual trigger side
> triggerTime String Trigger time, Unix timestamp format in milliseconds, e.g. 1597026383085
> cTime String Creation time, Unix timestamp format in milliseconds, e.g. 1597026383085
> pxVar String Price ratio
Only applicable to iceberg order or twap order
> pxSpread String Price variance
Only applicable to iceberg order or twap order
> szLimit String Average amount
Only applicable to iceberg order or twap order
> pxLimit String Price limit
Only applicable to iceberg order or twap order
> timeInterval String Time interval
Only applicable to twap order
> count String Algo Order count
Only applicable to iceberg order or twap order
> callbackRatio String Callback price ratio
Only applicable to move_order_stop order
> callbackSpread String Callback price variance
Only applicable to move_order_stop order
> activePx String Active price
Only applicable to move_order_stop order
> moveTriggerPx String Trigger price
Only applicable to move_order_stop order
> pTime String Push time of algo order information, millisecond format of Unix timestamp, e.g. 1597026383085

Public channel

Instruments channel

The instruments will be pushed if there is any change to the instrument’s state (such as listing of new trading pairs, trading suspension, etc.).

Request Example

{
  "op": "subscribe",
  "args": [
    {
      "channel": "instruments",
      "instType": "SPOT"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, instruments
> instType String Yes Instrument type
SPOT

Successful Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "instruments",
    "instType": "SPOT"
  }
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"instruments\", \"instType\" : \"SPOTT\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name
> instType String Yes Instrument type
SPOT
code String No Error code
msg String No Error message

Push Data Example

{
    "arg": {
        "channel": "instruments",
        "instType": "SPOT"
    },
    "data": [
        {
            "alias": "",
            "baseCcy": "BTC",
            "category": "1",
            "ctMult": "",
            "ctType": "",
            "ctVal": "",
            "ctValCcy": "",
            "expTime": "",
            "instFamily": "",
            "instId": "BTC-USD",
            "instType": "SPOT",
            "lever": "",
            "listTime": "",
            "lotSz": "0.0001",
            "maxIcebergSz": "",
            "maxLmtSz": "99999999999999",
            "maxMktSz": "1000000",
            "maxStopSz": "1000000",
            "maxTriggerSz": "",
            "maxTwapSz": "",
            "minSz": "0.0001",
            "optType": "",
            "quoteCcy": "USD",
            "settleCcy": "",
            "state": "live",
            "stk": "",
            "tickSz": "0.01",
            "uly": ""
        }
    ]
}

Push data parameters

Parameter Type Description
arg Object Subscribed channel
> channel String Channel name
> instType String Instrument type
data Array Subscribed data
> instType String Instrument type
> instId String Instrument ID, e.g. BTC-USD
> uly String Underlying. Not enabled. Please disregard.
> instFamily String Instrument family. Not enabled. Please disregard.
> category String Fee Schedule. Not enabled. Please disregard.
> baseCcy String Base currency, e.g. BTC in BTC-USD
> quoteCcy String Quote currency, e.g. USD in BTC-USD
> settleCcy String Settlement and margin currency. Not enabled. Please disregard.
> ctVal String Contract value. Not enabled. Please disregard.
> ctMult String Contract multiplier. Not enabled. Please disregard.
> ctValCcy String Contract value currency. Not enabled. Please disregard.
> optType String Option type. Not enabled. Please disregard.
> stk String Strike price. Not enabled. Please disregard.
> listTime String Listing time
> expTime String Expiry time. Not enabled. Please disregard.
> lever String Max Leverage. Not enabled. Please disregard.
> tickSz String Tick size, e.g. 0.0001
> lotSz String Lot size,e.g. BTC-USD: 1
> minSz String Minimum order size
> ctType String Contract type, linear: linear contract inverse: inverse contract. Not enabled. Please disregard.
> alias String Alias. Not enabled. Please disregard.
> state String Instrument status
live
suspend
preopen
> maxLmtSz String The maximum order quantity of the spot limit order
> maxMktSz String The maximum order quantity of the spot market order
> maxTwapSz String The maximum order quantity of the spot twap order
> maxIcebergSz String The maximum order quantity of the spot iceBerg order
> maxTriggerSz String The maximum order quantity of the spot trigger order
> maxStopSz String The maximum order quantity of the spot stop order

Tickers channel

Retrieve the last traded price, bid price, ask price and 24-hour trading volume of instruments.
The fastest rate is 1 update/100ms. There will be no update if the event is not triggered. The events which can trigger update: trade, the change on best ask/bid.

Request Example

{
  "op": "subscribe",
  "args": [
    {
      "channel": "tickers",
      "instId": "BTC-USD"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, tickers
> instId String Yes Instrument ID

Successful Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "tickers",
    "instId": "BTC-USD"
  }
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"tickers\", \"instId\" : \"BTC-USDD\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name
> instId String Yes Instrument ID
code String No Error code
msg String No Error message

Push Data Example

{
    "arg": {
        "channel": "tickers",
        "instId": "BTC-USD"
    },
    "data": [
        {
            "instType": "SPOT",
            "instId": "BTC-USD",
            "last": "16838.75",
            "lastSz": "0.0027",
            "askPx": "16838.75",
            "askSz": "0.0275",
            "bidPx": "16836.5",
            "bidSz": "0.0404",
            "open24h": "16762.13",
            "high24h": "16943.44",
            "low24h": "16629.04",
            "sodUtc0": "16688.74",
            "sodUtc8": "16700.35",
            "volCcy24h": "3016898.9552",
            "vol24h": "179.6477",
            "ts": "1672842446928"
        }
    ]
}

Push data parameters

Parameter Type Description
arg Object Successfully subscribed channel
> channel String Channel name
> instId String Instrument ID
data Array Subscribed data
> instType String Instrument type
> instId String Instrument ID
> last String Last traded price
> lastSz String Last traded size
> askPx String Best ask price
> askSz String Best ask size
> bidPx String Best bid price
> bidSz String Best bid size
> open24h String Open price in the past 24 hours
> high24h String Highest price in the past 24 hours
> low24h String Lowest price in the past 24 hours
> volCcy24h String 24h trading volume, with a unit of currency.
The value is the quantity in quote currency.
> vol24h String 24h trading volume, with a unit of contract.
The value is the quantity in base currency.
>sodUtc0 String Open price in the UTC 0
>sodUtc8 String Open price in the UTC 8
> ts String Ticker data generation time, Unix timestamp format in milliseconds, e.g. 1597026383085

Candlesticks channel

Retrieve the candlesticks data of an instrument. the push frequency is the fastest interval 1 second push the data.

Request Example

{
  "op": "subscribe",
  "args": [
    {
      "channel": "candle1D",
      "instId": "BTC-USD"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
channel String Yes Channel name
candle3M candle1M
candle1W
candle1D candle2D candle3D candle5D
candle12H candle6H candle4H candle2H candle1H
candle30m candle15m candle5m candle3m candle1m
candle3Mutc candle1Mutc candle1Wutc candle1Dutc candle2Dutc candle3Dutc candle5Dutc candle12Hutc candle6Hutc
instId String Yes Instrument ID

Successful Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "candle1D",
    "instId": "BTC-USD"
  }
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"candle1D\", \"instId\" : \"BTC-USD-191227\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
channel String yes channel name
instId String Yes Instrument ID
code String No Error code
msg String No Error message

Push Data Example

{
    "arg": {
        "channel": "candle1m",
        "instId": "BTC-USD"
    },
    "data": [
        [
            "1672913160000",
            "16837.25",
            "16837.25",
            "16837.25",
            "16837.25",
            "0.0438",
            "737.4716",
            "737.4716",
            "1"
        ]
    ]
}

Push data parameters

Parameter Type Description
arg Object Successfully subscribed channel
> channel String Channel name
> instId String Instrument ID
data Array Subscribed data
> ts String Opening time of the candlestick, Unix timestamp format in milliseconds, e.g. 1597026383085
> o String Open price
> h String highest price
> l String Lowest price
> c String Close price
> vol String Trading volume, the value is the quantity in base currency.
> volCcy String Trading volume, the value is the quantity in quote currency.
> volCcyQuote String Trading volume, the value is the quantity in quote currency. Not enabled. Please disregard.
> confirm String The state of candlesticks.
0 represents that it is uncompleted, 1 represents that it is completed.

Trades channel

Retrieve the recent trades data. Data will be pushed whenever there is a trade. Every update contain only one trade.

Request Example

{
  "op": "subscribe",
  "args": [
    {
      "channel": "trades",
      "instId": "BTC-USD"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, trades
> instId String Yes Instrument ID

Successful Response Example

{
  "event": "subscribe",
  "args": {
      "channel": "trades",
      "instId": "BTC-USD"
    }  
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"trades\"\"instId\" : \"BTC-USD-191227\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name
> instId String Yes Instrument ID
code String No Error code
msg String No Error message

Push Data Example

{
  "arg": {
    "channel": "trades",
    "instId": "BTC-USD"
  },
  "data": [
    {
      "instId": "BTC-USD",
      "tradeId": "130639474",
      "px": "42219.9",
      "sz": "0.12060306",
      "side": "buy",
      "ts": "1630048897897"
    }
  ]
}

Push data parameters

Parameter Type Description
arg Object Successfully subscribed channel
> channel String Channel name
> instId String Instrument ID
data Array Subscribed data
> instId String Instrument ID, e.g. BTC-USD
> tradeId String Trade ID
> px String Trade price
> sz String Trade size
> side String Trade direction, buy, sell
> ts String Filled time, Unix timestamp format in milliseconds, e.g. 1597026383085

Order book channel

Retrieve order book data.

Use books for 400 depth levels, book5 for 5 depth levels, bbo-tbt tick-by-tick 1 depth level, books50-l2-tbt tick-by-tick 50 depth levels, and books-l2-tbt for tick-by-tick 400 depth levels.

Identity verification refers to Login

Request Example

{
  "op": "subscribe",
  "args": [
    {
      "channel": "books",
      "instId": "BTC-USD"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes Operation, subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, books books5 books50-l2-tbt books-l2-tbt
> instId String Yes Instrument ID

Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "books",
    "instId": "BTC-USD"
  }
}

Failure example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"books\"\"instId\" : \"BTC-USDC\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes Event, subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name
> instId String Yes Instrument ID
msg String No Error message
code String No Error code

Push Data Example: Full Snapshot

{
  "arg": {
    "channel": "books",
    "instId": "BTC-USD"
  },
  "action": "snapshot",
  "data": [
    {
      "asks": [
        ["8476.98", "415", "0", "13"],
        ["8477", "7", "0", "2"],
        ["8477.34", "85", "0", "1"],
        ["8477.56", "1", "0", "1"],
        ["8505.84", "8", "0", "1"],
        ["8506.37", "85", "0", "1"],
        ["8506.49", "2", "0", "1"],
        ["8506.96", "100", "0", "2"]
      ],
      "bids": [
        ["8476.97", "256", "0", "12"],
        ["8475.55", "101", "0", "1"],
        ["8475.54", "100", "0", "1"],
        ["8475.3", "1", "0", "1"],
        ["8447.32", "6", "0", "1"],
        ["8447.02", "246", "0", "1"],
        ["8446.83", "24", "0", "1"],
        ["8446", "95", "0", "3"]
      ],
      "ts": "1597026383085",
      "checksum": -855196043
    }
  ]
}

Push Data Example: Incremental Data

{
  "arg": {
    "channel": "books",
    "instId": "BTC-USD"
  },
  "action": "update",
  "data": [
    {
      "asks": [
        ["8476.98", "415", "0", "13"],
        ["8477", "7", "0", "2"],
        ["8477.34", "85", "0", "1"],
        ["8477.56", "1", "0", "1"],
        ["8505.84", "8", "0", "1"],
        ["8506.37", "85", "0", "1"],
        ["8506.49", "2", "0", "1"],
        ["8506.96", "100", "0", "2"]
      ],
      "bids": [
        ["8476.97", "256", "0", "12"],
        ["8475.55", "101", "0", "1"],
        ["8475.54", "100", "0", "1"],
        ["8475.3", "1", "0", "1"],
        ["8447.32", "6", "0", "1"],
        ["8447.02", "246", "0", "1"],
        ["8446.83", "24", "0", "1"],
        ["8446", "95", "0", "3"]
      ],
      "ts": "1597026383085",
      "checksum": -855196043
    }
  ]
}

Push data parameters

Parameter Type Description
arg Object Successfully subscribed channel
> channel String Channel name
> instId String Instrument ID
action String Push data action, incremental data or full snapshot.
snapshot: full
update: incremental
data Array Subscribed data
> asks Array Order book on sell side
> bids Array Order book on buy side
> ts String Order book generation time, Unix timestamp format in milliseconds, e.g. 1597026383085
> checksum Integer Checksum, implementation details below

Checksum

This mechanism can assist users in checking the accuracy of depth data.

Merging incremental data into full data

After subscribing to the incremental load push (such as books 400 levels) of Order Book Channel, users first receive the initial full load of market depth. After the incremental load is subsequently received, update the local full load.

  1. If there is the same price, compare the size. If the size is 0, delete this depth data. If the size changes, replace the original data.
  2. If there is no same price, sort by price (bid in descending order, ask in ascending order), and insert the depth information into the full load.
Calculate Checksum

Use the first 25 bids and asks in the full load to form a string (where a colon connects the price and size in an ask or a bid), and then calculate the CRC32 value (32-bit signed integer).

Calculate Checksum

1. More than 25 levels of bid and ask
A full load of market depth (only 2 levels of data are shown here, while 25 levels of data should actually be intercepted):
"bids": [
  ["3366.1", "7", "0", "3"],
  ["3366", "6", "3", "4"]
]
"asks": [
  ["3366.8", "9", "10", "3"],
  ["3368", "8", "3", "4"]
]
Check string:
"3366.1:7:3366.8:9:3366:6:3368:8"

2. Less than 25 levels of bid or ask
A full load of market depth:
"bids": [
  ["3366.1", "7", "0", "3"]
]
"asks": [
  ["3366.8", "9", "10", "3"],
  ["3368", "8", "3", "4"],
  ["3372", "8", "3", "4"]
]
Check string:
"3366.1:7:3366.8:9:3368:8:3372:8"
  1. When the bid and ask depth data exceeds 25 levels, each of them will intercept 25 levels of data, and the string to be checked is queued in a way that the bid and ask depth data are alternately arranged.
    Such as: bid[price:size]:ask[price:size]:bid[price:size]:ask[price:size]...
  2. When the bid or ask depth data is less than 25 levels, the missing depth data will be ignored.
    Such as: bid[price:size]:ask[price:size]:asks[price:size]:asks[price:size]...

Status channel

Get the status of system maintenance and push when the system maintenance status changes. First subscription: "Push the latest change data"; every time there is a state change, push the changed content

Request Example

{
  "op": "subscribe",
  "args": [
    {
      "channel": "status"
    }
  ]
}

Request parameters

Parameter Type Required Description
op String Yes subscribe unsubscribe
args Array Yes List of subscribed channels
> channel String Yes Channel name, status

Successful Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "status"
  }
}

Failure Response Example

{
  "event": "error",
  "code": "60012",
  "msg": "Invalid request: {\"op\": \"subscribe\", \"argss\":[{ \"channel\" : \"statuss\"}]}"
}

Response parameters

Parameter Type Required Description
event String Yes subscribe unsubscribe error
arg Object No Subscribed channel
> channel String Yes Channel name, status
code String No Error code
msg String No Error message

Push Data Example

{
    "arg": {
        "channel": "status"
    },
    "data": [{
        "title": "Spot System Upgrade",
        "state": "scheduled",
        "begin": "1610019546",
        "href": "",
        "end": "1610019546",
        "serviceType": "1",
        "system": "classic",
        "scheDesc": "",
        "ts": "1597026383085"
    }]
}

Push data parameters

Parameter Type Description
arg Object Successfully subscribed channel
> channel String Channel name
data Array Subscribed data
> title String The title of system maintenance instructions
> state String System maintenance status,scheduled: waiting; ongoing: processing; pre_open: pre_open; completed: completed ;canceled: canceled.
Generally, pre_open last about 10 minutes. There will be pre_open when the time of upgrade is too long.
> begin String Start time of system maintenance, Unix timestamp format in milliseconds, e.g. 1617788463867
> end String Time of resuming trading totally. Unix timestamp format in milliseconds, e.g. 1617788463867.
It is expected end time before completed, changed to actual end time after completed.
> preOpenBegin String The time of pre_open. Canceling orders, placing Post Only orders, and transferring funds to trading accounts are back after preOpenBegin.
> href String Hyperlink for system maintenance details, if there is no return value, the default value will be empty. e.g. “”
> serviceType String Service type, 0:WebSocket ; 1:Classic account 5:Unified account; 99: Others (e.g. Suspend partial instruments)
> system String System, classic: Classic account unified: Unified account
> scheDesc String Rescheduled description, e.g. Rescheduled from 2021-01-26T16:30:00.000Z to 2021-01-28T16:30:00.000Z
> ts String Push time, Unix timestamp format in milliseconds, e.g. 1617788463867

Error Code

Here is the REST API Error Code

REST

REST API Error Code is from 50000 to 59999.

Public

Error Code from 50000 to 53999

General Class

Error Code HTTP Status Code Error Message
0 200
1 200 Operation failed.
2 200 Bulk operation partially succeeded.
50000 400 Body cannot be empty.
50001 503 Service temporarily unavailable, please try again later.
50002 400 Json data format error.
50004 400 Endpoint request timeout (does not mean that the request was successful or failed,
please check the request result).
50005 410 API is offline or unavailable.
50006 400 Invalid Content_Type, please use "application/json" format.
50007 200 Account blocked.
50008 200 User does not exist.
50009 200 Account is suspended due to ongoing liquidation.
50010 200 User ID cannot be empty.
50011 429 Requests too frequent.
50012 200 Account status invalid.
50013 429 System is busy, please try again later.
50014 400 Parameter {0} cannot be empty.
50015 400 Either parameter {0} or {1} is required.
50016 400 Parameter {0} does not match parameter {1}.
50024 200 Parameter {0} and {1} cannot exist at the same time.
50025 200 Parameter {0} count exceeds the limit {1}.
50026 500 System error, please try again later.
50027 200 The account is restricted from trading.
50028 200 Unable to take the order, please reach out to support center for details.
50029 200 This instrument ({0}) is unavailable at present due to risk management.
Please contact customer service for help.
50030 200 No permission to use this API
50032 200 This asset is blocked, allow its trading and try again
50033 200 This instrument is blocked, allow its trading and try again
50035 403 This endpoint requires that APIKey must be bound to IP
50036 200 Invalid expTime
50037 200 Order expired
50038 200 This feature is temporarily unavailable in demo trading
50039 200 The before parameter is not available for implementing timestamp pagination
50041 200 You are not currently on the whitelist, please contact customer service

API Class

Error Code HTTP Status Code Error Message
50100 400 API frozen, please contact customer service.
50101 401 APIKey does not match current environment.
50102 401 Timestamp request expired.
50103 401 Request header "OK-ACCESS-KEY" cannot be empty.
50104 401 Request header "OK-ACCESS-PASSPHRASE" cannot be empty.
50105 401 Request header "OK-ACCESS-PASSPHRASE" incorrect.
50106 401 Request header "OK-ACCESS-SIGN" cannot be empty.
50107 401 Request header "OK-ACCESS-TIMESTAMP" cannot be empty.
50108 401 Exchange ID does not exist.
50109 401 Exchange domain does not exist.
50110 401 Your IP {0} is not included in your API key's IP whitelist.
50111 401 Invalid OK-ACCESS-KEY.
50112 401 Invalid OK-ACCESS-TIMESTAMP.
50113 401 Invalid signature.
50114 401 Invalid authorization.
50115 405 Invalid request method.

Trade Class

Error Code HTTP Status code Error Message
51000 400 Parameter {0} error.
51001 200 Instrument ID does not exist.
51003 200 Either client order ID or order ID is required.
51005 200 Order amount exceeds the limit.
51006 200 Order price is not within the price limit (max buy price: {0} min sell price: {1})
51008 200 Order failed. Insufficient {0} balance in account
51008 200 Order failed. Insufficient account balance, and the adjusted equity in USD is less than IMR
51008 200 Order failed. Insufficient account balance
51009 200 Order placement function is blocked by the platform.
51010 200 Operation is not supported under the current account mode.
51011 200 Duplicated order ID.
51012 200 Token does not exist.
51014 200 Index does not exist.
51015 200 Instrument ID does not match instrument type.
51016 200 Duplicated client order ID.
51020 200 Order amount should be greater than the min available amount.
51023 200 Position does not exist.
51024 200 Trading account is blocked.
51025 200 Order count exceeds the limit.
51026 200 Instrument type does not match underlying index.
51030 200 Funding fee is being settled.
51031 200 This order price is not within the closing price range.
51032 200 Closing all positions at market price.
51033 200 The total amount per order for this pair has reached the upper limit.
51037 200 The current account risk status only supports you to place IOC orders that can reduce the risk of your account.
51038 200 There is already an IOC order under the current risk module that reduces the risk of the account.
51044 200 The order type {0}, {1} is not allowed to set stop loss and take profit
51046 200 The take profit trigger price should be higher than the order price
51047 200 The stop loss trigger price should be lower than the order price
51048 200 The take profit trigger price should be lower than the order price
51049 200 The stop loss trigger price should be higher than the order price
51050 200 The take profit trigger price should be higher than the best ask price
51051 200 The stop loss trigger price should be lower than the best ask price
51052 200 The take profit trigger price should be lower than the best bid price
51053 200 The stop loss trigger price should be higher than the best bid price
51054 500 Getting information timed out, please try again later
51056 200 Action not allowed
51058 200 No available position for this algo order
51059 200 Strategy for the current state does not support this operation
51101 200 Entered amount exceeds the max pending order amount (Cont)
per transaction.
51103 200 Entered amount exceeds the max pending order count of the underlying asset.
51104 200 Entered amount exceeds the max pending order amount (Cont)
of the underlying asset.
51106 200 Entered amount exceeds the max order amount (Cont) of the
underlying asset.
51107 200 Entered amount exceeds the max holding amount (Cont).
51109 200 No available offer.
51110 200 You can only place a limit order after Call Auction has started.
51111 200 Maximum {0} orders can be placed in bulk.
51112 200 Close order size exceeds your available size.
51113 429 Market-price liquidation requests too frequent.
51115 200 Cancel all pending close-orders before liquidation.
51116 200 Order price or trigger price exceeds {0}.
51117 200 Pending close-orders count exceeds limit.
51120 200 Order quantity is less than {0}, please try again.
51121 200 Order count should be the integer multiples of the lot size.
51122 200 Order price should be higher than the min price {0}.
51124 200 You can only place limit orders during call auction.
51127 200 Available balance is 0.
51129 200 The value of the position and buy order has reached the position limit,
and no further buying is allowed.
51131 200 Insufficient balance.
51132 200 Your position amount is negative and less than the minimum trading amount.
51134 200 Closing position failed. Please check your holdings and pending orders.
51135 200 Your closing price has triggered the limit price, and the max buy price is {0}.
51136 200 Your closing price has triggered the limit price, and the min sell price is {0}.
51137 200 Your opening price has triggered the limit price, and the max buy price is {0}.
51138 200 Your opening price has triggered the limit price, and the min sell price is {0}.
51139 200 Reduce-only feature is unavailable for the spot transactions by simple account.
51143 200 There is no valid quotation in the market, and the order cannot be filled in USDT mode, please try to switch to currency mode
51148 200 ReduceOnly cannot increase the position quantity.
51149 500 Order timed out, please try again later.
51150 200 The precision of the number of trades or the price exceeds the limit.
51201 200 Value of per market order cannot exceed 1,000,000 USDT.
51202 200 Market - order amount exceeds the max amount.
51203 200 Order amount exceeds the limit {0}.
51204 200 The price for the limit order cannot be empty.
51205 200 Reduce-Only is not available.
51206 200 Please cancel the Reduce Only order before placing the current {0} order to avoid opening a reverse position.
51250 200 Algo order price is out of the available range.
51251 200 Algo order type error (when user place an iceberg order).
51252 200 Algo order amount is out of the available range.
51253 200 Average amount exceeds the limit of per iceberg order.
51254 200 Iceberg average amount error (when user place an iceberg order).
51255 200 Limit of per iceberg order: Total amount/1000 < x <= Total amount.
51256 200 Iceberg order price variance error.
51257 200 Trail order callback rate error.
51258 200 Trail - order placement failed. The trigger price of a sell order
should be higher than the last transaction price.
51259 200 Trail - order placement failed. The trigger price of a buy order
should be lower than the last transaction price.
51260 200 Maximum {0} pending trail - orders can be held at the same time.
51261 200 Each user can hold up to {0} pending stop - orders at the same time.
51262 200 Maximum {0} pending iceberg orders can be held at the same time.
51263 200 Maximum {0} pending time-weighted orders can be held at the same time.
51264 200 Average amount exceeds the limit of per time-weighted order.
51265 200 Time-weighted order limit error.
51267 200 Time-weighted order strategy initiative rate error.
51268 200 Time-weighted order strategy initiative range error.
51269 200 Time-weighted order interval error, the interval should be {0}<= x<={1}.
51270 200 The limit of time-weighted order price variance is 0 < x <= 1%.
51271 200 Sweep ratio should be 0 < x <= 100%.
51272 200 Price variance should be 0 < x <= 1%.
51273 200 Total amount should be more than {0}.
51274 200 Total quantity of time-weighted order must be larger than single order limit.
51275 200 The amount of single stop-market order cannot exceed the upper limit.
51276 200 Stop - Market orders cannot specify a price.
51277 200 TP trigger price cannot be higher than the last price.
51278 200 SL trigger price cannot be lower than the last price.
51279 200 TP trigger price cannot be lower than the last price.
51280 200 SL trigger price cannot be higher than the last price.
51281 200 trigger not support the tgtCcy parameter.
51282 200 The range of Price variance is {0}~{1}
51283 200 The range of Time interval is {0}~{1}
51284 200 The range of Average amount is {0}~{1}
51285 200 The range of Total amount is {0}~{1}
51286 200 The total amount should not be less than {0}
51288 200 We are stopping the Bot. Please do not click it multiple times
51289 200 Bot configuration does not exist. Please try again later
51290 200 The Bot engine is being upgraded. Please try again later
51291 200 This Bot does not exist or has been stopped
51292 200 This Bot type does not exist
51293 200 This Bot does not exist
51294 200 This Bot cannot be created temporarily. Please try again later
51299 200 Order did not go through. You can hold maximum {0} orders of this type
51300 200 TP trigger price cannot be higher than the mark price
51302 200 SL trigger price cannot be lower than the mark price
51303 200 TP trigger price cannot be lower than the mark price
51304 200 SL trigger price cannot be higher than the mark price
51305 200 TP trigger price cannot be higher than the index price
51306 200 SL trigger price cannot be lower than the index price
51307 200 TP trigger price cannot be lower than the index price
51308 200 SL trigger price cannot be higher than the index price
51309 200 Cannot create trading bot during call auction
51311 200 Failed to place trailing stop order. Callback rate should be within {0}<x<={1}
51312 200 Failed to place trailing stop order. Order amount should be within {0}<x<={1}
51313 200 Manual transfer in isolated mode does not support bot trading
51341 200 Position closing not allowed
51342 200 Closing order already exists. Please try again later
51343 200 TP price must be less than the lower price
51344 200 SL price must be greater than the upper price
51345 200 Policy type is not grid policy
51346 200 The highest price cannot be lower than the lowest price
51347 200 No profit available
51348 200 Stop loss price should be less than the lower price in the range
51349 200 Stop profit price should be greater than the highest price in the range
51350 200 No recommended parameters
51351 200 Single income must be greater than 0
51400 200 Cancelation failed as the order does not exist.
51401 200 Cancelation failed as the order is already canceled.
51402 200 Cancelation failed as the order is already completed.
51403 200 Cancelation failed as the order type does not support cancelation.
51404 200 Order cancelation unavailable during the second phase of call auction.
51405 200 Cancelation failed as you do not have any pending orders.
51406 400 Canceled - order count exceeds the limit {0}.
51407 200 Either order ID or client order ID is required.
51408 200 Pair ID or name does not match the order info.
51409 200 Either pair ID or pair name ID is required.
51410 200 Cancelation pending. Duplicate order rejected.
51411 200 Account does not have permission for mass cancelation.
51412 200 The order has been triggered and cannot be canceled.
51413 200 Cancelation failed as the order type is not supported by endpoint.
51415 200 Unable to place order. Spot trading only supports using the last price as trigger price. Please select "Last" and try again.
51500 200 Either order price or amount is required.
51501 400 Maximum {0} orders can be modified.
51503 200 Order modification failed as the order does not exist.
51506 200 Order modification unavailable for the order type.
51508 200 Orders are not allowed to be modified during the call auction.
51509 200 Modification failed as the order has been canceled.
51510 200 Modification failed as the order has been completed.
51511 200 Operation failed as the order price did not meet the requirement for Post Only.
51512 200 Failed to amend orders in batches. You cannot have duplicate orders in the same amend-batch-orders request.
51513 200 Number of modification requests that are currently in progress for an order cannot exceed 3.
51600 200 Status not found.
51601 200 Order status and order ID cannot exist at the same time.
51602 200 Either order status or order ID is required.
51603 200 Order does not exist.
51607 200 The file is generating.

Data class

Error Code HTTP Status Code Error Message
52000 200 No market data found.

Spot

Error Code from 54000 to 54999

Error Code HTTP Status Code Error Message
54000 200 Margin trading is not supported.

Funding

Error Code from 58000 to 58999

Error Code HTTP Status Code Error Message
58002 200 Please activate Savings Account first.
58003 200 Currency type is not supported by Savings Account.
58004 200 Account blocked
58005 200 The purchase/redeemed amount must be no greater than {0}.
58006 200 Service unavailable for token {0}.
58007 200 Abnormal Assets interface. Please try again later.
58008 200 You do not have assets in this currency.
58009 200 Currency pair do not exist.
58010 200 The chain {0} is not supported.
58011 200 Sorry, we are unable to provide services to unverified users in {Region} due to local laws and regulations. Please verify your account in order to use the services.
58012 200 Sorry, you can't transfer assets to this recipient as Okcoin are unable to provide services to unverified users in {region} due to local laws and regulations.
58100 200 The trading product triggers risk control, and the platform has suspended
the fund transfer-out function with related users. Please wait patiently.
58101 200 Transfer suspended
58102 429 Too frequent transfer (transfer too frequently).
58104 200 Since your P2P transaction is abnormal, you are restricted from making
fund transfers. Please contact customer support to remove the restriction.
58105 200 Since your P2P transaction is abnormal, you are restricted from making
fund transfers. Please transfer funds on our website or app to complete
identity verification.
58112 200 Your fund transfer failed. Please try again later.
58114 400 Transfer amount must be more than 0.
58115 200 Sub-account does not exist.
58116 200 Transfer amount exceeds the limit.
58117 200 Account assets are abnormal, please deal with negative assets before transferring.
58119 200 {0} Sub-account has no permission to transfer out, please set first.
58120 200 The transfer service is temporarily unavailable, please try again later.
58121 200 This transfer will result in a high-risk level of your position, which may lead to forced liquidation. You need to re-adjust the transfer amount to make sure the position is at a safe level before proceeding with the transfer.
58123 200 Parameter from cannot equal to parameter to.
58124 200 Your transfer is being processed, transfer id:{trId}. Please check the latest state of your transfer from the endpoint (GET /api/v5/asset/transfer-state)
58200 200 Withdrawal from {0} to {1} is currently not supported for this currency.
58201 200 Withdrawal amount exceeds the daily limit.
58202 200 The minimum withdrawal amount for NEO is 1, and the amount must be an integer.
58203 200 Please add a withdrawal address.
58204 200 Withdrawal suspended.
58205 200 Withdrawal amount exceeds the upper limit.
58206 200 Withdrawal amount is less than the lower limit.
58207 200 Withdrawal address is not in the verification-free whitelist.
58208 200 Withdrawal failed. Please link your email.
58209 200 Sub-accounts cannot be deposits or withdrawals
58210 200 Withdrawal fee exceeds the upper limit.
58211 200 Withdrawal fee is lower than the lower limit (withdrawal endpoint: incorrect fee).
58212 200 Withdrawal fee should be {0}% of the withdrawal amount.
58213 200 Please set a trading password before withdrawing.
58214 200 Withdrawals suspended due to {chainName} maintenance
58215 200 Withdrawal ID does not exist.
58216 200 Operation not allowed.
58217 200 You cannot withdraw your asset at the moment due to a risk detected in your withdrawal address, contact customer support for details.
58218 200 Your saved withdrawal account has expired.
58220 200 The withdrawal order is already canceled.
58221 200 Missing label of withdrawal address.
58222 200 Temporarily unable to process withdrawal address.
58224 200 This type of coin does not support on-chain withdrawals. Please use internal transfers.
58225 200 Sorry, you can't transfer assets to this recipient as Okcoin are unable to provide services to unverified users in {region} due to local laws and regulations.
58226 200 {chainName} is delisted and not available for crypto withdrawal.
58300 200 Deposit-address count exceeds the limit.
58301 200 Deposit-address not exist.
58302 200 Deposit-address needs tag.
58303 200 Deposit for the chain {0} is closed now.
58304 200 Failed to create invoice.
58350 200 Insufficient balance.
58351 200 Invoice expired.
58352 200 Invalid invoice.
58353 200 Deposit amount must be within limits.
58354 200 You have reached the limit of 10,000 invoices per day.
58355 200 Permission denied. Please contact your account manager.
58356 200 The accounts of the same node do not support the Lightning network deposit or withdrawal.
58357 200 {0} is not allowed to create a deposit address
58358 200 fromCcy should not be the same as toCcy
58370 200 The daily usage of small assets convert exceeds the limit.
58371 200 Small assets exceed the maximum limit.
58372 200 Insufficient small assets.

Account

Error Code from 59000 to 59999

Error Code HTTP Status Code Error Message
59000 200 Your settings failed as you have positions or open orders.
59002 200 Sub-account settings failed as it has positions, open orders, or trading bots.
59004 200 Only IDs with the same instrument type are supported
59110 200 The instrument type corresponding to this {0} does not support the tgtCcy parameter.
59200 200 Insufficient account balance.
59201 200 Negative account balance.
59401 200 Holdings already reached the limit.
59402 200 None of the passed instId is in live state, please check them separately.
59500 200 Only the APIKey of the main account has permission.
59501 200 Only 50 APIKeys can be created per account.
59502 200 Note name cannot be duplicate with the currently created APIKey note name.
59503 200 Each APIKey can bind up to 20 IP addresses.
59504 200 The sub account does not support the withdrawal function.
59505 200 The passphrase format is incorrect.
59506 200 APIKey does not exist.
59507 200 The two accounts involved in a transfer must be two different sub accounts
under the same parent account.
59508 200 The sub account of {0} is suspended.
59510 200 Sub-account does not exist
59601 200 This sub-account name already exists, try another name
59602 200 Number of API keys exceeds the limit
59603 200 Number of sub accounts exceeds the limit
59604 200 Only the main account APIkey can access this API
59605 200 This API key does not exist in your sub-account, try another API key
59606 200 Transfer funds to your main account before deleting your sub-account
59612 200 Cannot convert time format
59613 200 There is currently no escrow relationship established with the sub account
59614 200 Managed sub account do not support this operation
59615 200 The time interval between the begin date and end date cannot exceed 180 days.
59616 200 Begin date cannot be greater than end date.
59617 200 Sub-account created. Failed to set up account level.
59618 200 Failed to create sub-account.

WebSocket

Public

Error Code from 60000 to 63999

General Class

Error Code Error Message
60001 "OK-ACCESS-KEY" can not be empty.
60002 "OK-ACCESS-SIGN" can not be empty.
60003 "OK-ACCESS-PASSPHRASE" can not be empty.
60004 Invalid OK-ACCESS-TIMESTAMP.
60005 Invalid OK-ACCESS-KEY.
60006 Timestamp request expired.
60007 Invalid sign.
60008 The current WebSocket endpoint does not support subscribing to {0} channels. Please check the WebSocket URL
60009 Login failed.
60011 Please log in.
60012 Invalid request.
60013 Invalid args. 
60014 Requests too frequent.
60015 Connection closed as there was no data transmission in the last 30 seconds.
60016 Buffer is full, cannot write data.
60017 Invalid url path.
60018 The {0} {1} {2} {3} {4} does not exist.
60019 Invalid op {op}
60020 APIKey subscription amount exceeds the limit {0}
60021 This operation does not support multiple accounts login
60022 Bulk login partially succeeded
60023 Bulk login requests too frequent
60024 Wrong passphrase
60025 token subscription amount exceeds the limit {0}
60026 Batch login by APIKey and token simultaneously is not supported.
60027 Parameter {0} can not be empty.
60028 The current WebSocket endpoint does not support trading. Please check the WebSocket URL.
60029 Only users who're VIP5 and above can subscribe to books-l2-tbt order book channels
60030 Only users who're VIP4 and above can subscribe to books50-l2-tbt order book channels
63999 Internal system error.