NAV
中文

Upcoming Changes

Websocket disconnect notification for service upgrade

To enhance the API service, WebSocket will introduce a new message type (event = notify). 30 seconds prior to the upgrade of the WebSocket service, the following message will be sent to users indicating that the connection will soon be disconnected. Users are encouraged to establish a new connection to prevent any disruptions caused by disconnection.

The feature has launched in demo trading for WebSocket Public (/ws/v5/public) and Private(/ws/v5/private). The feature is expected to be launched to production in Mid December.

Chase order

Chase order has been launched in demo trading and are expected to be launched on the production in phases.

Parameter Type Required Description
ordType String No Order type
chase: chase order, only applicable to FUTURES and SWAP.

Chase order

It will place a Post Only order immediately and amend it continuously
Chase order and corresponding Post Only order can't be amended.

Parameter Type Required Description
chaseType String No Chase type.
distance: distance from best bid/ask price, the default value.
ratio: ratio.
chaseVal String No Chase value.
It represents distance from best bid/ask price when chaseType is distance.
For USDT-margined contract, the unit is USDT.
For USDC-margined contract, the unit is USDC.
For Crypto-margined contract, the unit is USD.
It represents ratio when chaseType is ratio. 0.1 represents 10%.
The default value is 0.
maxChaseType String Conditional Maximum chase type.
distance: maximum distance from best bid/ask price
ratio: the ratio.

maxChaseTyep and maxChaseVal need to be used together or none of them.
maxChaseVal String Conditional Maximum chase value.
It represents maximum distance when maxChaseType is distance.
It represents ratio when maxChaseType is ratio. 0.1 represents 10%.
reduceOnly Boolean No Whether the order can only reduce the position size.
Valid options: true or false. The default value is false.
Parameter Type Description
chaseType String Chase type.
chaseVal String Chase value.
maxChaseType String Maximum chase type.
maxChaseVal String Maximum chase value.
Parameter Type Required Description
ordType String No Order type
chase: chase order, only applicable to FUTURES and SWAP.
Parameter Type Description
source String 34: The normal order triggered by the chase order.
cancelSource String 40: Your order was canceled because the difference between the initial and current best bid or ask prices reached the maximum chase difference.

2024-11-14

Before

Parameter Type Description
minFee String The minimum withdrawal fee for normal address
Apply to on-chain withdrawal
maxFee String The maximum withdrawal fee for normal address
Apply to on-chain withdrawal
minFeeForCtAddr String The minimum withdrawal fee for contract address
Apply to on-chain withdrawal
maxFeeForCtAddr String The maximum withdrawal fee for contract address
Apply to on-chain withdrawal

After

Parameter Type Description
fee String The fixed withdrawal fee
Apply to on-chain withdrawal
minFee String The minimum withdrawal fee for normal address
Apply to on-chain withdrawal

(Deprecated)
maxFee String The maximum withdrawal fee for normal address
Apply to on-chain withdrawal

(Deprecated)
minFeeForCtAddr String The minimum withdrawal fee for contract address
Apply to on-chain withdrawal

(Deprecated)
maxFeeForCtAddr String The maximum withdrawal fee for contract address
Apply to on-chain withdrawal

(Deprecated)
Parameter Type Required Description
fee String Yes Withdrawal fee is fixed, no need to input fee anymore. If you pass the parameter, it will be ignore.

2024-11-11

2024-11-08

Parameter Type Description
type String Account type
0: Main account
1: Standard sub-account
2: Managed trading sub-account
5: Custody trading sub-account - Copper
9: Managed trading sub-account - Copper
12: Custody trading sub-account - Komainu

For the discount rate related fields delist, the discount rate related fields that are unnecessary was delisted. There is more detail below:

Related change: OKX to change discount rate rules in multi-currency and portfolio margin modes

Parameter Type Description
type String Sub-account type
1: Standard sub-account
2: Managed trading sub-account
5: Custody trading sub-account - Copper
9: Managed trading sub-account - Copper
12: Custody trading sub-account - Komainu
Response Parameter Type Description
discountInfo Array Original discount details. It will be removed once the adjustment of discount rate rules is completed
> discountRate String Discount rate
> maxAmt String Tier - upper bound, "" means positive infinity
> minAmt String Tier - lower bound, the minimum is 0

2024-10-28

Parameter Type Description
fastRedemptionDailyLimit String Fast redemption daily limit
If fast redemption is not supported, it will return ''.
Parameter Type Description
fastRedemptionData Array of object Fast redemption data
> ccy String Currency, e.g. BTC
> redeemingAmt String Redeeming amount
Parameter Type Description
redeemingAmt String Redeeming amount

2024-10-23

Parameter Type Description
auctionEndTime String The end time of call auction, Unix timestamp format in milliseconds, e.g. 1597026383085

Only applicable to SPOT that are listed through call auctions, return "" in other cases
Parameter Type Description
state String Instrument status
preopen e.g. Futures and options contracts rollover from generation to trading start; certain symbols before they go live.
Parameter Type Description
> spotCopyTradingEq String Spot smart sync equity.
The default is "0", only applicable to copy trader.

2024-10-17

Convert revamp

Convert

Error code HTTP code Error message
52914 200 Insufficient available balance in trading account
Parameters Type Description
type String Bill type
27: Convert
30: Simple trade
subType String Bill sub-type
318: Convert in
319: Convert out
320: Simple buy
321: Simple sell

Easy convert

Parameters Type Required Description
source String No Funding source
1: Trading account
2: Funding account
The default is 1.
Parameters Type Description
type String Bill type
28: Easy convert
subType String Bill sub-type
236: Easy convert in
237: Easy convert out

One-click repay

Parameters Type Description
type String Bill type
29: One-click repay
subType String Bill sub-type
224:One-click repay in
225:One-click repay out

Small assets convert

2024-10-15

Parameter Type Description
> term String Borrowing term, e.g. 30D: 30 Days
Parameters Types Required Description
term String No Borrowing term, e.g. 30D: 30 Days
Parameter Type Description
type String Sub-account type
9: Managed trading sub-account - Copper
12: Custody trading sub-account - Komainu

2024-10-14

Parameter Type Required Description
ccy String Conditional Currency,used for getting leverage of currency level.
Applicable to cross MARGIN of Spot mode/Multi-currency margin/Portfolio margin.
Supported single currency or multiple currencies (no more than 20) separated with comma.
Parameter Type Description
subType String Bill subtype
306: Manual borrow
307: Auto borrow
308: Manual repay
309: Auto repay
312: Auto offset
Error Code HTTP Status Code Error Message
59410 200 You can only borrow this crypto if it supports borrowing and borrowing is enabled.
59411 200 Manual borrowing failed. Your account's free margin is insufficient.
59412 200 Manual borrowing failed. The amount exceeds your borrowing limit.
59413 200 You didn't borrow this crypto. No repayment needed.
59414 200 Manual borrowing failed. The minimum borrowing limit is {param0}.

2024-10-10

Parameter Type Description
burningFeeRate String Burning fee rate, e.g "0.05" represents "5%".
Some currencies may charge combustion fees. The burning fee is deducted based on the withdrawal quantity (excluding gas fee) multiplied by the burning fee rate.
Apply to on-chain withdrawal
Parameter Type Description
burningFeeRate String Burning fee rate, e.g "0.05" represents "5%".
Some currencies may charge combustion fees. The burning fee is deducted based on the withdrawal quantity (excluding gas fee) multiplied by the burning fee rate.
feeCcy String Fixed withdrawal fee unit

2024-10-04

2024-10-01

2024-09-20

Parameter Type Description
state String State
8: Pending repay (more details refer to Reduce liabilities for fixed loan)
Parameter Type Description
adlType String pos_adl_start:ADL begins due to the volume of liquidation orders falls to a certain level (only applicable to premarket symbols)

2024-09-19

Parameter Type Description
enableSpotBorrow Boolean Whether borrow is allowed or not in Spot mode
true: Enabled
false: Disabled
spotBorrowAutoRepay Boolean Whether auto-repay is allowed or not in Spot mode
true: Enabled
false: Disabled
Parameter Type Description
ccy String Currency
Parameter Type Description
disCcyEq String Discount equity in currency for quick calculation if your equity is themaxAmt
Parameter Type Required Description
lockInterval String No Lock interval(ms)
The range should be [0, 10 000]
The default is 0. You can set it as "0" if you want to unlock it immediately.
Error 54008 will be thorwn when placing order duiring lock interval, it is different from 51034 which is thrown when MMP is triggered
Error Code HTTP Status Code Error Message
54008 200 This operation is disabled by the 'mass cancel order' endpoint. Please enable it using this endpoint.
54009 200 The range of {param0} should be [{param1}, {param2}].
Parameter Type Description
isTradeBorrowMode String Whether borrowing currency automatically
true
false
Only applicable to trigger order, trailing order and twap order

2024-09-18

2024-09-13

Error Code HTTP Status Code Error Message
54011 200 Pre-market trading contracts are only allowed to reduce the number of positions within 1 hour before delivery. Please modify or cancel the order.

Response Parameters

Parameter Type Description
strategy String Option strategy, e.g. CALL_CALENDAR_SPREAD

2024-08-29

Request Parameters

Parameter Type Required Description
ruleType String Yes Trading rule types
normal: normal trading
pre_market: pre-market trading
ruleType can not be passed through together with instId/instFamily/uly

Response Parameters

Parameter Type Description
ruleType String Trading rule types
normal: normal trading
pre_market: pre-market trading

Response Parameters

Parameter Type Description
oiUsd String Open interest (USD)

2024-08-28

Parameter Type Description
> spotBal String Spot balance. The unit is currency, e.g. BTC. Clicking knows more
> openAvgPx Array Spot average cost price. The unit is USD. Clicking knows more
> accAvgPx Array Spot accumulated cost price. The unit is USD. Clicking knows more
> spotUpl String Spot unrealized profit and loss. The unit is USD. Clicking knows more
> spotUplRatio String Spot unrealized profit and loss ratio. Clicking knows more
> totalPnl String Spot accumulated profit and loss. The unit is USD. Clicking knows more
> totalPnlRatio String Spot accumulated profit and loss ratio. Clicking knows more

2024-08-22

Parameter Type Description
legs Array of objects Legs of trade
> szCont String Filled amount of the contract
Only applicable to contracts, return "" for spot

2024-08-21

Error Code HTTP Status Code Error Message
51505 200 {instId} is not in call auction
Parameter Type Description
action String Push data action, incremental data or full snapshot.
snapshot: full
update: incremental
data Array Subscribed data
> checksum Integer Checksum, implementation details below. Only applicable to sprd-books-l2-tbt.
> prevSeqId Integer Sequence ID of the last sent message. Only applicable to sprd-books-l2-tbt.
> seqId Integer Sequence ID of the current message, implementation details below. Only applicable to sprd-books-l2-tbt.

2024-08-14

Added fills channel

OKX to change discount rate rules in multi-currency and portfolio margin modes

OKX will change the discount rate rules in phases. For details, please refer to OKX to change discount rate rules in multi-currency and portfolio margin modes .

The changes on API have been released in the demo trading environment and will go live in production in mid August. To avoid any impact on your trading strategies, please refer to the content below for necessary adjustments.

Parameter Type Description
discountType String Discount rule type for current account
0: Original discount rate rules, the default value
1: New discount rules

Before:

Request Parameter Type Required Description
discountLv String No Discount level
Response Parameter Type Description
discountLv String Discount rate level.
discountInfo Array Discount details.
> discountRate String Discount rate
> maxAmt String Tier - upper bound, "" means positive infinity
> minAmt String Tier - lower bound, the minimum is 0

After:

Request Parameter Type Required Description
discountLv String No Discount level (Deprecated)
Response Parameter Type Description
discountLv String Discount rate level. It will be Deprecated
discountInfo Array Original discount details. It will be removed once the adjustment of discount rate rules is completed
> discountRate String Discount rate
> maxAmt String Tier - upper bound, "" means positive infinity
> minAmt String Tier - lower bound, the minimum is 0
minDiscountRate String Minimum discount rate when it exceeds the maximum amount of the last tier.
details Array New discount details.
> discountRate String Discount rate
> maxAmt String Tier - upper bound, "" means positive infinity
> minAmt String Tier - lower bound, the minimum is 0
> tier String Tiers
> liqPenaltyRate String Liquidation penalty rate

Added endpoints

Added request fields

* Amend algo order

Parameter Type Required Description
newTriggerPx String Yes New trigger price after amendment
newOrdPx String Yes New order price after amendment
If the price is -1, the order will be executed at the market price.
newTriggerPxType String No New trigger price type after amendment
last: last price
index: index price
mark: mark price
The default is last
attachAlgoOrds Array of object No Attached SL/TP orders info
Applicable to Spot and futures mode/Multi-currency margin/Portfolio margin
> newTpTriggerPx String No Take-profit trigger price
If you fill in this parameter, you should fill in the take-profit order price as well.
> newTpTriggerPxType String No Take-profit trigger price type
last: last price
index: index price
mark: mark price
The default is last
> newTpOrdPx 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.
> newSlTriggerPx String No Stop-loss trigger price
If you fill in this parameter, you should fill in the stop-loss order price.
> newSlTriggerPxType String No Stop-loss trigger price type
last: last price
index: index price
mark: mark price
The default is last
> newSlOrdPx 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.

2024-08-08

Withdrawal API adjustment for Bahama entity users

Due to compliance requirements, Bahamas entity users need to pass in the field rcvrInfo when making on-chain/lightning withdrawal.

(User entity information reference: https://www.okx.com/help/terms-of-service )

Parameters Type Required Description
rcvrInfo Object Conditional Recipient information
For the specific entity users to do on-chain withdrawal/lightning withdrawal, this information is required.
> walletType String Yes Wallet Type
exchange: Withdraw to exchange wallet
private: Withdraw to private wallet
If withdrawal to the exchange wallet, relevant information about the recipient must be provided.
For the exchange wallet belongs to business recipient, rcvrFirstName may input the company name, rcvrLastName may input "N/A", location info may input the registered address of the company.
Withdrawal to a private wallet does not require providing recipient information.
> exchId String Conditional Exchange ID
You can query supported exchanges through the endpoint of Get exchange list (public)
If the exchange is not in the exchange list, fill in '0' in this field.
> rcvrFirstName String Conditional Receiver's first name, e.g. Bruce
> rcvrLastName String Conditional Receiver's last name, e.g. Wayne
> rcvrCountry String Conditional The recipient's country, e.g. United States
> rcvrCountrySubDivision String Conditional State/Province of the recipient, e.g. California
> rcvrTownName String Conditional The town/city where the recipient is located, e.g. San Jose
> rcvrStreetName String Conditional Recipient's street address, e.g. Clementi Avenue 1

Withdraw assets to the exchange wallet

If users withdraw assets to the exchange wallet, they need to provide recipient information.

Withdraw assets to the private wallet

If users withdraw assets to the private wallet, there is no need to provide recipient information. The examples are as follows:

Newly added error code

If Bahamas entity users do not pass in the new parameter rcvrInfo, the following error code will be returned.

Error code Error Message Example
58237 According to local laws and regulations, please provide accurate recipient information (rcvrInfo). For the exchange address, please also provide exchange information and recipient identity information ({consientParameters}). According to local laws and regulations, please provide accurate recipient information (rcvrInfo). For exchange address, please also provide exchange information and recipient identity information (rcvrFirstName, rcvrLastName, rcvrCountry, rcvrCountrySubDivision, rcvrTownName, rcvrStreetName).

2024-08-01

Parameter Type Description
posSide String Position mode side
long: Hedge mode long
short: Hedge mode short
net: Net mode

2024-07-23

Parameter Type Description
ruleType String Trading rule types
normal: normal trading
pre_market: pre-market trading
Error Code HTTP Status Code Error Message
54005 200 Switch to isolated margin mode to trade pre-market expiry futures.
54006 200 Pre-market expiry future position limit is {posLimit} contracts.
54007 200 Instrument {instId} is not supported

2024-07-17

If a user has already subscribed to the books-l2-tbt order book channel for a specific trading symbol within the same connection and then decides to subscribe to the books50-l2-tbt/books channels, we will retain the user's books-l2-tbt subscription since it provides more depth of the order book and is prioritized in the push sequence. An error code 64004 will be returned for the new subscription. An example is provided below.

Request Response
{
    "op": "subscribe",
    "args": [
        {
            "channel": "books",
            "instId": "BTC-USDT"
        }
    ]
}
{
    "event":"subscribe",
    "arg":{
       "channel":"books",
       "instId":"BTC-USDT"
    },
    "connId":"a4d3ae55"
 }

{
    "event":"error",
    "code":"64004",
    "msg":"Subscribe to both books and books-l2-tbt for BTC-USDT is not allowed. Unsubscribe books-l2-tbt first.",
    "connId":"a4d3ae55"
 } 


If a user has already subscribed to the books50-l2-tbt/books order book channels for a specific trading symbol within the same connection and then decides to subscribe to the books-l2-tbt channel, we will make new subscriptions to the books-l2-tbt channel and then cancel the user's existing books50-l2-tbt/books subscriptions. This is also because the books-l2-tbt channel provides more depth and is prioritized in the push sequence.

Note that the unsubscription process may have a delay of a few seconds, meaning the user might continue to receive messages from the old channels for a few seconds after successfully subscribing to the new channel.

Request Response
{
    "op": "subscribe",
    "args": [
        {
            "channel": "books-l2-tbt",
            "instId": "BTC-USDT"
        }
    ]
}
{
    "event":"subscribe",
    "arg":{
       "channel":"books-l2-tbt",
       "instId":"BTC-USDT"
    },
    "connId":"a4d3ae55"
 }
 
 {
    "event":"unsubscribe",
    "arg":{
       "channel":"books50-l2-tbt",
       "instId":"BTC-USDT"
    },
    "connId":"a4d3ae55"
 }
 
 {
    "event":"unsubscribe",
    "arg":{
       "channel":"books",
       "instId":"BTC-USDT"
    },
    "connId":"a4d3ae55"
 }
Error code Error Message
64004 Subscribe to both {channelName} and books-l2-tbt for {instId} is not allowed. Unsubscribe books-l2-tbt first.
Parameter Type Required Description
instId String No Instrument ID
Error code Error Message
64004 Subscribe to both {channelName} and books-l2-tbt for {instId} is not allowed. Unsubscribe books-l2-tbt first.
Error code Error Message
54004 Order placement or modification failed because one of the orders in the batch failed.
Parameter Type Required Description
profitSharingRatio String No Profit sharing ratio, it only supports these values
0,0.1,0.2,0.3
0.1 represents 10%

2024-07-04

2024-07-03

Parameter Type Description
state String Algo order state
pause

2024-06-26

Parameter Type Description
lendQuota String Lending quota

2024-06-25

2024-06-20

Parameter Type Description
acct String 6: Funding account
18: Trading account

2024-06-19

Parameter Type Required Description
tag String No CAA order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
Error code HTTP Status Code Error Message
51071 200 You've reached the maximum limit for tag level cancel all after timers.

These parameters are affected

Parameter Type Description
instId String Instrument ID, e.g. BTC-USDT-SWAP
openAvgPx String Average open price
openTime String Open time
subPos String Quantity of positions
markPx String Latest mark price, only applicable to contract

2024-06-13

2024-06-05

OKX starts to enable users to customize the spot risk offset amount, only applicable to Portfolio Margin Mode. The new feature and corresponding changes are listed below:


Parameter Type Description
> spotInUseAmt String Actual spot risk offset amount
The value of this field is equal to maxSpotInUseAmt if user doesn't define clSpotInUseAmt
> clSpotInUseAmt String User-defined spot risk offset amount
> maxSpotInUseAmt String Max possible spot risk offset amount
Parameter Type Required Description
type String Yes Risk offset type
4: Spot-derivatives (USDC) risk offset
Error Code HTTP Status Code Error Message
59648 200 Your modified spot-in-use amount is insufficient, which may lead to liquidation. Adjust the amount.
59649 200 Disabling spot-derivatives risk offset mode may increase the risk of liquidation. Adjust the size of your positions and ensure your margin-level status is safe.
59650 200 Switching your offset unit may increase the risk of liquidation. Adjust the size of your positions and ensure your margin-level status is safe.
59651 200 Enable spot-derivatives risk offset mode to set your spot-in-use amount.
59652 200 You can only set a spot-in-use amount for crypto that can be used as margin.

2024-06-03

Parameter Type Description
subType String 293: Fixed loan interest deduction
294: Fixed loan interest refund
295: Fixed loan overdue penalty

2024-05-30

Parameter Type Description
type String 304: Simple Earn Fixed order submission
305: Simple Earn Fixed order redemption
306: Simple Earn Fixed principal distribution
307: Simple Earn Fixed interest distribution (early termination compensation)
308: Simple Earn Fixed interest distribution
309: Simple Earn Fixed interest distribution (extension compensation)

2024-05-15

Response parameter

Parameter Type Description
maxCopyTraderNum String Maximum number of copy traders
copyTraderNum String Current number of copy traders

2024-05-10

2024-05-09

Push data parameters

Parameters Types Description
data Array Subscribed data
> 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
> vol24h String 24h trading volume, with a unit of base currency or USD

2024-05-08

Parameter Type Description
> sprdType String spread Type: hybrid

2024-05-06

Parameter Type Description
firstTradeTime String Timestamp that the first trade is completed after the latest rebate relationship is established with the parent affiliate
Unix timestamp in millisecond format, e.g. 1597026383085
If user has not traded, "" will be returned
level String Invitee trading fee level, e.g. Lv1
depAmt String Accumulated amount of deposit in USDT
If user has not deposited, 0 will be returned
volMonth String Accumulated Trading volume in the current month in USDT
If user has not traded, 0 will be returned
accFee String Accumulated Amount of trading fee in USDT
If there is no any fee, 0 will be returned
kycTime String KYC2 verification time. Unix timestamp in millisecond format and the precision is in day
If user has not passed KYC2, "" will be returned
region String User country or region. e.g. "United Kingdom"
affiliateCode String Affiliate invite code that the invitee registered/recalled via

2024-04-25

Added new response fields for decompressed CSV file. Changed the data dimension from order to fill.

Parameter Description
tradeId Last traded ID
amt Trade amount in USDT
fee fee amount in USDT
execType Liquidity taker or maker
T: taker
M: maker

2024-04-24

Parameter Type Description
attachAlgoOrds Array of object TP/SL information attached when placing order
> failCode String The error code when failing to place TP/SL order, e.g. 51020
The default is ""
> failReason String The error reason when failing to place TP/SL order.
The default is ""

Response parameter

Parameter Type Description
ts String Timestamp when the order request processing is finished by our system, Unix timestamp format in milliseconds, e.g. 1597026383085

2024-04-18

Parameter Type Description
redeemPeriod Array of string Redemption Period, format in [min time,max time]
H: Hour, D: Day
e.g. ["1H","24H"] represents redemption period is between 1 Hour and 24 Hours.
["14D","14D"] represents redemption period is 14 days.

2024-04-11

The deleted fields are listed as follows:

Parameter Type Description
data Array Subscribed data
> availPos String Position that can be closed
Only applicable to MARGIN, FUTURES/SWAP in the long-short mode and OPTION
> avgPx String Average open price
> upl String Unrealized profit and loss
> uplRatio String Unrealized profit and loss ratio
> liqPx String Estimated liquidation price
Not applicable to OPTION
> imr String Initial margin requirement, only applicable to cross
> margin String Margin, can be added or reduced. Only applicable to isolated Margin.
> mmr String Maintenance margin requirement
> liab String Liabilities, only applicable to MARGIN.
> liabCcy String Liabilities currency, only applicable to MARGIN.
> interest String Interest. Interest that has been incurred.
> tradeId String Last trade ID
> notionalUsd String Notional value of positions in USD
> optVal String Option Value, only applicable to OPTION.
> adl String Auto decrease line, signal area
Divided into 5 levels, from 1 to 5, the smaller the number, the weaker the adl intensity.
> last String Latest traded price
> deltaBS String delta: Black-Scholes Greeks in dollars, only applicable to OPTION
> deltaPA String delta: Greeks in coins, only applicable to OPTION
> gammaBS String gamma: Black-Scholes Greeks in dollars, only applicable to OPTION
> gammaPA String gamma: Greeks in coins, only applicable to OPTION
> thetaBS String theta: Black-Scholes Greeks in dollars, only applicable to OPTION
> thetaPA String theta: Greeks in coins, only applicable to OPTION
> vegaBS String vega: Black-Scholes Greeks in dollars, only applicable to OPTION
> vegaPA String vega: Greeks in coins, only applicable to OPTION
Parameter Type Description
acctStpMode String Account self-trade prevention mode
cancel_maker
cancel_taker
cancel_both
Users can log in to the webpage through the master account to modify this configuration

2024-04-10

Request parameter

Parameter Type Required Description
subType String No Transaction type
1: Buy
2: Sell
3: Open long
4: Open short
5: Close long
6: Close short
100: Partial liquidation close long
101: Partial liquidation close short
102: Partial liquidation buy
103: Partial liquidation sell
104: Liquidation long
105: Liquidation short
106: Liquidation buy
107: Liquidation sell
110: Liquidation transfer in
111: Liquidation transfer out
118: System token conversion transfer in
119: System token conversion transfer out
125: ADL close long
126: ADL close short
127: ADL buy
128: ADL sell
212: Auto borrow of quick margin
213: Auto repay of quick margin
204: block trade buy
205: block trade sell
206: block trade open long
207: block trade open short
208: block trade close open
209: block trade close short
270: Spread trading buy
271: Spread trading sell
272: Spread trading open long
273: Spread trading open short
274: Spread trading close long
275: Spread trading close short

Response parameter

Parameter Type Description
subType String Transaction type

2024-04-02

2024-03-27

2024-03-19

To enhance system stability and fairness to users, the exchange starts to impose limitations on the number of concurrent WebSocket connections allowed to subscribe to the following WebSocket channels. The limit will be set at 20 WebSocket connections per specific WebSocket channel per sub-account. Each WebSocket connection is identified by the unique connId.


The WebSocket channels subject to this limitation are as follows:

  1. Orders channel
  2. Account channel
  3. Positions channel
  4. Balance and positions channel
  5. Position risk warning channel
  6. Account greeks channel

If users subscribe to the same channel through the same WebSocket connection through multiple arguments, for example, by using {"channel": "orders", "instType": "ANY"} and {"channel": "orders", "instType": "SWAP"}, it will be counted once only. If users subscribe to the listed channels (such as orders and accounts) using either the same or different connections, it will not affect the counting, as these are considered as two different channels. The system calculates the number of WebSocket connections per channel.


The platform will send the number of active connections to clients through the channel-conn-count event message to new channel subscriptions.

Connection count update

{
    "event":"channel-conn-count",
    "channel":"orders",
    "connCount": "2",
    "connId":"abcd1234"
}


When the limit is breached, generally the latest connection that sends the subscription request will be rejected. Client will receive the usual subscription acknowledgement followed by the channel-conn-count-error from the connection that the subscription has been terminated. In exceptional circumstances the platform may unsubscribe existing connections.

Connection limit error

{
    "event": "channel-conn-count-error",
    "channel": "orders",
    "connCount": "20",
    "connId":"a4d3ae55"
}


Order operations through WebSocket, including place, amend and cancel orders, are not impacted through this change.

2024-03-14

Parameter Type Description
> cancelSource String 38: You have canceled market maker protection (MMP) orders
39: Your order was canceled because market maker protection (MMP) was triggered
Parameter Type Description
state String 15: Pending transaction validation
16: Due to local laws and regulations, your withdrawal may take up to 24 hours to arrive
Parameter Type Description
fee String Accumulated fee. Only applicable to contract grid, or it will be ""
fundingFee String Accumulated funding fee. Only applicable to contract grid, or it will be ""

2024-03-12

Error Code HTTP Status Code Error Message
50061 200 You've reached the maximum order rate limit for this account.

2024-03-06

Parameter Type Required Description
tpRatio String No Take profit ratio, 0.1 represents 10%
slRatio String No Stop loss ratio, 0.1 represents 10%
Parameter Type Description
tpRatio String Take profit ratio, 0.1 represents 10%
slRatio String Stop loss ratio, 0.1 represents 10%
Error Code HTTP Status Code Error Message
55100 200 Take profit % should be within the range of {parameter1}-{parameter2}
55101 200 Stop loss % should be within the range of {parameter1}-{parameter2}
55102 200 Take profit % should be greater than the current bot’s PnL%
55103 200 Stop loss % should be less than the current bot’s PnL%
55104 200 Only futures grid supports take profit or stop loss based on profit percentage

2024-02-28

The function of TP limit order has been deployed to the production.

Parameter Type Required Description
> tpOrdKind String No TP order kind
condition
limit
The default is condition
Parameter Type Required Description
> newTpOrdKind String No TP order kind
condition
limit
Parameter Type Description
isTpLimit String Whether it is TP limit order. true or false
cancelSource String 36: Your TP limit order was canceled because the corresponding SL order was triggered.
37: Your TP limit order was canceled because the corresponding SL order was canceled.
attachAlgoOrds Array of object TP/SL information attached when placing order
> tpOrdKind String TP order kind
condition
limit
> linkedAlgoOrd Object Linked SL order detail, only applicable to TP limit order of one-cancels-the-other order(oco)
>> algoId Object Algo ID
Parameter Type Description
linkedOrd Object Linked TP order detail, only applicable to SL order that comes from the one-cancels-the-other (OCO) order that contains the TP limit order.
> ordId String Order ID
cTime String Creation time Unix timestamp format in milliseconds, e.g. 1597026383085
uTime String Order updated time, Unix timestamp format in milliseconds, e.g. 1597026383085
Error Code HTTP Status Code Error Message
51090 200 You can't modify the amount of an SL order placed with a TP limit order.
51091 200 All TP orders in one order must be of the same type.
51092 200 TP order prices (tpOrdPx) in one order must be different.
51093 200 TP limit order prices (tpOrdPx) in one order can't be –1 (market price).
51094 200 You can't place TP limit orders in spot, margin, or options trading.
51095 200 To place TP limit orders at this endpoint, you must place an SL order at the same time.
51096 200 cxlOnClosePos needs to be true to place a TP limit order
51098 200 You can't add a new TP order to an SL order placed with a TP limit order.
51099 200 You can't place TP limit orders as a lead trader.
50062 200 This feature is currently unavailable.
Parameters Types Description
> details Array Detailed asset information in all currencies
rewardBal String Trial fund balance
Parameters Types Description
premium String Premium between the mid price of perps market and the index price
Parameters Types Description
type String Bill type
26: Structured products
subtype String Bill subtype
296: From structured order placements
297: To structured order placements
298: From structured settlements
299: To structured settlements

2024-02-07

2024-02-06

2024-02-01

Parameter Type Description
verifiedName String Verified name (for recipient)

2024-01-31

Before:

Parameter Type Required Description
updateInterval int No 0: only push due to positions events

The data will be pushed both by events and regularly if this field is omitted or set to other values than 0.

The following format should be strictly obeyed when using this field.
"extraParams": "
{
\"updateInterval\": \"0\"
}
"

After:

Parameter Type Required Description
updateInterval int No 0: only push due to positions events
2000, 3000, 4000: push by events and regularly according to the time interval setting (ms)

The data will be pushed both by events and around per 5 seconds regularly if this field is omitted or set to other values than the valid values above.

The following format should be strictly followed when using this field.
"extraParams": "
{
\"updateInterval\": \"0\"
}
"

2024-01-22

OKX has migrated savings endpoints to the new. The new endpoints have been released in production on 2023/03/15. The corresponding old endpoints has been offline on 2024/01/22.

2024-01-18

Response Parameters

Parameter Type Description
upl String Cross-margin info of unrealized profit and loss at the account level in USD
Applicable to Multi-currency margin/Portfolio margin
> (details) imr String Initial margin requirement at the currency level
Applicable to Spot and futures mode
> (details) mmr String Maintenance margin requirement at the currency level
Applicable to Spot and futures mode

2024-01-17

Response parameter

Parameter Type Description
portLink String Portrait link
Error Code HTTP Status Code Error Message
59282 200 Only ND sub-accounts under ND brokers whose main accounts are on the allowlist support this endpoint. Reach out to BD for help.
59284 200 You've reached the monthly limit of {param0} ratio edits
59286 200 You can't become a contract lead trader when using spot mode
59287 200 Profit sharing ratio should be between {param0} and {param1}
59288 200 You're leading trades but your account is in portfolio margin mode. Switch to spot and futures mode or multiple-currency margin mode and try again

Liquidation and ADL data improvements


When liquidation happens under cross margin mode

Parameter before after
fillPx, fillSz, fillTime "" or "0" the corresponding actual values when liquidation happens
pnl Profit and loss Profit and loss + liquidation penalty
tradeId the last tradeId "0"
fillPnl "0" Profit and loss
Parameter before after
ordId "" the corresponding order ID when liquidation happens
tradeId the last tradeId "0"
Parameter before after
tradeId the last tradeId "0"


When liquidation happens under isolated margin mode

Parameter before after
fillPx, fillSz, fillTime "" or "0" the corresponding actual values when liquidation happens
tradeId the last tradeId "0"
fillPnl "0" Profit and loss
Parameter before after
ordId "" the corresponding order ID when liquidation happens
tradeId the last tradeId "0"
Parameter before after
tradeId the last tradeId "0"


When Auto-Deleveraging (ADL) happens

Parameter before after
fillPx, fillSz, fillTime "" or "0" the corresponding actual values when liquidation happens
tradeId the last tradeId "0"
fillPnl "0" Profit and loss
Parameter before after
ordId "" the corresponding order ID when liquidation happens
tradeId the last tradeId "0"

Note: After liquidation or ADL happens, the tradeId corresponding to the position will be set to "0". Through REST endpoints and Websocket channels, users will receive "tradeId": "0" until there is a new transaction for this position.

2024-01-18

Response Parameters

Parameter Type Description
upl String Cross-margin info of unrealized profit and loss at the account level in USD
Applicable to Multi-currency margin/Portfolio margin
> (details) imr String Initial margin requirement at the currency level
Applicable to Spot and futures mode
> (details) mmr String Maintenance margin requirement at the currency level
Applicable to Spot and futures mode

2024-01-10

Error code HTTP Status Code Error message
51137 200 The highest price limit for buy orders is {param0}
51138 200 The lowest price limit for sell orders is {param0}
Parameter Type Description
> cancelSource String 15: Order canceled: The order price is beyond the limit

Request Parameters

Parameter Type Required Description
type String No Type
adl: ADL historical data

Response Parameters

Parameter Type Description
instType String Instrument type
details Array of objects Insurance fund data
> maxBal String Maximum insurance fund balance in the past eight hours
Only applicable when type is adl
> maxBalTs String Timestamp when insurance fund balance reached maximum in the past eight hours, Unix timestamp format in milliseconds, e.g. 1597026383085
Only applicable when type is adl
> decRate String Real-time insurance fund decline rate (compare balance and maxBal)
Only applicable when type is adl
> adlType String ADL related events
rate_adl_start: ADL begins due to high insurance fund decline rate
bal_adl_start: ADL begins due to insurance fund balance falling
adl_end: ADL ends

When the rate and balance ADL are triggered at the same time, only bal_adl_start will be returned
Only applicable when type is adl

2024-01-09

2024-01-04

Parameter Type Required Description
mainAcct String Conditional Main account name of the second-level sub-account
When you are creating the first-level sub-account, it should be ""
When you are creating the second-level sub-account, it is required and should be the first-level sub-account.
Parameter Type Description
> mainAcct String Main account name of the second-level sub-account
It is the first-level sub-account when mainAcct is ""
It is the second-level sub-account when mainAcct has value.
Error Code HTTP Status Code Error Message
59622 200 You're creating a sub-account for a non-existing or incorrect sub-account. Create a sub-account under the ND broker first or use the correct sub-account code.
59623 200 Couldn't delete the sub-account under the ND broker as the sub-account has one or more sub-accounts, which must be deleted first.

2023-12-28

OKX plans to migrate savings endpoints to the new. The new endpoints have been released in production on 2023/03/15. The corresponding old endpoints will be offline on 2024/01/22. Please migrate to the new endpoints as soon as possible.

2023-12-20

Response Parameters

Parameter Type Description
enabled Boolean Whether price limit is effective
true: the price limit is effective
false: the price limit is not effective

Response Parameters

Parameter Type Description
method String Funding rate mechanism
current_period
next_period

For some altcoins perpetual swaps with significant fluctuations in funding rates, OKX will closely monitor market changes. When necessary, the funding rate collection frequency, currently set at 8 hours, may be adjusted to higher frequencies such as 6 hours, 4 hours, 2 hours, or 1 hour. Thus, users should focus on the difference between fundingTime and nextFundingTime fields to determine the funding fee interval of a contract.

2023-12-12

2023-12-11

2023-12-07

Parameter Type Description
lastRebate String Account monthly rebate amount. Only applicable to VIP4 and VIP5

2023-12-06

Parameter Type Required Description
ordType String No Order type
market:Market order, the default value
limit:Limit order
px String No Order price. Only applicable to limit order and SPOT lead trader
If the price is 0, the pending order will be canceled.
It is modifying order if you set px after placing limit order.
Parameter Type Required Description
tpOrdPx String No Take-profit order price
If the price is -1, take-profit will be executed at the market price, the default is -1
Only applicable to SPOT lead trader
slOrdPx String No Stop-loss order price
If the price is -1, stop-loss will be executed at the market price, the default is -1
Only applicable to SPOT lead trader
Parameter Type Description
availSubPos String Quantity of positions that can be closed
Parameter Type Description
closeSubPos String Quantity of positions that is already closed
type String The type of closing position
1:Close position partially;
2:Close all

2023-12-05

2023-12-04

2023-11-30

Request parameters

Parameter Type Required Description
uniqueCode String No Lead trader unique code, only applicable to copy trading
A combination of case-sensitive alphanumerics, all numbers and the length is 16 characters, e.g. 213E8C92DC61EFAC
subPosType String No Data type.
lead: lead trading, the default value
copy: copy trading

Response parameters

Parameter Type Description
tpOrdPx String Take-profit order price, it is -1 for market price
slOrdPx String Stop-loss order price, it is -1 for market price
margin String Margin
upl String Unrealized profit and loss
uplRatio String Unrealized profit and loss ratio
markPx String Latest mark price, only applicable to contract
uniqueCode String Lead trader unique code
ccy String Currency
Parameter Type Required Description
subPosType String No Data type.
lead: lead trading, the default value
copy: copy trading

Response parameters

Parameter Type Description
margin String Margin
ccy String Currency
markPx String Latest mark price, only applicable to contract
uniqueCode String Lead trader unique code
profitSharingAmt String Profit sharing amount, only applicable to copy trading
Parameter Type Required Description
subPosType String No Data type.
lead: lead trading, the default value
copy: copy trading
Error Code HTTP Status Code Error Message
59263 200 ND brokers need to be on the allowlist to access this feature. Reach out to BD for help.
59264 200 Spot copy trading isn't supported
59267 200 Cancellation failed as you aren't copying this trader
59268 200 You can't copy trades with instId that hasn't been selected by the lead trader
59269 200 This contract lead trader doesn't exist
59270 200 Maximum total amount (copyTotalAmt) can't be lower than amount per order (copyAmt) when using fixed amount
59273 200 You aren't a contract copy trader yet. Start by coping a contract trader.
59275 200 You can't copy trade as you're applying to become a lead trader
59276 200 You can't copy this lead trader as they've applied to stop leading trades
59277 200 You can't copy this lead trader as they don't have any copy trader vacancies
59278 200 Your request to stop copy trading is being processed. Try again later.
59279 200 You've already copied this trader
59280 200 You can't modify copy trade settings as you aren't copying this trader
59283 200 Your account isn't currently using spot and futures mode
59130 200 The highest take profit level is {num}%. Enter a smaller number and try again.
59259 200 Enter a multiplier value that's within the valid range
59285 200 You haven't led or copied any trades yet

2023-11-22


Request Parameters

Parameter Type Required Description
type String No regular_update

Response Parameters

Parameter Type Description
type String regular_update

The new enumeration value regular_update for type field of insurance fund endpoint is used to present up-to-minute insurance fund change. The amt field will be used to present the difference of insurance fund balance when the type field is liquidation_balance_deposit, bankruptcy_loss or platform_revenue, which is generated once per day around 08:00 am (UTC). When type is regular_update, the amt field will be returned as "".


Parameter type Description
minFundingRate String The lower limit of the predicted funding rate of the next cycle
maxFundingRate String The upper limit of the predicted funding rate of the next cycle
settState String Settlement state of funding rate
processing
settled
settFundingRate String If settState = processing, it is the funding rate that is being used for current settlement cycle.
If settState = settled, it is the funding rate that is being used for previous settlement cycle
ts String Data return time, Unix timestamp format in milliseconds, e.g. 1597026383085

2023-11-18

Parameter Type Description
alias String this_month next_month
Not recommended for use, users are encouraged to rely on the expTime field to determine the delivery time of the contract


Notice for new monthly futures contracts generation and alias field change


Currently, the BTC/USDT- and BTC/USD-margined futures contracts are different in number from futures contracts in other margins, the supported expiration dates are different, and the rules for contract rotation are also slightly different. As indicated in previous announcement, OKX recommends that users should use the expTime field of instruments REST endpoint and WebSocket channel to determine the expiration dates of futures contracts and disable alias field.


OKX has expanded the available durations for BTC/USDT- and BTC/USD-margined futures contracts to the following: weekly, bi-weekly, monthly (new duration), bi-monthly (new duration), quarterly, and bi-quarterly at 8:00 am UTC on November 17, 2023. Before adjustment, we only support the following 4 durations: weekly, bi-weekly, quarterly, and bi-quarterly. Following this adjustment, all the available expiration dates for newly listed contracts will be as follows:

  1. Weekly (this_week): November 24, 2023
  2. Bi-weekly (next_week): December 1, 2023
  3. Monthly (this_month): December 29, 2023. Before adjustment, it is a quarterly contract. If you use the alias field to determine the expiration date, you may mistakenly think that the expiration date is November 24, 2023.
  4. Bi-monthly (next_month): January 26, 2024. Newly listed contract.
  5. Quarterly (quarter): March 29, 2024. Before adjustment, it is a bi-quarterly contract. If you use the alias field to determine the expiration date, you may mistakenly think that the expiration date is December 29, 2023.
  6. Bi-quarterly (next_quarter): June 28, 2024. Newly listed contract.

After adjustment, the alias field of instruments REST endpoint and WebSocket channel will have new enumeration values, this_month and next_month. For now, the new enumeration values are only applicable to BTC/USDT- and BTC/USD-margined futures contracts. In the future, OKX may expand the available durations for more futures contracts. Please use the expTime field of instruments REST endpoint and WebSocket channel to determine the expiration dates of futures contracts and disable alias field.


For more details, please visit announcement

2023-11-16

OKX has introduced economic calendar data endpoints to empower users with comprehensive and up-to-minute macroeconomic data.

This feature has been released in production environment and is only supported in production environment.

2023-11-15

Parameter Type Description
period String Period
hourly
Parameter Type Description
recurringHour String Recurring buy by hourly
1/4/8/12
e.g. 4 represents "recurring buy every 4 hour"
nextInvestTime String Next invest time, Unix timestamp format in milliseconds, e.g. 1597026383085

2023-11-13

Parameter Type Description
maxLmtAmt String Max USD amount for a single limit order
maxMktAmt String Max USD amount for a single market order
Only applicable to SPOT/MARGIN
Error Code HTTP Status Code Error Message
51185 200 The maximum value allowed per order is {maxOrderValue} USD

2023-11-10

Parameter Type Required Description
tdMode String No Trade mode
spot_isolated (only applicable to SPOT lead trading)
Parameter Type Description
spotRoleType String SPOT copy trading role type.
0: General user;1:Leading trader;2:Copy trader
spotTraderInsts String Spot lead trading instruments, only applicable to lead trader
Parameter Type Description
> spotIsoBal String SPOT isolated balance. only applicable to copy trading
Parameter Type Required Description
subType String No Bill subtype
280: SPOT profit sharing expenses; 281: SPOT profit sharing refund

Request parameters

Parameter Type Required Description
instType String No Instrument type
SPOT
SWAP

Response parameters

Parameter Type Description
instType String Instrument type
Error Code HTTP Status Code Error Message
51072 200 As a spot lead trader, you need to set tdMode to 'spot_isolated' when configured buying lead trade pairs
51073 200 As a spot lead trader, you need to use '/copytrading/close-subposition' for selling assets through lead trades
51074 200 Only the tdMode for lead trade pairs configured by spot lead traders can be set to 'spot_isolated'
59260 200 You are not a spot lead trader yet. Complete the application on our website or app first.
59262 200 You are not a contract lead trader yet. Complete the application on our website or app first.
59642 200 Lead and copy traders can only use spot mode or spot and futures mode
59643 200 Couldn’t switch account modes as you’re currently copying spot trades

2023-11-08

Parameter Type Description
fillVol String Implied volatility
Only applicable to OPTION
fwdPx String Forward price
Only applicable to options
idxPx String Index price
Applicable to FUTURES, SWAP, OPTION
markPx String Mark price
Applicable to FUTURES, SWAP, OPTION


Parameter Type Description
> fillVol String Implied volatility
Only applicable to OPTION
> fwdPx String Forward price
Only applicable to options
> idxPx String Index price
Applicable to FUTURES, SWAP, OPTION
> markPx String Mark price
Applicable to FUTURES, SWAP, OPTION

For placing/amending order, the original TP/SL parameters attached will be hided from the document. Advising you to use new parameters.

Parameter Type Required Description
attachAlgoOrds Array of object No TP/SL information attached when placing order
> attachAlgoClOrdId String No Client-supplied Algo ID when placing order attaching TP/SL
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
It will be posted to algoClOrdId when placing TP/SL order once the general order is filled completely.
> tpTriggerPx String Conditional Take-profit trigger price
If you fill in this parameter, you should fill in the take-profit order price as well.
> tpOrdPx String Conditional 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 Conditional Stop-loss trigger price
If you fill in this parameter, you should fill in the stop-loss order price.
> slOrdPx String Conditional 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.
> tpTriggerPxType String No Take-profit trigger price type
last: last price
index: index price
mark: mark price
The Default is last
> slTriggerPxType String No Stop-loss trigger price type
last: last price
index: index price
mark: mark price
The Default is last
> sz String Conditional Size. Only applicable to TP order of split TPs, and it is required for TP order of split TPs
> amendPxOnTriggerType String No Whether to enable Cost-price SL. Only applicable to SL order of split TPs. Whether slTriggerPx will move to avgPx when the first TP order is triggered
0: disable, the default value
1: Enable
Parameter Type Required Description
attachAlgoOrds Array of object No TP/SL information attached when placing order
> attachAlgoId String Conditional The order ID of attached TP/SL order
> attachAlgoClOrdId String Conditional Client-supplied Algo ID when placing order attaching TP/SL
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
It will be posted to algoClOrdId when placing TP/SL order once the general order is filled completely.
> newTpTriggerPx String Conditional Take-profit trigger price.
Either the take profit trigger price or order price is 0, it means that the take profit is deleted.
Only applicable to Futures and Perpetual swap.
> newTpOrdPx String Conditional Take-profit order price
If the price is -1, take-profit will be executed at the market price.
Only applicable to Futures and Perpetual swap.
> newSlTriggerPx String Conditional Stop-loss trigger price
Either the stop loss trigger price or order price is 0, it means that the stop loss is deleted.
Only applicable to Futures and Perpetual swap.
> newSlOrdPx String Conditional Stop-loss order price
If the price is -1, stop-loss will be executed at the market price.
Only applicable to Futures and Perpetual swap.
> newTpTriggerPxType String Conditional Take-profit trigger price type
last: last price
index: index price
mark: mark price
Only applicable to FUTURES/SWAP
If you want to add the take-profit, this parameter is required
> newSlTriggerPxType String Conditional Stop-loss trigger price type
last: last price
index: index price
mark: mark price
Only applicable to FUTURES/SWAP
If you want to add the stop-loss, this parameter is required
> sz String Conditional New size. Only applicable to TP order of split TPs, and it is required for TP order of split TPs
> amendPxOnTriggerType String No Whether to enable Cost-price SL. Only applicable to SL order of split TPs.
0: disable, the default value
1: Enable
Parameter Type Description
attachAlgoOrds Array of object TP/SL information attached when placing order
> attachAlgoId String The order ID of attached TP/SL order
> attachAlgoClOrdId String Client-supplied Algo ID when placing order attaching TP/SL
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
It will be posted to algoClOrdId when placing TP/SL order once the general order is filled completely.
> tpTriggerPx String Take-profit trigger price.
> tpTriggerPxType String Take-profit trigger price type.
last: last price
index: index price
mark: mark price
> tpOrdPx String Take-profit order price.
> slTriggerPx String Stop-loss trigger price.
> slTriggerPxType String Stop-loss trigger price type.
last: last price
index: index price
mark: mark price
> slOrdPx String Stop-loss order price.
> sz String Conditional
> amendPxOnTriggerType String Whether to enable Cost-price SL. Only applicable to SL order of split TPs.
0: disable, the default value
1: Enable
Parameter Type Description
> amendPxOnTriggerType String Whether to enable Cost-price SL. Only applicable to SL order of split TPs.
0: disable, the default value
1: Enable
Error Code HTTP Status Code Error Message
51076 200 TP/SL orders in Split TPs only support one-way TP/SL. You can not use slTriggerPx&slOrdPx and tpTriggerPx&tpOrdPx at the same time.
51077 200 You cannot set ‘amendPxOnTriggerTyp’ as 1 for spot and margin trading
51078 200 You are a lead trader. Split TPs are not supported.
51079 200 The number of TP orders with Split TPs attached in a same order cannot exceed {param0}
51080 200 Take-profit trigger price types (tpTriggerPxType) must be the same in an order with Split TPs attached
51081 200 Take-profit trigger prices (tpTriggerPx) cannot be the same in an order with Split TPs attached
51082 200 TP trigger prices (tpOrdPx) in one order with multiple TPs must be market prices.
51083 200 The total size of TP orders with Split TPs attached in a same order should equal the size of this order
51084 200 The number of SL orders with Split TPs attached in a same order cannot exceed {param0}
51085 200 The number of TP orders cannot be less than 2 when cost-price SL is enabled (amendPxOnTriggerType set as 1) for Split TPs
51086 200 The number of orders with Split TPs attached in a same order cannot exceed {param0}
51538 200 You need to use attachAlgoOrds if you used attachAlgoOrds when placing an order. attachAlgoOrds is not supported if you did not use attachAlgoOrds when placing this order.
51539 200 attachAlgoId or attachAlgoClOrdId cannot be identical when modifying any TP/SL within your split TPs order
51527 200 Order modification failed. At least 1 of the attached TP/SL orders does not exist.
51089 200 The size of the TP order among split TPs attached cannot be empty

2023-11-07

Spread trading supports IOC orders

Parameter Type Required Description
ordType String No ioc: Immediate-or-cancel order
Parameter Type Description
ordType String ioc: Immediate-or-cancel order
Parameter Type Description
cancelSource String 14: Order canceled: IOC order was partially canceled due to incompletely filled.

2023-11-02

Parameters Type Description
clTReqId String Client Order ID as assigned by the client

2023-11-01

Parameters Type Description
flowType String Identify the type of the RFQ.
Only applicable to Makers, return "" for Takers
Parameters Type Description
> enable Boolean Sub-account status
true: normal
false: frozen
> frozenFunc Array of string Frozen functions
trading
convert
transfer
withdrawal
deposit
flexible_loan
> canTransOut String Whether the sub-account has the right to transfer out.(Directly transfer to another sub account through the sub account APIKey)
true: can transfer out
false: cannot transfer out
Parameters Type Description
frozenFunc Array of string Frozen functions
trading
convert
transfer
withdrawal
deposit
flexible_loan
Parameter Type Required Description
connId String Yes WebSocket connection ID

2023-10-31

2023-10-27

In order to improve market liquidity and improve the overall user experience, OKX adjusted the rules of trading fee rates between 7:00–9:00 am UTC on Oct. 27, 2023.
At the same time, Get fee rates was affected and have adjustment as following:

Note:
1. Only the SPOT/MARGIN response fields was affected, FUTURES/SWAP/OPTION response fields wasn't affected.
2. For SPOT/MARGIN, the fee rate of the USDⓈ&Crypto trading pairs was returned by takerUSDC/makerUSDC rather than taker/maker after the adjustment.

Before:

Parameter Type Description
taker String For SPOT/MARGIN, it is taker fee rate of the USDT&USDⓈ&Crypto trading pairs.
For FUTURES/SWAP/OPTION, it is the fee rate of crypto-margined contracts
maker String For SPOT/MARGIN, it is maker fee rate of the USDT&USDⓈ&Crypto trading pairs.
For FUTURES/SWAP/OPTION, it is the fee rate of crypto-margined contracts
takerUSDC String Taker fee rate for the USDC trading pairs(SPOT/MARGIN) and contracts(FUTURES/SWAP)
makerUSDC String Maker fee rate for the USDC trading pairs(SPOT/MARGIN) and contracts(FUTURES/SWAP)

After:

Parameter Type Description
taker String For SPOT/MARGIN, it is taker fee rate of the USDT trading pairs.
For FUTURES/SWAP/OPTION, it is the fee rate of crypto-margined contracts
maker String For SPOT/MARGIN, it is maker fee rate of the USDT trading pairs.
For FUTURES/SWAP/OPTION, it is the fee rate of crypto-margined contracts
takerUSDC String For SPOT/MARGIN, it is taker fee rate of the USDⓈ&Crypto trading pairs.
For FUTURES/SWAP, it is the fee rate of USDC-margined contracts
makerUSDC String For SPOT/MARGIN, it is maker fee rate of the USDⓈ&Crypto trading pairs.
For FUTURES/SWAP, it is the fee rate of USDC-margined contracts
fiat Array Details of fiat fee rate
> ccy String Fiat currency.
> taker String Taker fee rate
> maker String Maker fee rate

Before:

Parameter Type Required Description
quoteCcyType String No Quote currency type
2: USDT/USDⓈ/Crypto
3: USDC
Applicated to SPOT
When specifying this parameter, instType is required.

After:

Parameter Type Required Description
quoteCcyType String No Quote currency type
2: USDT
3: USDⓈ/Crypto
Applicated to SPOT
When specifying this parameter, instType is required.

2023-10-24

2023-10-19

2023-10-18

Parameter Type Description
beginTime String Rebate record begin time, Unix timestamp format in milliseconds, e.g. 1597026383085
endTime String Rebate record end time, Unix timestamp format in milliseconds, e.g. 1597026383085
cTime String Generate download link request time, Unix timestamp format in milliseconds, e.g. 1597026383085
Parameter Type Required Description
clientIP String No Sub-account register IP
Please use ND server IP for non personal accounts
Parameter Type Description
> cancelSource String 33: The order exceeds the maximum number of order matches per taker order
Error Code HTTP Status Code Error Message
51088 200 You can only place 1 TP/SL order to close an entire position
Parameter Type Description
bePx String Breakeven price

2023-09-29

Parameter Type Required Description
opType String No Order type
open: round down sz when opening positions
close: round sz to the nearest when closing positions
The default is close
Applicable to FUTURES SWAP

2023-09-28

To ensure the high performance of the trading system and provide users with a better trading experience, OKX has adjusted trading restriction that the maximum number of maker orders that can be matched with a taker order cannot exceed 1000.


When the number of maker orders matched with a taker order exceeds the maximum number limit of 1000, the taker order will be canceled:

  1. The limit orders will only be executed with a portion corresponding to 1000 maker orders and the remainder will be canceled.
  2. Fill or Kill (FOK) orders will be canceled directly.

2023-09-27

Before:

Parameter Type Description
> 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.

After:

Parameter Type Description
> amendResult String The result of amending the order
-1: failure
0: success
1: Automatic cancel (due to failed amendment)
2: Automatic amendation successfully, only applicable to pxVol and pxUsd orders of Option.
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.

2023-09-20

Parameter Type Description
inTime String Timestamp at Websocket / REST gateway when the request is received, Unix timestamp format in microseconds, e.g. 1597026383085123
For REST, the time is recorded after authentication.
outTime String Timestamp at Websocket / REST gateway when the response is sent, Unix timestamp format in microseconds, e.g. 1597026383085123
Parameter Type Description
interest String Interest
tag String Order tag
fillTime String Last filled time
tradeId String Last traded ID
clOrdId String Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
fillIdxPx String Index price at the moment of trade execution
For cross currency spot pairs, it returns baseCcy-USDT index price. For example, for LTC-ETH, this field returns the index price of LTC-USDT.
fillMarkPx String Mark price when filled
Applicable to FUTURES/SWAP/OPTIONS, return "" for other instrument types
fillPxVol String Implied volatility when filled
Only applicable to options; return "" for other instrument types
fillPxUsd String Options price when filled, in the unit of USD
Only applicable to options; return "" for other instrument types
fillMarkVol String Mark volatility when filled
Only applicable to options; return "" for other instrument types
fillFwdPx String Forward price when filled
Only applicable to options; return "" for other instrument types
Parameter Type Description
data Array Subscribed data
> trades Array Details of trade
>> instId String Instrument ID, e.g. BTC-USDT
>> tradeId String Trade ID
Parameter Type Description
attachAlgoOrds Array of object Attached SL/TP orders info
Applicable to Spot and futures mode/Multi-currency margin/Portfolio margin
> attachAlgoClOrdId String Client-supplied Algo ID when placing order attaching TP/SL.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
It will be posted to algoClOrdId when placing TP/SL order once the general order is filled completely.
> tpTriggerPx String Take-profit trigger price
If you fill in this parameter, you should fill in the take-profit order price as well.
> tpTriggerPxType String Take-profit trigger price type

last: last price
index: index price
mark: mark price
The Default is last
> tpOrdPx String 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 Stop-loss trigger price
If you fill in this parameter, you should fill in the stop-loss order price.
> slTriggerPxType String Stop-loss trigger price type
last: last price
index: index price
mark: mark price
The Default is last
> slOrdPx String 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.
Parameter Type Description
reduceOnly Boolean Whether the order can only reduce the position size.
Valid options: true or false. The default value is false.
This parameter is only valid in the FUTRUES/SWAP net mode, and is ignored in the long/short mode.
Parameter Type Description
source String Order source
6: The normal order triggered by the trigger order
7:The normal order triggered by the TP/SL order
25:The normal order triggered by the trailing stop order
Error Code HTTP Status Code Error Message
51333 200 Close position order in hedge-mode or reduce-only order in one-way mode cannot attach TPSL

2023-09-13

Parameter Type Required Description
tag String No Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
Parameter Type Required Description
after String No Pagination of data to return records earlier than the requested subPosId.
before String No Pagination of data to return records newer than the requested subPosId.
limit String No Number of results per request. Maximum is 500. Default is 500.

2023-09-08

For placing orders endpoints:

Before:

Parameter Type Required Description
px String Conditional Order price. Only applicable to limit, post_only, fok, ioc order

After:

Parameter Type Required Description
px String Conditional Order price. Only applicable to limit, post_only, fok, ioc order
When placing an option order, one of px/pxUsd/pxVol must be filled in, and only one can be filled in

Add request parameters

Parameter Type Required Description
pxUsd String Conditional Place options orders in USD
Only applicable to options
When placing an option order, one of px/pxUsd/pxVol must be filled in, and only one can be filled in
pxVol String Conditional Place options orders based on implied volatility, where 1 represents 100%
Only applicable to options
When placing an option order, one of px/pxUsd/pxVol must be filled in, and only one can be filled in

For amending orders endpoints:

Before:

Parameter Type Required Description
newPx String Conditional New price after amendment

After:

Parameter Type Required Description
newPx String Conditional New price after amendment
When modifying options orders, users can only fill in one of the following: newPx, newPxUsd, or newPxVol. It must be consistent with parameters when placing orders. For example, if users placed the order using px, they should use newPx when modifying the order.

Add request parameters

Parameter Type Required Description
newPxUsd String Conditional Modify options orders using USD prices
Only applicable to options.
When modifying options orders, users can only fill in one of the following: newPx, newPxUsd, or newPxVol.
newPxVol String Conditional Modify options orders based on implied volatility, where 1 represents 100%
Only applicable to options.
When modifying options orders, users can only fill in one of the following: newPx, newPxUsd, or newPxVol.

2023-08-31

Added new trading restriction


To ensure the high performance of the trading system and provide users with a better trading experience, OKX has now added a new trading restriction that the maximum number of maker orders that can be matched with a taker order cannot exceed 256.


When the number of maker orders matched with a taker order exceeds the maximum number limit of 256, the taker order will be canceled:

  1. The limit orders will only be executed with a portion corresponding to 256 maker orders and the remainder will be canceled.
  2. Fill or Kill (FOK) orders will be canceled directly.


When order is canceled due to this, users can get cancelSource = "0" and cancelSourceReason = "Order was canceled by system" through the endpoints below:


They can also receive cancelSource = "0" through the following WebSocket channel:


In the future, in order to adapt to more scenarios where orders are canceled due to improve trading system performance, the cancelSource and cancelSourceReason of this reason may be modified:

2023-08-30

For order details, list and history endpoints:

Before:

Parameter Type Description
px String Price

After:

Parameter Type Description
px String Price
For options, use coin as unit (e.g. BTC, ETH)

Added response parameters

Parameter Type Description
pxUsd String Options price in USDOnly applicable to options; return "" for other instrument types
pxVol String Implied volatility of the options orderOnly applicable to options; return "" for other instrument types
pxType String Price type of options
px: Place an order based on price, in the unit of coin (the unit for the request parameter px is BTC or ETH)
pxVol: Place an order based on pxVol
pxUsd: Place an order based on pxUsd, in the unit of USD (the unit for the request parameter px is USD)
Parameter Type Description
> amendSource String Source of the order amendation.
1: Order amended by user
2: Order amended by user, but the order quantity is overriden by system due to reduce-only
3: New order placed by user, but the order quantity is overriden by system due to reduce-only
4: Order amended by system due to other pending orders
5: Order modification due to changes in options px, pxVol, or pxUsd as a result of following variations. For example, when iv = 60, USD and px are anchored at iv = 60, the changes in USD or px lead to modification.

For transaction details endpoints:

Parameter Type Description
fillPxVol String Implied volatility when filled
Only applicable to options; return "" for other instrument types
fillPxUsd String Options price when filled, in the unit of USD
Only applicable to options; return "" for other instrument types
fillMarkVol String Mark volatility when filled
Only applicable to options; return "" for other instrument types
fillFwdPx String Forward price when filled
Only applicable to options; return "" for other instrument types
fillMarkPx String Mark price when filled
Applicable to FUTURES, SWAP, OPTION

Added new error codes

Error code HTTP Status Code Error Message
51175 200 Parameters {param0} {param1} and {param2} cannot be empty at the same time
51176 200 Only one parameter can be filled among Parameters {param0} {param1} and {param2}
51177 200 Unavailable to amend {param1} because the price type of the current options order is {param0}
51179 200 Unavailable to place options orders using {param0} in simple mode
51180 200 The range of {param0} should be ({param1}, {param2})
51181 200 ordType must be limit when placing {param0} orders
51182 200 The total number of pending orders under price types pxUsd and pxVol for the current account cannot exceed {param0}.
51536 200 Unable to modify the size of the options order if the price type is pxUsd or pxVol
51537 200 pxUsd or pxVol are not supported by non-options instruments
Parameter Type Description
realizedPnl String Realized profit and loss
pnl String Accumulated pnl of closing order(s)
fee String Accumulated fee
Negative number represents the user transaction fee charged by the platform.Positive number represents rebate.
fundingFee String Accumulated funding fee
liqPenalty String Accumulated liquidation penalty. It is negative when there is a value.
Parameter Type Description
realizedPnl String Realized profit and loss
fee String Accumulated fee
Negative number represents the user transaction fee charged by the platform.Positive number represents rebate.
fundingFee String Accumulated funding fee
liqPenalty String Accumulated liquidation penalty. It is negative when there is a value.

before:

Parameter Type Required Description
timeOut String Yes The countdown for order cancellation, with second as the unit.
Range of value can be 0, [5, 120].
Setting timeOut to 0 disables Cancel All After.

after:

Parameter Type Required Description
timeOut String Yes The countdown for order cancellation, with second as the unit.
Range of value can be 0, [10, 120].
Setting timeOut to 0 disables Cancel All After.

2023-08-23

Request Parameters

Parameter Type Required Description
beginTime String No Begin time, Unix timestamp format in milliseconds, e.g. 1597026383085 , search data after 1597026383085 (include)
endTime String No End time, Unix timestamp format in milliseconds, e.g. 1597026383085 , search data before 1597026383085 (exclude)

Response Parameters

Parameter Type Description
> rebateTime String Rebate time, Unix timestamp format in milliseconds, e.g. 1597026383085

Return results in reverse chronological order

2023-08-22

Parameter Type Required Description
rcvrInfo Object Conditional Receiver's info
Specific country/region certified users need to provide this information for on-chain withdrawal
> walletType String Yes Wallet Type
exchange:Withdraw to exchange wallet
private:Withdraw to private wallet
If you withdraw to exchange wallet,exchId&rcvrFirstName&rcvrLastName is required
If you withdraw to private wallet, no additional information is required
> exchId String Conditional Exchange ID
You can query supported exchanges through the endpoint of Get exchange list (public)
If the exchange is not in the exchange list, fill in '0' in this field
> rcvrFirstName String Conditional Receiver's first name, e.g. Bruce
> rcvrLastName String Conditional Receiver's last name, e.g. Wayne
Error Code HTTP Status Code Error Message
58237 200 As required by local laws and regulations, you need to provide the "rcvrInfo". If you're withdrawing to an exchange platform, provide the info of the exchange and the recipient.
58238 200 Incomplete info. The info of the exchange and the recipient are required if you're withdrawing to an exchange platform.

2023-08-16

Parameter Type Description
> borrowFroz String Potential borrowing IMR of the account in USD
Only applicable to Multi-currency margin and Portfolio margin. It is "" for other margin modes.
>> borrowFroz String Potential borrowing IMR of the currency in USD
Only applicable to Multi-currency margin and Portfolio margin. It is "" for other margin modes.

Before:

Parameter Type Description
> expTime String Expiry time
Only applicable to FUTURES/OPTION

After:

Parameter Type Description
> expTime String Expiry time
Applicable to SPOT/MARGIN/FUTURES/SWAP/OPTION. For FUTURES/OPTION, it is the delivery/exercise time. It can also be the delisting time of the trading instrument. Update once change.
Parameter Type Required Description
px String No The available amount corresponds to price of close position.
Only applicable to reduceOnly MARGIN.

Before:

Parameter Type Description
availPos String Position that can be closed
Only applicable to MARGIN, FUTURES/SWAP in the long-short mode and OPTION

After:

Parameter Type Description
availPos String Position that can be closed
Only applicable to MARGIN, FUTURES/SWAP in the long-short mode and OPTION.
For Margin position, the rest of sz will be SPOT trading after the liability is repaid while closing the position. Please get the available reduce-only amount from "Get maximum available tradable amount" if you want to reduce the amount of SPOT trading as much as possible.
Error Code HTTP Status Code Error Message
51400 200 Cancellation failed as the order has been filled, canceled or does not exist.
51503 200 Order modification failed as the order has been filled, canceled or does not exist.

2023-08-14

Adjustment to pending order limit for trading symbols

After the adjustment, the maximum number of pending orders per trading symbol is 500. For example, for the perpetual swap contract BTC-USDT-SWAP, the futures contract BTC-USDT-230707, and the spot BTC-USDT, each supports a maximum of 500 pending orders.

The maximum number of pending orders per account remains unchanged at 4000. The existing rules for options trading are not changed. For users who have more than 500 orders for a trading symbol, the new limit does not affect existing orders. However, users are not able to place new orders for that trading symbol until some of the existing orders are filled or canceled so that the number of pending orders for the trading symbol is below the limit.

The limit of 500 pending orders applies to the following order types:



Added new error code 51174

Error Code HTTP Status Code Error Message
51174 200 Order failed. The number of {param0} pending orders reached the upper limit of {param1} (orders).

2023-08-02

Parameter Type Description
> surplusLmtDetails Array The details of available amount across all sub-accounts
The value of surplusLmt is the minimum value within this array. It can help you judge the reason that surplusLmt is not enough.
Only applicable to VIP loans
>> allAcctRemainingQuota String Total remaining quota for master account and sub-accounts
>> curAcctRemainingQuota String The remaining quota for the current sub-account.
Only applicable to the case in which the sub-account is assigned the loan allocation
>> platRemainingQuota String Remaining quota for the platform.
The format like "600" will be returned when it is more than curAcctRemainingQuota or allAcctRemainingQuota

2023-07-26

Before

Parameter Type Description
type String The reason that Broker cannot get broker rebate
2: The user level is equal to or more than VIP3

After

Parameter Type Description
type String The reason that Broker cannot get broker rebate
2: The trading fee level is VIP4/5 and the monthly commission amount has reached the upper limit
3: The trading fee level is greater than or equal to VIP6
clientRebateRatio String Commission rebate ratio for client

2023-07-20

Parameter Type Description
totIncomeCat Object Category statistics for the total rebate amount
> spot String Total Rebate amount for spot, the unit is USDT
> derivative String Total Rebate amount for derivative, the unit is USDT
> convert String Total Rebate amount for convert, the unit is USDT
details Array of object Sub-account rebate amount record list
> incomeCat Object Category statistics for the rebate amount of the sub-account
>> spot String The rebate amount of the sub-account for spot, the unit is USDT
>> derivative String The rebate amount of the sub-account for derivative, the unit is USDT
>> convert String The rebate amount of the sub-account for convert, the unit is USDT
> netFee String The net fee of the sub-account, the unit is USDT
> netFeeCat Object Category statistics for the net fee of the sub-account
>> spot String The net fee of the sub-account for spot, the unit is USDT
>> derivative String The net fee of the sub-account for derivative, the unit is USDT
> markupFee String The markup fee of the sub-account, the unit is USDT
> markupFeeCat Object Category statistics for the markup fee of the sub-account
>> spot String The markup fee of the sub-account for spot, the unit is USDT
>> derivative String The markup fee of the sub-account for derivative, the unit is USDT
>> convert String The markup fee of the sub-account for convert, the unit is USDT
Parameter Description
netFee Net fee (The handling fee base for commission settlement after removing data such as commission cards and counterparties), in unit of USDT
settlementFee Settlement fee (Broker's handling fee base before settlement removing node commission rebates, commission cards, etc. ), in unit of USDT
Parameter Description
rebateCat Rebate category
spot
derivative
convert
netFee Net fee (The handling fee base for commission settlement after removing data such as commission cards and counterparties), in unit of USDT
markupFee Markup fee, in unit of USDT

2023-07-19

Parameter Type Description
profitSharingRatio String Profit sharing ratio
Value range [0, 0.3]
If it is a normal order (neither copy order nor lead order), this field returns ""
copyType String Profit sharing order type
0: Normal order
1: Copy order without profit sharing
2: Copy order with profit sharing
3: Lead order
Parameter Type Description
px String Price. It is related to subType.
Trade filled price for 1: Buy 2: Sell 3: Open long 4: Open short 5: Close long 6: Close short 204: block trade buy 205: block trade sell 206: block trade open long 207: block trade open short 208: block trade close open209: block trade close short 114: Auto buy 115: Auto sell
Liquidation Price:100: Partial liquidation close long 101: Partial liquidation close short 102: Partial liquidation buy 103: Partial liquidation sell 104: Liquidation long 105: Liquidation short 106: Liquidation buy 107: Liquidation sell 16: Repay forcibly 17: Repay interest by borrowing forcibly 110: Liquidation transfer in 111: Liquidation transfer out
Delivery price for 112: Delivery long 113: Delivery short
Exercise price for 170: Exercised 171: Counterparty exercised 172: Expired OTM
Mark price for 173: Funding fee expense 174: Funding fee income
Parameter Type Description
volLv String Implied volatility of at-the-money options
Parameter Type Description
ordType String mmp_and_post_only:Market Maker Protection and Post-only order(only applicable to Option in Portfolio Margin mode)

2023-07-17

Parameter Type Description
uid String sub-account uid
Parameter Type Required Description
cxlOnClosePos Boolean No Whether the TP/SL order placed by the user is associated with the corresponding position of the instrument. If it is associated, the TP/SL order will be canceled when the position is fully closed; if it is not, the TP/SL order will not be affected when the position is fully closed.

Valid values:
true: Place a TP/SL order associated with the position
false: Place a TP/SL order that is not associated with the position

The default value is false. If true is passed in, users must pass reduceOnly = true as well, indicating that when placing a TP/SL order associated with a position, it must be a reduceOnly order.

Only applicable to Spot and futures mode and Multi-currency margin.

2023-07-07

Parameter Type Description
ordType String mmp_and_post_only:Market Maker Protection and Post-only order(only applicable to Option in Portfolio Margin mode)

2023-07-05

Parameter Type Required Description
type String No Bill type
24: Spread trading
subType String No Bill subtype
270: Spread trading buy; 271: Spread trading sell; 272: Spread trading open long; 273: Spread trading open short; 274: Spread trading close long; 275: Spread trading close short
Parameter Type Description
fillPnl String Last filled profit and loss, applicable to orders which have a trade and aim to close position. It always is 0 in other conditions
Parameter Type Description
> fillPnl String Last filled profit and loss, applicable to orders which have a trade and aim to close position. It always is 0 in other conditions
Parameter Type Required Description
> extraParams String No Additional configuration
>> updateInterval int No 0: only push due to events
The data will be pushed both by events and regularly if this field is omitted or set to other values than 0.
The following format should be strictly obeyed when using this field.
"extraParams": "
{
\"updateInterval\": \"0\"
}
"

2023-06-28

Parameter Type Description
ordType String mmp:Market Maker Protection (only applicable to Option in Portfolio Margin mode)
Parameter Type Description
state String mmp_canceled:Order canceled automatically due to Market Maker Protection

2023-06-27

Parameter Type Description
minFeeForCtAddr String Minimum withdrawal fee for contract address
maxFeeForCtAddr String Maximum withdrawal fee for contract address

2022-06-26

Error Code HTTP Status Code Error Message
75001 200 Trade ID does not exist
75002 200 {sprdId} : new orders are not accepted currently
75003 200 Invalid price

2023-06-20

Parameter Type Description
> prevSeqId Integer Sequence ID of the last sent message. Only applicable to books, books-l2-tbt, books50-l2-tbt
> seqId Integer Sequence ID of the current message

Before:

Parameter Type Required Description
closeFraction String No Fraction of position to be closed when the algo order is triggered.
Currently the system supports fully closing the position only so the only accepted value is 1. For the same position, only one TPSL pending order for fully closing the position is supported.

This is only applicable to FUTURES or SWAP instruments.
This is only applicable if posSide is net.
This is only applicable if reduceOnly is true.
This is only applicable if ordType is conditional or oco.
This is only applicable if the stop loss and take profit order is executed as market order.
This is not supported in Portfolio Margin mode.
Either sz or closeFraction is required.

After:

Parameter Type Required Description
closeFraction String No Fraction of position to be closed when the algo order is triggered.
Currently the system supports fully closing the position only so the only accepted value is 1. For the same position, only one TPSL pending order for fully closing the position is supported.

This is only applicable to FUTURES or SWAP instruments.
If posSide is net, reduceOnly must be true.
This is only applicable if ordType is conditional or oco.
This is only applicable if the stop loss and take profit order is executed as market order.
This is not supported in Portfolio Margin mode.
Either sz or closeFraction is required.

Before:

Parameter Type Required Description
ip String Optional Link IP addresses, separate with commas if more than one. Support up to 20 addresses.
If sub-account API Key has trade/withdraw permission, linking IP addresses is required.

After:

Parameter Type Required Description
ip String No Link IP addresses, separate with commas if more than one. Support up to 20 addresses.

Before:

Parameter Type Required Description
ip String No Link IP addresses, separate with commas if more than one. Support up to 20 addresses.
The field will be reset if set.
If sub-account API Key has trade/withdraw permission, linking IP addresses is required.

After:

Parameter Type Required Description
ip String No Link IP addresses, separate with commas if more than one. Support up to 20 addresses.
The field will be reset if set.
Parameter Type Required Description
uid String No Sub-account uid
Parameter Type Required Description
attachAlgoClOrdId String No Client-supplied Algo ID when placing order attaching TP/SL.
Parameter Type Description
attachAlgoClOrdId String Client-supplied Algo ID when placing order attaching TP/SL.

Before:

Parameter Type Description
ordId String Order ID
state String State,live pause partially_effective

After:

Parameter Type Description
ordId String Latest order ID
state String State,live pause partially_effective partially_failed
ordIdList Array Order ID list. There will be multiple order IDs when there is TP/SL splitting order.

2023-06-19

2023-06-15

2023-06-07

Parameter Type Required Description
stpId String No Self trade prevention ID. Orders from the same master account with the same ID will be prevented from self trade.
Numerical integers defined by user in the range of 1<= x<= 999999999
stpMode String No Self trade prevention mode
Default to cancel maker
cancel_maker,cancel_taker, cancel_both
Cancel both does not support FOK.
Parameter Type Description
stpId String Self trade prevention ID
Return "" if self trade prevention is not applicable
stpMode String Self trade prevention mode
Return "" if self trade prevention is not applicable
cancelSource String 32: Self trade prevention

Before:

Parameter Type Description
indexPx String Index price while trading

After:

Parameter Type Description
idxPx String Index price while trading
Parameter Type Description
fillIdxPx String Index price at the moment of trade execution
For cross currency spot pairs, it returns baseCcy-USDT index price. For example, for LTC-ETH, this field returns the index price of LTC-USDT.
Parameter Type Description
idxPx String Latest underlying index price
Parameter Type Description
kycLv String Main account KYC level
0: No verification 1: level 1 completed, 2: level 2 completed, 3: level 3 completed.
If the request originates from a subaccount, kycLv is the KYC level of the main account.
If the request originates from the main account, kycLv is the KYC level of the current account.

Sub-account

2023-06-02

Before:

Parameter Type Description
indexPx String Index price while trading

After:

Parameter Type Description
idxPx String Index price while trading

2023-05-29

Parameter Type Description
state String The status of the quote. Valid values can be active pending_fill canceled filled expired or failed.

2023-05-24

Parameter Type Description
mainUid String Main Account ID of current request.
The current request account is main account if uid = mainUid.
The current request account is sub-account if uid != mainUid.
perm String The permission of the urrent request API Key. read_only:Read only;trade :Trade; withdraw: Withdraw
Parameter Type Description
tag String Order tag
algoClOrdId String Client-supplied Algo ID
Parameter Type Description
algoClOrdId String Client-supplied Algo ID

2023-05-10

Parameter Type Description
> uid String Sub-account user ID

2023-04-27

Parameter Type Required Description
newTpTriggerPx String Conditional Take-profit trigger price.
Either the take profit trigger price or order price is 0, it means that the take profit is deleted
newTpOrdPx String Conditional Take-profit order price
If the price is -1, take-profit will be executed at the market price.
newSlTriggerPx String Conditional Stop-loss trigger price
Either the stop loss trigger price or order price is 0, it means that the stop loss is deleted
newSlOrdPx String Conditional Stop-loss order price
If the price is -1, stop-loss will be executed at the market price.
newTpTriggerPxType String Conditional Take-profit trigger price type
last: last price
index: index price
mark: mark price
newSlTriggerPxType String Conditional Stop-loss trigger price type
last: last price
index: index price
mark: mark price
Parameter Type Description
> tdMode String Trade mode
Margin mode: cross isolated
Non-Margin mode: cash.
If not provided, tdMode will inherit default values set by the system shown below:
Spot and futures mode & SPOT: cash
Buy options in Spot and futures mode and Multi-currency Margin: isolated
Other cases: cross
> ccy String Margin currency.
Only applicable to cross MARGIN orders in Spot and futures mode. The parameter will be ignored in other scenarios.
Parameter Type Required Description
> tdMode String No Trade mode
Margin mode: cross isolated
Non-Margin mode: cash.
If not provided, tdMode will inherit default values set by the system shown below:
Spot and futures mode & SPOT: cash
Buy options in Spot and futures mode and Multi-currency Margin: isolated
Other cases: cross
> ccy String No Margin currency.
Only applicable to cross MARGIN orders in Spot and futures mode. The parameter will be ignored in other scenarios.
Parameter Type Description
> tdMode String Trade mode
Margin mode: cross isolated
Non-Margin mode: cash.
If not provided, tdMode will inherit default values set by the system shown below:
Spot and futures mode & SPOT: cash
Buy options in Spot and futures mode and Multi-currency Margin: isolated
Other cases: cross
> ccy String Margin currency.
Only applicable to cross MARGIN orders in Spot and futures mode. The parameter will be ignored in other scenarios.

2023-04-26

Before:

Parameter Type Required Description
mgnType String No Margin type
1: USDT-margined
2: crypto-margined
Applicated to FUTURES/SWAP

After:

Parameter Type Required Description
quoteCcyType String No Quote currency type
2: USDT/USDⓈ/Crypto
3: USDC
Applicated to SPOT
When specifying this parameter, instType is required.
mgnType String No Margin type
1: USDT-margined
2: crypto-margined
3: USDC-margined
Applicated to FUTURES/SWAP
When specifying this parameter, instType is required.

Before:

Parameter Type Description
> loanQuota String Borrow limit of master account
> surplusLmt String Available borrow amount of master and all sub-accounts
> usedLmt String Borrowed amount of master account and all sub-accounts

After:

Parameter Type Description
loanAlloc String VIP Loan allocation for the current trading account
1. The unit is percent(%). Range is [0, 100]. Precision is 0.01%
2. If master account did not assign anything, then "0"
3. "" if shared between master and sub-account
> loanQuota String Borrow limit of master account
If loanAlloc has been assigned, then it is the borrow limit of the current trading account
> surplusLmt String Available amount across all sub-accounts
If loanAlloc has been assigned, then it is the available amount to borrow by the current trading account
> usedLmt String Borrowed amount across all sub-accounts
If loanAlloc has been assigned, then it is the borrowed amount by the current trading account
Parameter Type Description
uplLastPx String Unrealized profit and loss calculated by last price. Main usage is showing, actual value is upl.
uplRatioLastPx String Unrealized profit and loss ratio calculated by last price.

2023-04-19

2023-04-10

2023-04-07

2023-04-06

Parameter Type Description
> cancelSource String Source of the order cancellation.
31: The post-only order will take liquidity in taker orders
> amendSource String Source of the order amendation.
1: Order amended by user
2: Order amended by user, but the order quantity is overriden by system due to reduce-only
3: New order placed by user, but the order quantity is overriden by system due to reduce-only
4: Order amended by system due to other pending orders

2023-04-03

Parameter Type Description
maintType String Maintenance type
1: Scheduled maintenance; 2: Unscheduled maintenance; 3: System disruption
env String Environment.
1: Production Trading, 2: Demo Trading

2023-03-30

Before:

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"
blockVolUsd String 24-hour total OTC trading volume on the platform in "USD"
blockVolCny String 24-hour total OTC trading volume on the platform in "CNY"

After:

Parameter Type Description
volUsd String 24-hour total trading volume from the order book trading in "USD"
volCny String 24-hour total trading volume from the order book trading in "CNY"

2023-03-29

2023-03-27

Before:

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"
blockVolUsd String 24-hour total OTC trading volume on the platform in "USD"
blockVolCny String 24-hour total OTC trading volume on the platform in "CNY"

After:

Parameter Type Description
volUsd String 24-hour total trading volume from the order book trading in "USD"
volCny String 24-hour total trading volume from the order book trading in "CNY"

2023-03-24

2023-03-16

2023-03-15

2023-03-14

2023-03-01

Parameter Type Description
failCode String It represents that the reason that algo order fails to trigger. It is "" when the state is effective/canceled. There will be value when the state is order_failed, e.g. 51008;
Only applicable to Stop Order, Trailing Stop Order, Trigger order.
algoClOrdId String Client-supplied Algo ID

Adjusted request parameter

Before:

Parameter Type Required Description
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.

After:

Parameter Type Required Description
algoClOrdId String No Client-supplied Algo ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

Added new response parameters

Parameter Type Description
algoClOrdId String Client-supplied Algo ID
Parameter Type Description
algoClOrdId String Client-supplied Algo ID. There will be a value when algo order attaching algoClOrdId is triggered, or it will be "".
algoId String Algo ID. There will be a value when algo order is triggered, or it will be "".

2023-02-20

Before:

Parameter Type Description
> cancelSource String Source of the order cancellation.
Valid values and the corresponding meanings are:
0,5,7,8,10,11,12,15,16,18,19: Order canceled by system
1: Order canceled by user
2: Pre reduce-only order canceled, due to insufficient margin in user position
3: Risk cancellation was triggered. Pending order was canceled due to insufficient margin ratio and forced-liquidation risk.
4: Borrowings of crypto reached hard cap.
6: ADL order cancellation was triggered. Pending order was canceled due to a low margin ratio and forced-liquidation risk.
9: Insufficient balance after funding fees deducted.
13: FOK order was canceled due to incompletely filled.
14: IOC order was partially canceled due to incompletely filled.
17: Close order was canceled, due to the position was already closed at market price.
20: Cancel all after triggered

After:

Parameter Type Description
> cancelSource String Source of the order cancellation.
Valid values and the corresponding meanings are:
0: Order canceled by system
1: Order canceled by user
2: Order canceled: Pre reduce-only order canceled, due to insufficient margin in user position
3: Order canceled: Risk cancellation was triggered. Pending order was canceled due to insufficient margin ratio and forced-liquidation risk.
4: Order canceled: Borrowings of crypto reached hard cap, order was canceled by system.
6: Order canceled: ADL order cancellation was triggered. Pending order was canceled due to a low margin ratio and forced-liquidation risk.
9: Order canceled: Insufficient balance after funding fees deducted.
13: Order canceled: FOK order was canceled due to incompletely filled.
14: Order canceled: IOC order was partially canceled due to incompletely filled.
17: Order canceled: Close order was canceled, due to the position was already closed at market price.
20: Cancel all after triggered
21: Order canceled: The TP/SL order was canceled because the position had been closed
22, 23: Order canceled: Reduce-only orders only allow reducing your current position. System has already canceled this order.

2023-02-17

2022-02-15

Error Code HTTP Status Code Error Message
58127 200 Main account API Key does not support current transfer 'type' parameter. Please refer to the API documentation.
58128 200 Sub-account API Key does not support current transfer 'type' parameter. Please refer to the API documentation.
Parameter Type Description
fillTime String Trade time which is the same as fillTime for the order channel.

2023-02-08

Parameter Type Description
> fromWdId String Internal transfer initiator's withdrawal ID
If the deposit comes from internal transfer, this field displays the withdrawal ID of the internal transfer initiator, and will return "" in other cases
Parameter Type Description
> nonTradableAsset String Whether it is a non-tradable asset or not
true: non-tradable asset, false: tradable asset
> feeCcy String Withdrawal fee currency, e.g. USDT

2023-02-07

2023-02-02

Parameter Type Description
ip String IP addresses that linked with current API key, separate with commas if more than one, e.g. 117.37.203.58,117.37.203.57. It is an empty string "" if there is no IP bonded.

2023-02-01

Parameter Type Description
type String Bill type
225: Shark Fin subscribe
226: Shark Fin collection
227: Shark Fin profit
228: Shark Fin refund

2023-01-30

Request parameter

Parameter Type Required Description
rfqId String No RFQ ID.

2023-01-19

2023-01-09

2022-12-30

Request parameter

Parameter Type Required Description
fromWdId String No Internal transfer initiator's withdrawal ID
If the deposit comes from internal transfer, this field displays the withdrawal ID of the internal transfer initiator

Response parameter

Parameter Type Description
fromWdId String Internal transfer initiator's withdrawal ID
If the deposit comes from internal transfer, this field displays the withdrawal ID of the internal transfer initiator

2022-12-28

2022-12-23

Parameter Type Description
opAuth String Whether the option trading was activated
0 not activate, 1 activated

2022-12-20

Parameter Type Description
last String Last filled price while placing
Parameter Type Required Description
quickMgnType String No Quick Margin type. Only applicable to Quick Margin Mode of isolated margin
manual, auto_borrow, auto_repay
The default value is manual
Parameter Type Description
quickMgnType String Quick Margin type, Only applicable to Quick Margin Mode of isolated margin
manual, auto_borrow, auto_repay
Parameter Type Description
baseBorrowed String Base currency amount already borrowed, only applicable to MARGIN(Quick Margin Mode)
baseInterest String Base Interest, undeducted interest that has been incurred, only applicable to MARGIN(Quick Margin Mode)
quoteBorrowed String Quote currency amount already borrowed, only applicable to MARGIN(Quick Margin Mode)
quoteInterest String Quote Interest, undeducted interest that has been incurred, only applicable to MARGIN(Quick Margin Mode)

Before:

Parameter Type Required Description
type String Yes add: add margin
reduce: reduce margin
ccy String No Currency, only applicable to MARGIN(Manual transfers)

After:

Parameter Type Required Description
type String Yes add: add margin, or transfer collaterals in (Quick Margin Mode)
reduce: reduce margin, transfer collaterals out (Quick Margin Mode)
ccy String No Currency, only applicable to MARGIN(Manual transfers and Quick Margin Mode)
Parameter Type Description
mgnIsoMode String quick_margin: Quick Margin Mode(For new accounts, including subaccounts, Some defaults will be automatic, and Other defaults will be quick_margin)
Parameter Type Description
isoMode String quick_margin: Quick Margin Mode
Parameter Type Required Description
type String No Bill type
15: Quick Margin
subType String No Bill subtype
210: Manual Borrowing 211: Manual Repayment 212: Auto borrow 213: Auto repay 16: Repay forcibly 17: Repay interest by borrowing forcibly
Error Code HTTP Status Code Error Message
59313 200 Unable to repay. You haven't borrowed any ${ccy} (${ccyPair}) in Quick margin mode.
51152 200 Unable to place an order that mixes automatic buy with automatic repayment or manual operation in Quick margin mode.

2022-12-15

Parameter Type Description
state String Product state
purchasable: Purchasable
sold_out: Sold out
Stop: Suspension of subscription

Request parameter

Parameter Type Required Description
tag String No Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.

Response parameter

Parameter Type Description
tag String Order tag
Parameter Type Description
tag String Order tag
Parameter Type Description
estSettlementTime String Estimated redemption settlement time
cancelRedemptionDeadline String Deadline for cancellation of redemption application
tag String Order tag
Error Code HTTP Status Code Error Message
51732 200 Required user KYC level not met
51733 200 User is under risk control
51734 200 User KYC Country is not supported
51735 200 Sub-account is not supported
51736 200 Insufficient {ccy} balance
Parameter Type Description
roleType String Role type.
0: General user;1:Leading trader;2:Copy trader
traderInsts String Leading trade instruments, only applicable to lead trader
Parameter Type Required Description
type String No Bill type
18: Profit sharing
subType String No Bill subtype
250: Profit sharing expenses; 251: Profit sharing refund; 252: Profit sharing income;
Error Code HTTP Status Code Error Message
51156 200 You're leading trades in long/short mode and can't use this API endpoint to close positions
51159 200 You're leading trades in buy/sell mode. If you want to place orders using this API endpoint, the orders must be in the same direction as your existing positions and open orders.
51162 200 You have {instrument} open orders. Cancel these orders and try again
51163 200 You hold {instrument} positions. Close these positions and try again
51166 200 Currently, we don't support leading trades with this instrument
51321 200 You're leading trades. Currently, we don't support leading trades with arbitrage, iceberg, or TWAP bots
51322 200 You're leading trades that have been filled at market price. We've canceled your open stop orders to close your positions
51323 200 You're already leading trades with take profit or stop loss settings. Cancel your existing stop orders to proceed
51324 200 As a lead trader, you hold positions in {instrument}. To close your positions, place orders in the amount that equals the available amount for closing
51325 200 As a lead trader, you must use market price when placing stop orders
59128 200 As a lead trader, you can't lead trades in {instrument} with leverage higher than {num}×
59216 200 The position doesn't exist. Please try again

2022-12-14

Parameter Type Description
bizRefId String External business id, e.g. experience coupon id
bizRefType String External business type
Parameter Type Description
cancelSource String Code of the cancellation source.
cancelSourceReason String Reason for the cancellation.

Adjusted response parameter

Before:

Parameter Type Description
amt String borrow/repay amount
loanQuota String Borrow limit
posLoan String Frozen amount for current account (Within the locked quota)
availLoan String Available amount for current account (Within the locked quota)
usedLoan String Borrowed amount for current account

After:

Parameter Type Description
amt String Already borrow/repay amount

Added new request parameter

Parameter Type Required Description
ordId String Conditional Order ID of borrowing, it is necessary while repaying

Added new response parameters

Parameter Type Description
ordId String Order ID of borrowing
state String State
1:Borrowing
2:Borrowed
3:Repaying
4:Repaid
5:Borrow failed
Parameter Type Description
> avgRate String Average interest of Already borrowed coin, only applicable to VIP loans

2022-12-12

2022-12-09

2022-12-08

Parameter Type Description
depQuoteDailyLayer2 String Layer2 network daily deposit limit

Request parameter

Parameter Type Required Description
tag String No RFQ tag. The block trade associated with the RFQ will have the same tag.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
> posSide String No Position side. The default is net in the net mode. It can only be long or short in the long/short mode.
If not specified, users in long/short mode always open new positions.
Only applicable to FUTURES/SWAP.

Response parameter

Parameter Type Description
> tag String RFQ tag. The block trade associated with the RFQ will have the same tag.
>> posSide String Position side. The default is net in the net mode. If not specified, return "", which is equivalent to net.
It can only be long or short in the long/short mode. If not specified, return "", which corresponds to the direction that opens new positions for the trade (buy => long, sell => short).
Only applicable to FUTURES/SWAP.

Request parameter

Parameter Type Required Description
tag String No Quote tag. The block trade associated with the Quote will have the same tag.
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
> posSide String No Position side. The default is net in the net mode. It can only be long or short in the long/short mode.
If not specified, users in long/short mode always open new positions.
Only applicable to FUTURES/SWAP.

Response parameter

Parameter Type Description
> tag String Quote tag. The block trade associated with the Quote will have the same tag.
>> posSide String Position side. The default is net in the net mode. If not specified, return "", which is equivalent to net.
It can only be long or short in the long/short mode. If not specified, return "", which corresponds to the direction that opens new positions for the trade (buy => long, sell => short).
Only applicable to FUTURES/SWAP.
Parameter Type Description
> tag String RFQ tag. The block trade associated with the RFQ will have the same tag.
>> posSide String Position side. The default is net in the net mode. If not specified, return "", which is equivalent to net.
It can only be long or short in the long/short mode. If not specified, return "", which corresponds to the direction that opens new positions for the trade (buy => long, sell => short).
Only applicable to FUTURES/SWAP.
Parameter Type Description
> tag String Quote tag. The block trade associated with the Quote will have the same tag.
>> posSide String Position side. The default is net in the net mode. If not specified, return "", which is equivalent to net.
It can only be long or short in the long/short mode. If not specified, return "", which corresponds to the direction that opens new positions for the trade (buy => long, sell => short).
Only applicable to FUTURES/SWAP.
Parameter Type Description
> tag String Trade tag. The block trade will have the tag of the RFQ or Quote it corresponds to.
Parameter Type Description
> tag String RFQ tag. The block trade associated with the RFQ will have the same tag.
>> posSide String Position side. The default is net in the net mode. If not specified, return "", which is equivalent to net.
It can only be long or short in the long/short mode. If not specified, return "", which corresponds to the direction that opens new positions for the trade (buy => long, sell => short).
Only applicable to FUTURES/SWAP.
Parameter Type Description
> tag String Quote tag. The block trade associated with the Quote will have the same tag.
>> posSide String Position side. The default is net in the net mode. If not specified, return "", which is equivalent to net.
It can only be long or short in the long/short mode. If not specified, return "", which corresponds to the direction that opens new positions for the trade (buy => long, sell => short).
Only applicable to FUTURES/SWAP.
Parameter Type Description
> tag String Trade tag. The block trade will have the tag of the RFQ or Quote it corresponds to.

2022-12-06

2022-12-01

Before:

Parameter Type Description
sMsg String Rejection message if the request is unsuccessful.

After:

Parameter Type Description
sMsg String Rejection or success message of event execution.
Parameter Type Description
nonTradableAsset Boolean Whether it is a non-tradable asset or not
true: non-tradable asset, false: tradable asset
feeCcy String Withdrawal fee currency, e.g. USDT
Error Code HTTP Status Code Error Message
58125 200 Non-tradable assets can only be transferred from sub-accounts to main accounts
58126 200 Non-tradable assets can only be transferred between funding accounts
58227 200 Withdrawal of non-tradable assets can be withdrawn all at once only
58228 200 Withdrawal of non-tradable assets requires that the API Key must be bound to an IP
58229 200 Insufficient funding account balance to pay fees {fee} USDT

2022-11-30

Parameter Type Description
label String API key note of current request API key. No more than 50 letters (case sensitive) or numbers, which can be pure letters or pure numbers.
Parameter Type Description
perm String API Key permissions
withdraw: Withdraw

Adjusted rate limit rule

Before:

After:

Parameter Type Required Description
sz String Conditional Quantity to buy or sell
Either sz or closeFraction is required.
closeFraction String Conditional Fraction of position to be closed when the algo order is triggered.
Currently the system supports fully closing the position only so the only accepted value is 1. For the same position, only one TPSL pending order for fully closing the position is supported.

This is only applicable to FUTURES or SWAP instruments.
This is only applicable if posSide is net.
This is only applicable if reduceOnly is true.
This is only applicable if ordType is conditional or oco.
This is only applicable if the stop loss and take profit order is executed as market order
Either sz or closeFraction is required.
Parameter Type Description
closeFraction String Fraction of position to be closed when the algo order is triggered.
Parameter Type Description
> closeOrderAlgo Array Close position algo orders attached to the position
>> algoId String Algo ID
>> slTriggerPx String Stop-loss trigger price.
>> slTriggerPxType String Stop-loss trigger price type.
last:last price
index:index price
mark:mark price
>> tpTriggerPx String Take-profit trigger price.
>> tpTriggerPxType String Take-profit trigger price type.
last:last price
index:index price
mark:mark price
>> closeFraction String Fraction of position to be closed when the algo order is triggered.
Error Code HTTP Status Code Error Message
51327 200 closeFraction is only available for futures and perpetual swaps
51328 200 closeFraction is only available for reduceOnly orders
51329 200 closeFraction is only available in NET mode
51330 200 closeFraction is only available for stop market orders
Parameter Type Required Description
quickMgnType String No Quick Margin type. Only applicable to Quick Margin Mode of isolated margin
manual, auto_borrow, auto_repay
The default value is manual
Parameter Type Description
quickMgnType String Quick Margin type, Only applicable to Quick Margin Mode of isolated margin
manual, auto_borrow, auto_repay
Parameter Type Description
baseBorrowed String Base currency amount already borrowed, only applicable to MARGIN(Quick Margin Mode)
baseInterest String Base Interest, undeducted interest that has been incurred, only applicable to MARGIN(Quick Margin Mode)
quoteBorrowed String Quote currency amount already borrowed, only applicable to MARGIN(Quick Margin Mode)
quoteInterest String Quote Interest, undeducted interest that has been incurred, only applicable to MARGIN(Quick Margin Mode)

Before:

Parameter Type Required Description
type String Yes add: add margin
reduce: reduce margin
ccy String No Currency, only applicable to MARGIN(Manual transfers)

After:

Parameter Type Required Description
type String Yes add: add margin, or transfer collaterals in (Quick Margin Mode)
reduce: reduce margin, transfer collaterals out (Quick Margin Mode)
ccy String No Currency, only applicable to MARGIN(Manual transfers and Quick Margin Mode)
Parameter Type Description
mgnIsoMode String quick_margin: Quick Margin Mode
Parameter Type Description
mgnIsoMode String quick_margin: Quick Margin Mode
Parameter Type Required Description
type String No Bill type
15: Quick Margin
subType String No Bill subtype
210: Manual Borrowing 211: Manual Repayment 212: Auto borrow 213: Auto repay 16: Repay forcibly 17: Repay interest by borrowing forcibly
Error Code HTTP Status Code Error Message
59313 200 Unable to repay. You haven't borrowed any ${ccy} (${ccyPair}) in Quick margin mode.

2022-11-29

Adjusted response parameter

Before:

Parameter Type Description
amt String borrow/repay amount

After:

Parameter Type Description
amt String Already borrow/repay amount

Added new request parameter

Parameter Type Required Description
ordId String Conditional Order ID of borrowing, it is necessary while repaying

Added new response parameters

Parameter Type Description
ordId String Order ID of borrowing
state String State
1:Borrowing
2:Borrowed
3:Repaying
4:Repaid
5:Borrow failed
Parameter Type Description
> avgRate String Average interest of Already borrowed coin, only applicable to VIP loans

2022-11-28

Parameter Type Description
confirm String The state of candlesticks.
0 represents that it is uncompleted, 1 represents that it is completed.

2022-11-25

2022-11-24

Parameter Type Required Description
mgnType String No Margin type
1: USDT-margined
2: crypto-margined
Applicate to FUTURES/SWAP

2022-11-21

Parameter Type Description
confirm String The state of candlesticks.
0 represents that it is uncompleted, 1 represents that it is completed.
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.
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.
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.
tpTriggerPxType String No Take-profit trigger price type
last: last price
index: index price
mark: mark price
The Default is last
slTriggerPxType String No Stop-loss trigger price type
last: last price
index: index price
mark: mark price
The Default is last

2022-11-11

Parameter Type Required Description
areaCode String Optional Area code for phone number
If toAddr is a phone number, this parameter is required.
Parameter Type Description
areaCodeFrom String Area code for phone number
If from is a phone number, this parameter return area code of the phone number
Parameter Type Description
areaCodeFrom String Area code for phone number
If from is a phone number, this parameter return the area code for phone number
areaCodeTo String Area code for phone number
If to is a phone number, this parameter return the area code for phone number

2022-11-10

Parameter Type Description
> cancelSource String Source of the order cancellation.
Valid values and the corresponding meanings are:
0,5,7,8,10,11,12,15,16,18,19: Order canceled by system
1: Order canceled by user
2: Pre reduce-only order canceled, due to insufficient margin in user position
3: Risk cancellation was triggered. Pending order was canceled due to insufficient margin ratio and forced-liquidation risk.
4: Borrowings of crypto reached hard cap.
6: ADL order cancellation was triggered. Pending order was canceled due to a low margin ratio and forced-liquidation risk.
9: Insufficient balance after funding fees deducted.
13: FOK order was canceled due to incompletely filled.
14: IOC order was partially canceled due to incompletely filled.
17: Close order was canceled, due to the position was already closed at market price.
20: Cancel all after triggered

Request Parameters

Parameter Type Required Description
spotOffsetType String No Spot-derivatives risk offset mode
1: Spot-derivatives (USDT) 2: Spot-derivatives (crypto) 3: Derivatives-only
The default is 3

Response Parameters

Parameters Types Description
acctImr String Initial margin requirement of account dimension
acctMmr String Maintenance margin requirement of account dimension

2022-11-08

Parameter Type Description
volCcyQuote String Trading volume, the value is the quantity in quote currency
e.g. The unit is USDT for BTC-USDT and BTC-USDT-SWAP;
The unit is USD for BTC-USD-SWAP

2022-11-07

Parameter Type Required Description
brokerType String Optional Broker Type
api: API Broker
oauth: Oauth Broker
When the broker has only one broker type, this parameter can be left blank
This parameter is required when the broker has multiple broker types
Error Code HTTP Status Code Error Message
50044 200 Must select one broker type

2022-11-01

Parameter Type Description
volCcyQuote String Trading volume, the value is the quantity in quote currency
e.g. The unit is USDT for BTC-USDT and BTC-USDT-SWAP;
The unit is USD for BTC-USD-SWAP

2022-10-28

Parameter Type Required Description
beginTs String No Filter trade execution time with a begin timestamp (UTC timezone). Unix timestamp format in milliseconds, e.g. 1597026383085
endTs String No Filter trade execution time with an end timestamp (UTC timezone). Unix timestamp format in milliseconds, e.g. 1597026383085
Error Code HTTP Status Code Error Message
70010 200 Timestamp parameters need to be in Unix timestamp format in milliseconds.
70013 200 endTs needs to be bigger than or equal to beginTs.
70016 200 Please specify your instrument settings for at least one instType.

2022-10-27

Parameter Type Required Description
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

The rules of filtering with beginand end are as follows:
1. The result includes parameters of begin and end.
2. Return near end if begin and end both exist.
3. The endpoint filters with begin and end first, and then paginates with after and before when begin or end, after or before exist at the same request.

2022-10-20

Parameter Type Description
reduceOnly String Whether the order can only reduce the position size. Valid options: true or false.

Before: the push frequency is the fastest interval 500ms push the data.
After: the push frequency is the fastest interval 1 second push the data.

2022-10-19

2022-10-14

Parameter Type Description
instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION
Parameter Type Required Description
instFamily String No Instrument family
Applicable to FUTURES/SWAP/OPTION

Request Parameter:

Parameter Type Required Description
instFamily String Conditional Single instrument familiy or multiple instrument families (no more than 5) separated with comma.
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required. If both are passed, instFamily will be used.

Response Parameter:

Parameter Type Description
instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION

Request Parameter:

Parameter Type Required Description
instFamily String Conditional Instrument family
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required. If both are passed, instFamily will be used.

Response Parameter:

Parameter Type Description
instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION
Parameter Type Required Description
instFamily String Conditional Instrument family
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required. If both are passed, instFamily will be used.

Before:

Parameter Type Required Description
> uly String Conditional underlying

After:

Parameter Type Required Description
> instFamily String Conditional Instrument family
Applicable to FUTURES/SWAP/OPTION

Before:

Parameter Type Required Description
uly String Yes Single underlying or multiple underlyings (no more than 3) separated with comma.

After:

Parameter Type Required Description
uly String Conditional Single underlying or multiple underlyings (no more than 3) separated with comma.
Either uly or instFamily is required.
If both are passed, instFamily will be used.
instFamily String Conditional Single instrument family or instrument families (no more than 5) separated with comma.
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required.
If both are passed, instFamily will be used.

Before:

Parameter Type Required Description
uly String Yes Underlying

After:

Parameter Type Required Description
uly String Conditional Underlying
Either uly or instFamily is required.If both are passed, instFamily will be used.
instFamily String Conditional Instrument family
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required.If both are passed, instFamily will be used.

Before:

Parameter Type Description
> uly String underlying

After:

Parameter Type Description
> instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION
Parameter Type Description
> instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION

2022-10-13

Parameter Type Description
> nextFundingTime String Forecasted funding time for the next period, Unix timestamp format in milliseconds, e.g. 1597026383085

2022-10-10

Parameter Type Required Description
allowPartialExecution Boolean No Whether the RFQ can be partially filled provided that the shape of legs stays the same.

Valid value is true or false. false by default. |

Parameter Type Required Description
legs Array of objects No An Array of objects containing the execution size of each leg of the RFQ.
*Note: tgtCcy and side of each leg will be same as ones in the RFQ. px will be the same as the ones in the Quote.
> instId String Yes The Instrument ID, for example: "BTC-USDT-SWAP".
> sz String Yes The size of each leg
Parameter Type Required Description
includeAll Boolean No Receive all instruments or not under specific instType setting. Valid value can be boolean (True/False). By default, the value will be false.
Parameter Type Description
> allowPartialExecution Boolean Whether the RFQ can be partially filled provided that the shape of legs stays the same.

Valid value is true or false. false by default. |

Error Message Error Code
Please specify your instrument settings for at least one instType. 70013
It's not allowed to have includeAll=True for all the instType. 70014
The total value of all-spot RFQs should be greater than the min notional value {spotMinNotional} 70108
Leg sizes specified are under the minimum block size required by Jupiter. 70503
Leg sizes specified do not have the same ratios as the whole RFQ. 70506
Partial execution was attempted but allowPartialExecution of the RFQ is not enabled. 70507

2022-10-10

Parameter Type Required Description
type String No Deposit Type
3: internal transfer
4: deposit from chain

Request Parameter:

Parameter Type Required Description
type String No Withdrawal type
3: internal transfer
4: withdrawal to chain

Response Parameter:

Parameter Type Description
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'}

2022-09-28

Parameter Type Description
instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION
Parameter Type Required Description
instFamily String No Instrument family
Applicable to FUTURES/SWAP/OPTION

Request Parameter:

Parameter Type Required Description
instFamily String Conditional Single instrument familiy or multiple instrument families (no more than 5) separated with comma.
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required. If both are passed, instFamily will be used.

Response Parameter:

Parameter Type Description
instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION

Request Parameter:

Parameter Type Required Description
instFamily String Conditional Instrument family
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required. If both are passed, instFamily will be used.

Response Parameter:

Parameter Type Description
instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION
Parameter Type Required Description
instFamily String Conditional Instrument family
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required. If both are passed, instFamily will be used.

Before:

Parameter Type Required Description
> uly String Conditional underlying

After:

Parameter Type Required Description
> instFamily String Conditional Instrument family
Applicable to FUTURES/SWAP/OPTION

Before:

Parameter Type Required Description
uly String Yes Single underlying or multiple underlyings (no more than 3) separated with comma.

After:

Parameter Type Required Description
uly String Conditional Single underlying or multiple underlyings (no more than 3) separated with comma.
Either uly or instFamily is required.
If both are passed, instFamily will be used.
instFamily String Conditional Single instrument family or instrument families (no more than 5) separated with comma.
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required.
If both are passed, instFamily will be used.

Before:

Parameter Type Required Description
uly String Yes Underlying

After:

Parameter Type Required Description
uly String Conditional Underlying
Either uly or instFamily is required.If both are passed, instFamily will be used.
instFamily String Conditional Instrument family
Applicable to FUTURES/SWAP/OPTION
Either uly or instFamily is required.If both are passed, instFamily will be used.

Before:

Parameter Type Description
> uly String underlying

After:

Parameter Type Description
> instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION
Parameter Type Description
> instFamily String Instrument family
Applicable to FUTURES/SWAP/OPTION

2022-09-22

2022-09-08

before:

Parameter Type Description
taker String Taker fee rate. It is the fee rate of crypto-margined contracts for FUTURES and SWAP
maker String Maker fee rate. It is the fee rate of crypto-margined contracts for FUTURES and SWAP
takerU String Taker fee rate of USDT-margined contracts, only applicable to FUTURES/SWAP
makerU String Maker fee rate of USDT-margined contracts, only applicable to FUTURES/SWAP

after:

Parameter Type Description
taker String Taker fee rate for the USDT&USDⓈ&Crypto trading pairs and contracts. It is the fee rate of crypto-margined contracts for FUTURES and SWAP
maker String Maker fee rate for the USDT&USDⓈ&Crypto trading pairs and contracts. It is the fee rate of crypto-margined contracts for FUTURES and SWAP
takerU String Taker fee rate of USDT-margined contracts, only applicable to FUTURES/SWAP
makerU String Maker fee rate of USDT-margined contracts, only applicable to FUTURES/SWAP
takerUSDC String Taker fee rate for the USDC trading pairs
makerUSDC String Maker fee rate for the USDC trading pairs
Parameter Type Description
clOrdId String Client Order ID as assigned by the client
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

2022-09-06

Parameter Type Description
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

before:

Parameter Type Description
taker String Taker fee rate. It is the fee rate of crypto-margined contracts for FUTURES and SWAP
maker String Maker fee rate. It is the fee rate of crypto-margined contracts for FUTURES and SWAP
takerU String Taker fee rate of USDT-margined contracts, only applicable to FUTURES/SWAP
makerU String Maker fee rate of USDT-margined contracts, only applicable to FUTURES/SWAP

after:

Parameter Type Description
taker String Taker fee rate for the USDT&USDⓈ&Crypto trading pairs and contracts. It is the fee rate of crypto-margined contracts for FUTURES and SWAP
maker String Maker fee rate for the USDT&USDⓈ&Crypto trading pairs and contracts. It is the fee rate of crypto-margined contracts for FUTURES and SWAP
takerU String Taker fee rate of USDT-margined contracts, only applicable to FUTURES/SWAP
makerU String Maker fee rate of USDT-margined contracts, only applicable to FUTURES/SWAP
takerUSDC String Taker fee rate for the USDC trading pairs
makerUSDC String Maker fee rate for the USDC trading pairs

2022-09-05

Parameter Description
affiliated Whether there is affiliated relation. true or false

2022-09-01

Parameter Type Description
> maxBlockSz String For FUTURES, OPTION and SWAP the max quantity of the RFQ/Quote is in unit of contracts. For SPOT, this parameter is in base currency.
> makerPxBand String Price bands in unit of ticks, are against mark price. Set makerPxBand to 1 tick means:
If Bid price > Mark + 1 tick, it will be stopped
If Ask price < Mark - 1 tick, It will be stopped
Parameter Type Description
> reason String Reasons of state. Valid values can be mmp_canceled.
Parameter Type Description
clOrdId String Client-supplied ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.
Parameter Type Description
algoOrdType String moon_grid: Moon grid
Error Message HTTP Status Error Code
Operation failed under MMP status, the frozen window is {0} seconds. 200 70008
Duplicate setting for underlying/instId {0} under the same instType {1}. 200 70012
Quoted price of instId {0} cannot exceed your preset price limit. 200 70310

2022-08-29

Parameter Type Description
clOrdId String Client-supplied ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

before:

Parameter Type Required Description
chgTaker String Conditional Taker fee rate for changing
For absolute: The unit is bp (1bp = 0.01%). Range belongs to [0.1 bp, 1,000bp], same as [0.001%, 10%]. Precision is 0.1 bp.
For percentage: The unit is percent(%). Range belongs to [1%, 10000%]. Precision is 1%
chgMaker String Conditional Maker fee rate for changing
For absolute: The unit is bp (1bp = 0.01%). Range belongs to [0.1 bp, 1,000bp], same as [0.001%, 10%]. Precision is 0.1 bp.
For percentage: The unit is percent(%). Range belongs to [1%, 10000%]. Precision is 1%
Either chgTaker or chgMaker is required.

after:

Parameter Type Required Description
chgTaker String Conditional Taker fee rate for changing
For absolute: The unit is bp (1bp = 0.01%). Range belongs to [0 bp, 1,000bp], same as [0.00%, 10%]. Precision is 0.1 bp.
For percentage: The unit is percent(%). Range belongs to [0%, 10000%]. Precision is 1%
chgMaker String Conditional Maker fee rate for changing
For absolute: The unit is bp (1bp = 0.01%). Range belongs to [0 bp, 1,000bp], same as [0.00%, 10%]. Precision is 0.1 bp.
For percentage: The unit is percent(%). Range belongs to [0%, 10000%]. Precision is 1%
Either chgTaker or chgMaker is required.

2022-08-26

Parameter Type Description
tag String Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.
Error Message HTTP Status Code Error Code
RFQ quantity cannot be less than the lower limit 200 52917
Insufficient balance in funding account 200 52918
Parameter {param} of convert trading is inconsistent with the quotation 200 52919
Quantity of convert trading cannot exceed the quotation quantity 200 52920
Quote traded, please ask for quote again 200 52921
Quote expired, please ask for quote again 200 52922
Service unavailable, please try again later 200 52923

2022-08-25

Error Message HTTP Status Code Error Code
Unable to place order. Spot trading only supports using the last price as trigger price. Please select "Last" and try again. 200 51415

2022-08-24

Parameter Type Required Description
unSpotOffset Boolean No true: disable Spot-Derivatives risk offset, false: enable Spot-Derivatives risk offset
Default is false
Only applicable to Portfolio margin
It is effective when Spot-Derivatives risk offset is turned on, otherwise this parameter is ignored.
Parameter Type Description
spotOffsetMaxWd String Max withdrawal under Spot-Derivatives risk offset mode (excludes borrowed crypto transfer out under Portfolio margin)
Applicable to Portfolio margin
spotOffsetMaxWdEx String Max withdrawal under Spot-Derivatives risk offset mode (includes borrowed crypto transfer out under Portfolio margin)
Applicable to Portfolio margin
Parameter Type Description
spotOffsetType String Risk offset type
1: Spot-Derivatives(USDT) to be offsetted
2: Spot-Derivatives(Coin) to be offsetted
3: Only derivatives to be offsetted
Only applicable to Portfolio margin
Parameter Type Required Description
omitPosRisk String No Ignore position risk
Default is false
Applicable to Portfolio margin
Parameter Type Description
> spotInUseAmt String Spot in use amount
Applicable to Portfolio margin
Parameter Type Description
> spotInUseAmt String Spot in use amount
Applicable to Portfolio margin
> spotInUseCcy String Spot in use unit, e.g. BTC
Applicable to Portfolio margin
Error Message HTTP Status Code Error Code
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. 200 58121
A portion of your spot is being used for Delta offset between positions. If the transfer amount exceeds the available amount, it may affect current spot-derivatives risk offset structure, which will result in an increased Maintenance Margin Requirement (MMR) rate. Please be aware of your risk level. 200 58122

2022-08-15

Parameter Type Description
uid String Account ID

before:

Parameter Type Required Description
label String Yes API Key note
No more than 50 letters (case sensitive) or numbers, which can be pure letters or pure numbers.
The field will be reset if set.
perm String Yes API Key permissions
read_only: Read only
trade: Trade
Separate with commas if more than one.
The field will be reset if set.

after:

Parameter Type Required Description
label String No API Key note
No more than 50 letters (case sensitive) or numbers, which can be pure letters or pure numbers.
The field will be reset if set.
perm String No API Key permissions
read_only: Read only
trade: Trade
Separate with commas if more than one.
The field will be reset if set.

2022-08-10

Error Message HTTP Status Code Error Code
Underlying index {0} does not exist under instType {1}. 200 70007
Data must have at least 1 valid element. 200 70009
Duplicate setting for instType {0}. 200 70011
Counterparties for selected instruments are currently unavailable. 200 70109

2022-08-03

Error Message HTTP Status Code Error Code
Missing label of withdrawal address. 200 58221
Illegal withdrawal address. 200 58222
This type of coin does not support on-chain withdrawals within OKX. Please use internal transfers. 200 58224

2022-08-02

2022-07-25

Parameter Type Required Description
posId String No Position ID

2022-07-22

2022-07-18

2022-07-15

Parameter Type Description
tag String Order tag

2022-07-11

before adjusting request fields:

Parameter Type Required Description
after String No Pagination of data to return records earlier than the requested tradeId.
before String No Pagination of data to return records newer than the requested tradeId.

after adjusting request fields:

Parameter Type Required Description
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

2022-07-01

2022-06-30

Parameter Type Description
minDep String Minimum deposit amount of the currency in a single transaction
needTag Boolean Whether tag/memo information is required for withdrawal
minDepArrivalConfirm String Minimum number of blockchain confirmations to acknowledge fund deposit
minWdUnlockConfirm String Minimum number of blockchain confirmations required for withdrawal of a deposit
Parameter Type Description
actualDepBlkConfirm String The actual amount of blockchain confirmed in a single deposit

2022-06-24

before adjusting request fields:

Parameter Type Required Description
uly String Conditional Underlying
Required when instType is one of SWAP,FUTURES,OPTION, ignore when instType is MARGIN
instId String Conditional Instrument ID, e.g. BTC-USDT
Required when instType is MARGIN, ignore when instType is one of SWAP,FUTURES,OPTION

after adjusting request fields:

Parameter Type Required Description
uly String Conditional Single underlying or multiple underlyings (no more than 3) separated with comma.
Required when instType is one of SWAP,FUTURES,OPTION, ignore when instType is MARGIN
instId String Conditional Single instrument or multiple instruments (no more than 5) separated with comma.
Required when instType is MARGIN, ignore when instType is one of SWAP,FUTURES,OPTION

2022-06-23

before:

Response Parameters

Parameter Type Description
type String The type of closing position
partClose:Close position partially;allClose:Close all;3:Liquidation;4:Partial liquidation; 5:ADL;
It is the latest type if there are several types for the same position.
posSide String Direction: long short
Only applicable to MARGIN/FUTURES/SWAP/OPTION

after:

Parameter Type Description
type String The type of closing position
1:Close position partially;2:Close all;3:Liquidation;4:Partial liquidation; 5:ADL;
It is the latest type if there are several types for the same position.
direction String Direction: long short
Only applicable to MARGIN/FUTURES/SWAP/OPTION

2022-06-20

before adjusting request fields:

Parameter Type Required Description
state String No System maintenance status,scheduled: waiting; ongoing: processing; completed: completed ;canceled: canceled .
If this parameter is not filled, the data with status scheduled and ongoing will be returned by default

after adjusting request fields:

Parameter Type 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

before adjusting response fields:

Parameter Type Description
end String End time of system maintenance, Unix timestamp format in milliseconds, e.g. 1617788463867.
It is expected end time before completed, changed to actual end time after completed.
serviceType String Service type, 0:WebSocket ; 5:Trading service

after adjusting response fields:

Parameter Type Description
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.
serviceType String Service type, 0:WebSocket ; 5:Trading service; 99: Others (e.g. Suspend partial instruments)

before:

Parameter Type Description
> end String End time of system maintenance, Unix timestamp format in milliseconds, e.g. 1617788463867.
It is expected end time before completed, changed to actual end time after completed
> serviceType String Service type, 0:WebSocket ; 5:Trading service

after:

Parameter Type Description
> 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.
> serviceType String Service type, 0:WebSocket ; 5:Trading service; 99: Others (e.g. Suspend partial instruments)

2022-06-16

2022-06-14

before:

Parameter Type Description
type String The type of closing position
partClose:Close position partially;allClose:Close all;3:Liquidation;4:Partial liquidation; 5:ADL;
It is the latest type if there are several types for the same position.
posSide String Direction: long short
Only applicable to MARGIN/FUTURES/SWAP/OPTION

after:

Parameter Type Description
type String The type of closing position
1:Close position partially;2:Close all;3:Liquidation;4:Partial liquidation; 5:ADL;
It is the latest type if there are several types for the same position.
direction String Direction: long short
Only applicable to MARGIN/FUTURES/SWAP/OPTION

2022-06-10

Error Message HTTP Status Code Error Code
Futures Grid is not available in Portfolio Margin mode 200 51055
Action not allowed 200 51056
This bot isn’t available in current account mode. Switch mode in Settings > Account mode to continue. 200 51057
No available position for this algo order 200 51058
Strategy for the current state does not support this operation 200 51059
Used margin must be greater than {0}{1} 200 51340
Position closing not allowed 200 51341
Closing order already exists. Please try again later 200 51342
TP price must be less than the lower price 200 51343
SL price must be greater than the upper price 200 51344
Policy type is not grid policy 200 51345
The highest price cannot be lower than the lowest price 200 51346
No profit available 200 51347
Stop loss price should be less than the lower price in the range 200 51348
Stop profit price should be greater than the highest price in the range 200 51349
Single income must be greater than 0 200 51351

2022-06-09

before:

Parameter Type Required Description
label String No Sub-account notes

after:

Parameter Type Required Description
label String No Sub-account notes
No more than 50 letters (case sensitive) or numbers, which can be pure letters or pure numbers.

before:

Parameter Type Required Description
label String Yes API Key note

after:

Parameter Type Required Description
label String Yes API Key note
No more than 50 letters (case sensitive) or numbers, which can be pure letters or pure numbers.

before:

Parameter Type Required Description
label String Yes API Key note

after:

Parameter Type Required Description
label String Yes API Key note
No more than 50 letters (case sensitive) or numbers, which can be pure letters or pure numbers.

2022-06-07

2022-06-01

2022-05-26

Parameter Type Required Description
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

2022-05-23

2022-05-20

Parameter Type Required Description
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

The rules of filtering with beginand end are as follows:
1. The result includes parameters of begin and end.
2. Return near end if begin and end both exist.
3. The endpoint filters with begin and end first, and then paginates with after and before when begin or end, after or before exist at the same request.

2022-05-19

2022-05-18

before:

Parameter Type Required Description
passphrase String Yes API Key password, supports 6 to 32 lowercase alphanumeric characters and at least one uppercase letter or special character
ip String Yes Link IP addresses, separate with commas if more than one. Support up to 20 addresses

after:

Parameter Type Required Description
passphrase String Yes API Key password, supports 8 to 32 alphanumeric characters containing at least 1 number, 1 uppercase letter, 1 lowercase letter and 1 symbol
ip String Conditional Link IP addresses, separate with commas if more than one. Support up to 20 addresses
If sub-account API Key has trade permission, linking IP addresses is required.

before:

Parameter Type Required Description
ip String No Link IP addresses, separate with commas if more than one. Support up to 20 addresses

after:

Parameter Type Required Description
ip String No Link IP addresses, separate with commas if more than one. Support up to 20 addresses
The field will be reset if set.
If sub-account API Key has trade permission, linking IP addresses is required.

2022-05-13

Parameter Type Description
clientId String Client-supplied ID
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters.

2022-05-07

For details, please refer to OKX Will Make Changes to the 'Get Fee Rates' Interface

2022-05-05

Depth Channel Before After
bbo-tbt None 1.Newly added channel that sends tick-by-tick Level 1 data
2.All API users can subscribe
3.Public depth channel, verification not required
books-l2-tbt 1.All API users can subscribe
2.Public depth channel, verification not required
1.Only users who are VIP5 and above can subscribe
2.Identity verification required before subscription, identity verification refers to Login
books50-l2-tbt 1.All API users can subscribe
2.Public depth channel, verification not required
1.Only users who are VIP4 and above can subscribe
2.Identity verification required before subscription, identity verification refers to Login
books 1.All API users can subscribe
2.Public depth channel, verification not required
No update
books5 1.All API users can subscribe
2.Public depth channel, verification not required
No update.
The change from pushing data every "200" ms to pushing data every "100" ms will go live in two weeks.
Parameter Type Required Description
type String No 3: sub-account to master account (Only applicable to API Key from sub-account)
4: sub-account to sub-account(Only applicable to APIKey from sub-account, and target account needs to be another sub-account which belongs to same master account)
Parameter Type Description
canTransOut Boolean Whether the sub-account has the right to transfer out. The default is true.
false: cannot transfer out
true: can transfer
Error Message Error Code
{0} Sub-account has no permission to transfer out, please set first 58119

2022-04-28

Parameter Type Description
maxLmtSz String The maximum order quantity of the contract or spot limit order
maxMktSz String The maximum order quantity of the contract or spot market order
maxTwapSz String The maximum order quantity of the contract or spot twap order
maxIcebergSz String The maximum order quantity of the contract or spot iceBerg order
maxTriggerSz String The maximum order quantity of the contract or spot trigger order
maxStopSz String The maximum order quantity of the contract or spot stop order
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
MARGIN


Parameter Type Description
maxLmtSz String The maximum order quantity of the contract or spot limit order
maxMktSz String The maximum order quantity of the contract or spot market order
maxTwapSz String The maximum order quantity of the contract or spot twap order
maxIcebergSz String The maximum order quantity of the contract or spot iceBerg order
maxTriggerSz String The maximum order quantity of the contract or spot trigger order
maxStopSz String The maximum order quantity of the contract or spot stop order

2022-04-26

Parameter Type Description
logoLink String Logo link of currency

2022-04-25

Depth Channel Before After
bbo-tbt None 1.Newly added channel that sends tick-by-tick Level 1 data
2.All API users can subscribe
3.Public depth channel, verification not required
books-l2-tbt 1.All API users can subscribe
2.Public depth channel, verification not required
1.Only users who are VIP5 and above can subscribe
2.Identity verification required before subscription, identity verification refers to Login
books50-l2-tbt 1.All API users can subscribe
2.Public depth channel, verification not required
1.Only users who are VIP4 and above can subscribe
2.Identity verification required before subscription, identity verification refers to Login
books 1.All API users can subscribe
2.Public depth channel, verification not required
No update
books5 1.All API users can subscribe
2.Public depth channel, verification not required
1. All API users can subscribe
2. Public depth channel, verification not required
3. It will push data every 100ms (currently it pushes every 200ms)

2022-04-15

For details, please refer to OKX Will Make Changes to the 'Get Fee Rates' Interface

2022-04-14

{
  "op": "subscribe",
  "args": [
    {
      "channel": "bbo-tbt",
      "instId": "BTC-USDT"
    }
  ]
}

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
bbo-tbt
> instId String Yes Instrument ID

Response Example

{
  "event": "subscribe",
  "arg": {
    "channel": "bbo-tbt",
    "instId": "BTC-USDT"
  }
}

Failure example

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

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:

{
    "arg": {
        "channel": "bbo-tbt",
        "instId": "BTC-USDT"
    },
    "data": [{
        "asks": [
            ["8506.96", "100", "0", "2"]
        ],
        "bids": [
            ["8446", "95", "0", "3"]
        ],
        "ts": "1597026383085"
    }]
}

Push Data Example:Only the bids has depth

{
    "arg": {
        "channel": "bbo-tbt",
        "instId": "BTC-USDT"
    },
    "data": [{
        "asks": [],
        "bids": [
            ["8446", "95", "0", "3"]
        ],
        "ts": "1597026383085"
    }]
}

* The "book5" depth channel is adjusted from pushing data every "200" ms to pushing data every "100" ms
* Only API users who are VIP5 and above in trading fee tier are allowed to subscribe to "books-l2-tbt" 400 depth channels
* Only API users who are VIP4 and above in trading fee tier are allowed to subscribe to "books50-l2-tbt" 50 depth channels

Depth Channel Before After
bbo-tbt None 1.Newly added channel that sends tick-by-tick Level 1 data
2.All API users can subscribe
3.Public depth channel, verification not required
books-l2-tbt 1.All API users can subscribe
2.Public depth channel, verification not required
1.Only users who are VIP5 and above can subscribe
2.Identity verification required before subscription, identity verification refers to Login
books50-l2-tbt 1.All API users can subscribe
2.Public depth channel, verification not required
1.Only users who are VIP4 and above can subscribe
2.Identity verification required before subscription, identity verification refers to Login
books 1.All API users can subscribe
2.Public depth channel, verification not required
No update
books5 1.All API users can subscribe
2.Public depth channel, verification not required
1. All API users can subscribe
2. Public depth channel, verification not required
3. It will push data every 100ms (currently it pushes every 200ms)

2022-04-08

2022-04-07

Parameter Type Required Description
tag String No Order tag
Parameter Type Description
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 USDT
usedWdQuota String Amount of currency withdrawal used in the past 24 hours, unit in USDT
Parameter Type Required Description
depId String No Deposit ID
Parameter Type Required Description
wdId String No Withdrawal ID
Error Message Error Code
The daily usage of small assets convert exceeds the limit. 58370
Small assets exceed the maximum limit. 58371
Insufficient small assets. 58372
Withdrawal ID does not exist. 58215
Operation not allowed. 58216

2022-03-10

If the user continues to pass in the funds password, the parameter will be ignored and no error will be reported.

Response Parameters
Parameters Types Description
mr1 String spot & vol movements
mr2 String theta decay
mr3 String vega term-structure
mr4 String basis risk
mr5 String interest-rate risk
mr6 String extreme market move
mr7 String transaction cost & slippage
Error Message Error Code
You are not currently on the whitelist, please contact customer service 50041
This endpoint requires that APIKey must be bound to IP 50035
begin date cannot be greater than end date. 59615
The time interval between the begin date and end date cannot exceed 180 days. 59616

2022-03-02

2022-02-17

Parameter Type Required Description
rate String No Purchase rate
Only applicable to purchase saving shares
The interest rate of the new subscription will cover the interest rate of the last subscription
The default interest rate of 1%
The rate value range is between 1% and 365%

after:

Parameter Type Required Description
rate String Yes Purchase rate
Only applicable to purchase saving shares
The interest rate of the new subscription will cover the interest rate of the last subscription
The rate value range is between 1% and 365%

Business announcement

2022-01-26

Parameter Type Description
type String Sub-account type 1:Standard sub-account 2:Custody trading sub-account

2022-01-25

Parameter Type Description
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'}

2022-01-20

2022-01-18

Parameter Type Description
tag String Order tag
A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters.

2022-01-17

Parameter Type Description
triggerPxType String Trigger price type
last: last price
index: index price
mark: mark price
Parameter Type Required Description
triggerPxType String No Trigger price type
last: last price
index: index price
mark: mark price
The Default is last

2022-01-14

2022-01-11

2022-01-06

Parameter Type Description
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

added enumeration value for ordType field

Parameter Type Description
ordType String move_order_stop: Trailing 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

added enumeration value for ordType field

Parameter Type Description
ordType String move_order_stop: Trailing order
Error Message Error Code
Wrong passphrase 60024

2021-12-24

Parameter Type Description
ctIsoMode String Contract isolated margin trading settings
automatic:Auto transfers autonomy:Manual transfers
mgnIsoMode String Margin isolated margin trading settings
automatic:Auto transfers autonomy:Manual transfers


Parameter Type Description
baseBal String Base currency balance, only applicable to MARGIN(Manual transfers)
quoteBal String Quote currency balance, only applicable to MARGIN(Manual transfers)


Parameter Type Required Description
auto Boolean No Automatic loan transfer out, true or false, the default is false
only applicable to MARGIN(Manual transfers)
loanTrans Boolean No Whether or not borrowed coins can be transferred out under Multi-currency margin
the default is false


Parameter Type Required Description
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.

2021-12-14

Parameter Type Description
rate String Lending rate
loanAmt String Lending amount
pendingAmt String Pending amount
redemptAmt String Redempting amount


Parameter Type Description
rate String Lending rate


Parameter Type Description
> irDiscount String Interest rate discount
Discarded field, always return ""

2021-12-06

Parameter Type Required Description
loanTrans Boolean No Whether or not borrowed coins can be transferred out under Multi-currency margin
the default is false


Parameter Type Description
maxWdEx String Max withdrawal (allowing borrowed crypto transfer out under Multi-currency margin)


Parameter Type Description
> level String VIP Level, e.g. VIP5

2021-12-04

Parameter Type Description
tpTriggerPxType String Take-profit trigger price type.
last: last price
index: index price
mark: mark price
slTriggerPxType String Stop-loss trigger price type.
last: last price
index: index price
mark: mark price
Parameter Type Required Description
tpTriggerPxType String No Take-profit trigger price type

last: last price
index: index price
mark: mark price
The Default is last
slTriggerPxType String No Stop-loss trigger price type

last: last price
index: index price
mark: mark price
The Default is last

2021-11-26

Parameter Type Required Description
reduceOnly Boolean No Whether the order can only reduce the position size.
Valid options: true or false. The default value is false.
Only applicable to MARGIN orders, and FUTURES/SWAP orders in net mode
Only applicable to Spot and futures mode and Multi-currency margin

2021-11-25

Parameter Type Description
type String Loan type
1: VIP loans
2: Market loans


Parameter Type Description
subType String 14: Interest deduction for VIP loans
Error Message HTTP Status Code Error Code
Insufficient available margin, add margin or reduce the borrowing amount 200 59303
Insufficient equity for borrowing, keep enough funds to pay interest for at least one day 200 59304
Use VIP loan first to set the VIP loan priority 200 59305
Your borrowing amount exceeds the max limit 200 59306
You are not eligible for VIP loans 200 59307
Unable to repay VIP loan due to insufficient borrow limit 200 59308
Unable to repay an amount that exceeds the borrowed amount 200 59309
Your account does not support VIP loan 200 59310
Unable to set up as there is VIP loan 200 59311
{currency} does not support VIP loans 200 59312

2021-11-23

2021-11-20

Response Parameters

Parameter Type Description
leverage String Real leverage after the margin adjustment

2021-11-02

Parameter Type Required Description
leverage String No Leverage for instrument
The default is current leverage
Only applicable to MARGIN/FUTURES/SWAP

2021-11-01

Parameter Type Description
category String Category
normal
twap
adl
full_liquidation
partial_liquidation
delivery
ddh: Delta dynamic hedge
Parameter Type Description
category String Category
normal
twap
adl
full_liquidation
partial_liquidation
delivery
ddh: Delta dynamic hedge
Parameter Type Description
category String Category
normal
twap
adl
full_liquidation
partial_liquidation
delivery
ddh: Delta dynamic hedge
Parameter Type Description
category String Category
normal
twap
adl
full_liquidation
partial_liquidation
delivery
ddh: Delta dynamic hedge
Parameter Type Required Description
type String No Bill type
1: Transfer 2: Trade 3: Delivery 4: Forced repayment 5: Liquidation 6: Margin transfer 7: Interest deduction 8: Funding fee 9: ADL 10: Clawback 11: System token conversion 12: Strategy transfer 13: ddh
subType String No Bill subtype
1: Buy 2: Sell 3: Open long 4: Open short 5: Close long 6: Close short 9: Interest deduction 11: Transfer in 12: Transfer out 160: Manual margin increase 161: Manual margin decrease 162: Auto margin increase 110: Auto buy 111: Auto sell 118: System token conversion transfer in 119: System token conversion transfer out 100: Partial liquidation close long 101: Partial liquidation close short 102: Partial liquidation buy 103: Partial liquidation sell 104: Liquidation long 105: Liquidation short 106: Liquidation buy 107: Liquidation sell 110: Liquidation transfer in 111: Liquidation transfer out 125: ADL close long 126: ADL close short 127: ADL buy 128: ADL sell 131: ddh buy 132: ddh sell 170: Exercised 171: Counterparty exercised 172: Expired OTM 112: Delivery long 113: Delivery short 117: Delivery/Exercise clawback 173: Funding fee expense 174: Funding fee income 200:System transfer in 201: Manually transfer in 202: System transfer out 203: Manually transfer out
Parameter Type Required Description
type String No Bill type
1: Transfer 2: Trade 3: Delivery 4: Forced repayment 5: Liquidation 6: Margin transfer 7: Interest deduction 8: Funding fee 9: ADL 10: Clawback 11: System token conversion 12: Strategy transfer 13: ddh
subType String No Bill subtype
1: Buy 2: Sell 3: Open long 4: Open short 5: Close long 6: Close short 9: Interest deduction 11: Transfer in 12: Transfer out 160: Manual margin increase 161: Manual margin decrease 162: Auto margin increase 110: Auto buy 111: Auto sell 118: System token conversion transfer in 119: System token conversion transfer out 100: Partial liquidation close long 101: Partial liquidation close short 102: Partial liquidation buy 103: Partial liquidation sell 104: Liquidation long 105: Liquidation short 106: Liquidation buy 107: Liquidation sell 110: Liquidation transfer in 111: Liquidation transfer out 125: ADL close long 126: ADL close short 127: ADL buy 128: ADL sell 131: ddh buy 132: ddh sell 170: Exercised 171: Counterparty exercised 172: Expired OTM 112: Delivery long 113: Delivery short 117: Delivery/Exercise clawback 173: Funding fee expense 174: Funding fee income 200:System transfer in 201: Manually transfer in 202: System transfer out 203: Manually transfer out
Parameter Type Description
uid String Account ID
acctLv String Account level
1: Spot mode 2: Spot and futures mode 3: Multi-currency margin 4:Portfolio margin
Parameter Type Required Description
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/1W/1M/3M/6M/1Y]
UTC time opening price k-line:[/6Hutc/12Hutc/1Dutc/1Wutc/1Mutc/3Mutc/6Mutc/1Yutc]
Parameter Type Required Description
> channel String Yes Channel name
index-candle1Y
index-candle6M
index-candle3M
index-candle1M
index-candle1W
index-candle1D
index-candle2D
index-candle3D
index-candle5D
index-candle12H
index-candle6H
index-candle4H
index -candle2H
index-candle1H
index-candle30m
index-candle15m
index-candle5m
index-candle3m
index-candle1m
index-candle1Yutc
index-candle3Mutc
index-candle1Mutc
index-candle1Wutc
index-candle1Dutc
index-candle2Dutc
index-candle3Dutc
index-candle5Dutc
index-candle12Hutc
index-candle6Hutc
Parameter Type Required Description
> channel String Yes Channel name
mark-price-candle1Y
mark-price-candle6M
mark-price-candle3M
mark-price-candle1M
mark-price-candle1W
mark-price-candle1D
mark-price-candle2D
mark-price-candle3D
mark-price-candle5D
mark-price-candle12H
mark-price-candle6H
mark-price-candle4H
mark-price-candle2H
mark-price-candle1H
mark-price-candle30m
mark-price-candle15m
mark-price-candle5m
mark-price-candle3m
mark-price-candle1m
mark-price-candle1Yutc
mark-price-candle3Mutc
mark-price-candle1Mutc
mark-price-candle1Wutc
mark-price-candle1Dutc
mark-price-candle2Dutc
mark-price-candle3Dutc
mark-price-candle5Dutc
mark-price-candle12Hutc
mark-price-candle6Hutc
Parameter Type Required Description
channel String Yes Channel name
candle1Y
candle6M candle3M candle1M
candle1W
candle1D candle2D candle3D candle5D
candle12H candle6H candle4H candle2H candle1H
candle30m candle15m candle5m candle3m candle1m
candle1Yutc candle3Mutc candle1Mutc candle1Wutc candle1Dutc candle2Dutc candle3Dutc candle5Dutc candle12Hutc candle6Hutc
Parameter Type Description
execType String Liquidity taker or maker
T: taker
M: maker
Parameter Type Description
execType String Liquidity taker or maker
T: taker
M: maker
Error Message HTTP Status Code Error Code
The current account risk status only supports you to place IOC orders that can reduce the risk of your account. 200 51037
There is already an IOC order under the current risk module that reduces the risk of the account. 200 51038
Leverage cannot be adjusted for the cross positions of Futures and Perpetual swap under the PM account. 200 51039
Cannot adjust margins for long isolated options positions 200 51040
The current account mode does not support this API interface. 200 51010
Portfolio margin account does not support ordType {0} in Trading bot mode 200 51295
Portfolio margin account only supports net mode. 200 51041
Failed to amend bulk orders. You cannot add duplicate batch orders in your Portfolio margin account. 200 51512
No net long positions can be held under cross margin mode in options. 200 51019

2021-10-19

Parameter Type Description
markPx String Mark price
Parameter Type Description
>markPx String Mark price

2021-10-18

Parameters Types Description
mainNet Boolean If current chain is main net then return true
Error Message HTTP Status Code Error Code
No permission to use this API 200 50030
Trigger orders are not available in the net mode of futures and perpetual swaps 200 51298
Withdrawals suspended due to {chainName} maintenance 200 58214
Only IDs with the same instrument type are supported 200 59004

2021-10-15

Real Trading supported iceberg order and twap order.

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order

after:

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order
iceberg: Iceberg order
twap: TWAP order

Added new request fields:

Iceberg Order

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

TWAP Order

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

before:

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order

after:

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order
iceberg: Iceberg order
twap: TWAP order

Added new returned fields:

Parameter Type Description
pxVar String Price variance
Only applicable to iceberg order or twap order
pxSpread String Price Ratio
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

2021-10-14

2021-10-12

2021-09-30

Error Message HTTP Status Code Error Code
Invoice expired. 200 58351
Invalid invoice. 200 58352
Deposit amount must be within limits. 200 58353
You have reached the limit of 10,000 invoices per day. 200 58354
Permission denied. Please contact your account manager. 200 58355
The accounts of the same node do not support the Lightning network deposit or withdrawal. 200 58356

2021-09-08

Error Message HTTP Status Code Error Code
The range of Price variance is {0}~{1} 200 51282
The range of Time interval is {0}~{1} 200 51283
The range of Average amount is {0}~{1} 200 51284
The range of Total amount is {0}~{1} 200 51285
The total amount should not be less than {0} 200 51286
Contract not supported 200 51287
We are stopping the Bot. Please do not click it multiple times 200 51288
Bot configuration does not exist. Please try again later 200 51289
The Bot engine is being upgraded. Please try again later 200 51290
This Bot does not exist or has been stopped 200 51291
This Bot type does not exist 200 51292
This Bot does not exist 200 51293
This Bot cannot be created temporarily. Please try again later 200 51294

2021-09-07

Parameter Type Required Description
instId String No Single instrument or multiple instruments (no more than 20) separated with comma.

2021-09-06

Demo Trading supported iceberg order and twap order.

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order

after:

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order
iceberg: Iceberg order
twap: TWAP order

Added new request fields:

Iceberg Order

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

TWAP Order

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

before:

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order

after:

Parameter Type Required Description
ordType String Yes Order type
conditional: One-way stop order
oco: One-cancels-the-other order
trigger: Trigger order
iceberg: Iceberg order
twap: TWAP order

Added new returned fields:

Parameter Type Description
pxVar String Price variance
Only applicable to iceberg order or twap order
pxSpread String Price Ratio
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

2021-09-03

2021-08-31

Parameters Types Description
> stgyEq String strategy equity
> isoUpl String Isolated unrealized profit and loss of the currency
Applicable to Spot and futures mode and Multi-currency margin

2021-08-20

Parameter Type Required Description
txId String No Hash record of the deposit

2021-07-30

Parameter Type Required Description
tgtCcy String No The number of transactions the type
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT
Parameter Type Description
tgtCcy String The number of transactions the type
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT
Parameter Type Description
tgtCcy String The number of transactions the type
base_ccy: Base currency ,quote_ccy: Quote currency
Only applicable to SPOT
Error Message HTTP Status Code Error Code
The instrument type corresponding to this {0} does not support the tgtCcy parameter. 200 59110
Error Message HTTP Status Code Error Code
trigger not support the tgtCcy parameter. 200 51281

2021-07-20

2021-07-08

2021-06-15

Parameter Type Description
ctAddr String Last 6 digits of contract address
Parameter Type Description
chain String Chain name
There are multiple chains under some currencies, such as USDT has USDT-ERC20, USDT-TRC20. You have to make a distinction.

Added a new request field chain to Withdrawal

Parameter Type Required Description
chain String Conditional Chain name
There are multiple chains under some currencies, such as USDT has USDT-ERC20, USDT-TRC20. You have to make a distinction.
If the parameter is not filled in, the default will be the main chain.

2021-06-11

Error Message HTTP Status Code Error Code
Cannot be transferred out within 30 minutes after delivery. 200 55000
Parameter Type Required Description
instId String No Single instrument or multiple instruments (no more than 5) separated with comma, e.g. BTC-USDT-200802,ETH-USDT-200802

2021-06-08

before:

Parameter name Type Description
transferId int Transfer ID

after:

Parameter name Type Description
transId String Transfer ID

before:

code type httpcode msg
50011 int 429 Requests too frequent.

after:

code type httpcode msg
50011 String 429 Requests too frequent.
Parameter Type Required Description
instType String No Instrument type
MARGIN
SWAP
FUTURES
OPTION
instId will be checked against instType when both parameters are passed, and the position information of the instId will be returned.
instId String No Instrument ID, e.g. BTC-USD-190927-5000-C
If there were a position under instId, it would return the position information even if its open interest is 0. Otherwise, it will return an empty value.
posId String No Single position ID or multiple position IDs (no more than 20) separated with comma
Parameter Type Description
> fillNotionalUsd String Filled notional value in USD of order
> notionalUsd String Estimated national value in USD of order
Parameter Type Description
> notionalUsd String Estimated national value in USD of order

2021-05-25

Parameter Type Description
discountInfo Array Detailed discount rate of a certain currency
> discountRate String Discount rate
> maxAmt String Upper limit of a tier (USD). "" means positive infinity.
> minAmt String Lower limit of a tier (USD). The minimum value is 0.
Parameter Type Description
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
optimal_limit_ioc: Market order with immediate-or-cancel order (applicable only to Futures and Perpetual swap).

2021-05-18

2021-05-12

2021-04-27

2021-04-21

Parameter Type Description
> deltaBS String delta:Black-Scholes Greeks in dollars, only applicable to OPTION
> deltaPA String delta:Greeks in coins, only applicable to FUTURESSWAPOPTION
> gammaBS String gamma:Black-Scholes Greeks in dollars, only applicable to OPTION
> gammaPA String gamma:Greeks in coins, only applicable to OPTION
> thetaBS String theta:Black-Scholes Greeks in dollars, only applicable to OPTION
> thetaPA String theta:Greeks in coins, only applicable to OPTION
> vegaBS String vega:Black-Scholes Greeks in dollars, only applicable to OPTION `
> vegaPA String vega:Greeks in coins, only applicable to OPTION

2021-04-16

2021-03-31

2021-03-24

2021-03-02

2021-02-26

2021-02-05