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.
- Add new request parameter or enumeration. It will be launched on 20 November
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | No | Order typechase : 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 priceratio : 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 . |
- Add new response parameters. It will be launched on 20 November
Parameter | Type | Description |
---|---|---|
chaseType | String | Chase type. |
chaseVal | String | Chase value. |
maxChaseType | String | Maximum chase type. |
maxChaseVal | String | Maximum chase value. |
- Add new request parameter numeration. It will be launched on 20 November
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | No | Order typechase : chase order, only applicable to FUTURES and SWAP. |
- Add new response parameter numeration. It will be launched on 20 November
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
- Adjusted response parameters
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 | Apply to on-chain withdrawal (Deprecated) |
maxFee | String | Apply to on-chain withdrawal (Deprecated) |
minFeeForCtAddr | String | Apply to on-chain withdrawal (Deprecated) |
maxFeeForCtAddr | String | Apply to on-chain withdrawal (Deprecated) |
- Deleted request parameters
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
- OKX starts to support historical position data under the portfolio margin account mode. This function has been launched in production at 04:00 AM (UTC) on November 11, 2024. After the function is launched, the newly created positions of users in the portfolio margin account mode will generate historical position records after closing; positions created before the launch of the function will not generate historical position records when closed after the launch.
2024-11-08
- Added response parameters
Parameter | Type | Description |
---|---|---|
type | String | Account type 0 : Main account 1 : Standard sub-account 2 : Managed trading sub-account 5 : Custody trading sub-account - Copper9 : Managed trading sub-account - Copper12 : 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 - Copper9 : Managed trading sub-account - Copper12 : 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 |
- The limit is adjusted to 30 WebSocket connections per specific WebSocket channel per sub-account for certain channels.
2024-10-28
- Added response parameters
Parameter | Type | Description |
---|---|---|
fastRedemptionDailyLimit | String | Fast redemption daily limit If fast redemption is not supported, it will return ''. |
- Added response parameters
Parameter | Type | Description |
---|---|---|
fastRedemptionData | Array of object | Fast redemption data |
> ccy | String | Currency, e.g. BTC |
> redeemingAmt | String | Redeeming amount |
Added new endpoints
Added response parameters
Parameter | Type | Description |
---|---|---|
redeemingAmt | String | Redeeming amount |
2024-10-23
- Add a new auctionEndTime response parameter to indicate the end time of call auctions. The
preopen
of state is introduced for certain symbol listing, and the listTime will be updated to reflect the listing time.
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 statuspreopen e.g. Futures and options contracts rollover from generation to trading start; certain symbols before they go live. |
- Added response parameters:
Parameter | Type | Description |
---|---|---|
> spotCopyTradingEq | String | Spot smart sync equity. The default is "0", only applicable to copy trader. |
2024-10-17
Convert revamp
Convert
- New added error code
Error code | HTTP code | Error message |
---|---|---|
52914 | 200 | Insufficient available balance in trading account |
- According trading bills
Parameters | Type | Description |
---|---|---|
type | String | Bill type27 : Convert30 : Simple trade |
subType | String | Bill sub-type318 : Convert in319 : Convert out320 : Simple buy321 : Simple sell |
Easy convert
- Added new request parameters
Parameters | Type | Required | Description |
---|---|---|---|
source | String | No | Funding source1 : Trading account2 : Funding accountThe default is 1 . |
- According trading bills
Parameters | Type | Description |
---|---|---|
type | String | Bill type28 : Easy convert |
subType | String | Bill sub-type236 : Easy convert in237 : Easy convert out |
One-click repay
- According trading bills
Parameters | Type | Description |
---|---|---|
type | String | Bill type29 : One-click repay |
subType | String | Bill sub-type224 :One-click repay in225 :One-click repay out |
Small assets convert
- API offline
2024-10-15
- Added new response parameters
Parameter | Type | Description |
---|---|---|
> term | String | Borrowing term, e.g. 30D : 30 Days |
- Added new request parameters
Parameters | Types | Required | Description |
---|---|---|---|
term | String | No | Borrowing term, e.g. 30D : 30 Days |
- Added enumeration for parameter
Parameter | Type | Description |
---|---|---|
type | String | Sub-account type 9 : Managed trading sub-account - Copper12 : Custody trading sub-account - Komainu |
2024-10-14
Added new endpoints
Added new request parameters
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. |
- Added new bill subtypes for trading account
Parameter | Type | Description |
---|---|---|
subType | String | Bill subtype306 : Manual borrow307 : Auto borrow308 : Manual repay309 : Auto repay312 : Auto offset |
- Added new error codes
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
- Added new response parameters
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 |
- Added new response parameters
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 |
Nitro spread supports market orders, the request and response parameter ordType adds the enumeration value
market
.Nitro spread adds a new order cancellation scenario, the cancelSource response parameter adds the enumeration value
15
: Order canceled: The order price is beyond the limit.
2024-10-04
- Added call auction details WebSocket channel
2024-10-01
- Added public feature for endpoint:
2024-09-20
Added new endpoints
Added enumeration for parameter
Parameter | Type | Description |
---|---|---|
state | String | State8 : Pending repay (more details refer to Reduce liabilities for fixed loan) |
- Added enumeration for response parameter
adlType
. For more information, please refer to the product documentation. Introduction to Auto-deleveraging (ADL).
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
- Added new response parameters
Parameter | Type | Description |
---|---|---|
enableSpotBorrow | Boolean | Whether borrow is allowed or not in Spot mode true : Enabledfalse : Disabled |
spotBorrowAutoRepay | Boolean | Whether auto-repay is allowed or not in Spot mode true : Enabledfalse : Disabled |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
ccy | String | Currency |
- Add response parameters
Parameter | Type | Description |
---|---|---|
disCcyEq | String | Discount equity in currency for quick calculation if your equity is themaxAmt |
- Add request parameters
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 |
- Add new error codes
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}]. |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
isTradeBorrowMode | String | Whether borrowing currency automatically true false Only applicable to trigger order , trailing order and twap order |
- Transaction details (last 2 years) endpoints below was delisted
2024-09-18
- Added new endpoints:
2024-09-13
- Added new error codes
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. |
- Added new response parameter for rfq public-trades endpoint to get the name of the strategy.
Response Parameters
Parameter | Type | Description |
---|---|---|
strategy | String | Option strategy, e.g. CALL_CALENDAR_SPREAD |
2024-08-29
- Trade fee endpoint adds ruleType request and response parameters to distinguish trade fee rates of different trade rule types.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
ruleType | String | Yes | Trading rule typesnormal : normal tradingpre_market : pre-market tradingruleType can not be passed through together with instId/instFamily/uly |
Response Parameters
Parameter | Type | Description |
---|---|---|
ruleType | String | Trading rule typesnormal : normal tradingpre_market : pre-market trading |
- Added new response parameter for get open interest endpoint.
Response Parameters
Parameter | Type | Description |
---|---|---|
oiUsd | String | Open interest (USD) |
2024-08-28
- Added response parameters:
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 |
- Added new endpoint
2024-08-22
- Nitro spread private trade endpoints added a new response parameter szCont, presenting the filled contract amount of a single leg.
Parameter | Type | Description |
---|---|---|
legs | Array of objects | Legs of trade |
> szCont | String | Filled amount of the contract Only applicable to contracts, return "" for spot |
- To better use experience, regarding the endpoints/channels related to the account, information on crypto with a balance less than 1e-8 has been included in "details"
2024-08-21
Added call auction details endpoint
Added new error codes
Error Code | HTTP Status Code | Error Message |
---|---|---|
51505 | 200 | {instId} is not in call auction |
- Added new order book channel for Nitro Spread
sprd-books-l2-tbt
. 400 depth levels will be pushed in the initial full snapshot. Incremental data will be pushed every 10 ms for the changes in the order book during that period of time. When subscribing to this channel, the following parameters are added to the push data: action, checksum, prevSeqId, and seqId
Parameter | Type | Description |
---|---|---|
action | String | Push data action, incremental data or full snapshot.snapshot : fullupdate : 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.
As the feature is deployed in phases, you can find out the discount rule type of the current account by response parameter
discountType
from Get account configuration:- When
discountType
is 0, it represents that you are under the original discount rate rules, which are related to Array discountInfo from Get discount rate and interest-free quota; - When
discountType
is 1, it represents that you are under the new discount rate rules, which are related to Array details from Get discount rate and interest-free quota;
- When
Add new response parameter. After new discount rate rules are effective completely, this parameter will be removed from the endpoint. Advice you to prepare in advance.
Parameter | Type | Description |
---|---|---|
discountType | String | Discount rule type for current account0 : Original discount rate rules, the default value1 : New discount rules |
- Get discount rate and interest-free quota parameter adjustments.
- Besides the responses of the original discount details (Array discountInfo), New discount details (Array details) will be added;
discountLv
will be , advise you don't use it anymore;- After new discount rate rules are effective completely, the original discount details (Array discountInfo) will be removed from the endpoint. Advice you to prepare in advance.
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
- Bills details (since 2021) endpoints below have been released in production
Added request fields
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 priceindex : index pricemark : 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 typelast : last priceindex : index pricemark : mark priceThe 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 typelast : last priceindex : index pricemark : 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 Typeexchange : Withdraw to exchange walletprivate : Withdraw to private walletIf 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.
- Users under the Bahamas entity need to pass in the following field information of the recipient (rcvrFirstName, rcvrLastName, rcvrCountry, rcvrCountrySubDivision, rcvrTownName, rcvrStreetName). 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. The examples are as follows:
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
- Add posSide response parameter in the historical positions endpoint, indicating the position mode side.
Parameter | Type | Description |
---|---|---|
posSide | String | Position mode sidelong : Hedge mode longshort : Hedge mode shortnet : Net mode |
- Added new endpoint
2024-07-23
- Added ruleType response parameter for instrument endpoints, indicating the trading rule types.
Parameter | Type | Description |
---|---|---|
ruleType | String | Trading rule typesnormal : normal tradingpre_market : pre-market trading |
- Added new error codes
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
- Added subscription restriction for order book channel. After the adjustment, within the same connection, users will not be able to simultaneously subscribe to
books-l2-tbt
andbooks50-l2-tbt/books
channels for the same trading symbol.
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" } |
- Added new error code
Error code | Error Message |
---|---|
64004 | Subscribe to both {channelName} and books-l2-tbt for {instId} is not allowed. Unsubscribe books-l2-tbt first. |
- Added new request parameter instId for bills endpoints
Parameter | Type | Required | Description |
---|---|---|---|
instId | String | No | Instrument ID |
- Added new error code
Error code | Error Message |
---|---|
64004 | Subscribe to both {channelName} and books-l2-tbt for {instId} is not allowed. Unsubscribe books-l2-tbt first. |
Added new error code. For batch placement and batch amendation under portfolio margin mode, the order will get the error 54004 if its failure caused by another order's failure.
Error code | Error Message |
---|---|
54004 | Order placement or modification failed because one of the orders in the batch failed. |
- Added new request parameters:
Parameter | Type | Required | Description |
---|---|---|---|
profitSharingRatio | String | No | Profit sharing ratio, it only supports these values0 ,0.1 ,0.2 ,0.3 0.1 represents 10% |
2024-07-04
2024-07-03
- Added enumeration for parameter
Parameter | Type | Description |
---|---|---|
state | String | Algo order statepause |
- SPOT and MARGIN Supported TP/SL modification
2024-06-26
Added new endpoints
Add new response parameters
Parameter | Type | Description |
---|---|---|
lendQuota | String | Lending quota |
2024-06-25
- Added a new endpoint for spread trading cancel all after
2024-06-20
- Added new response parameter acct, indicating which account the fund is.
Parameter | Type | Description |
---|---|---|
acct | String | 6 : Funding account 18 : Trading account |
2024-06-19
- Add tag request and response parameters to support order tag level CAA.
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. |
- Add error code 51071
Error code | HTTP Status Code | Error Message |
---|---|---|
51071 | 200 | You've reached the maximum limit for tag level cancel all after timers. |
- Fix the data push sequence for different order book channels within the same connection and trading symbol. After the adjustment, the push sequence for order book channels within the same connection and trading symbol will be fixed as follows: bbo-tbt -> books-l2-tbt -> books50-l2-tbt -> books -> books5.
Only whitelist users can use the copy trading function. The lead trading function won't be affected.
Data from the endpoints below will be delayed 5 minutes
The sensitive parameters on endpoints below will be "" when lead traders enable lead trading protection
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
- Added new endpoints
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:
- Add a new endpoint Set risk offset amount
- Add new response parameters clSpotInUseAmt/maxSpotInUseAmt, representing user-defined spot risk offset amount and max possible spot risk offset amount respectively. The spotInUseAmt will represent the actual spot risk offset amount.
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 |
- Add new enumeration value for request and response parameters
Parameter | Type | Required | Description |
---|---|---|---|
type | String | Yes | Risk offset type4 : Spot-derivatives (USDC) risk offset |
- Add new error codes
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
Added new endpoints
Added new enumeration value
Parameter | Type | Description |
---|---|---|
subType | String | 293 : Fixed loan interest deduction294 : Fixed loan interest refund295 : Fixed loan overdue penalty |
2024-05-30
- Added new module Simple earn fixed
- Added new enumeration value
Parameter | Type | Description |
---|---|---|
type | String | 304 : Simple Earn Fixed order submission305 : Simple Earn Fixed order redemption306 : Simple Earn Fixed principal distribution307 : Simple Earn Fixed interest distribution (early termination compensation)308 : Simple Earn Fixed interest distribution309 : Simple Earn Fixed interest distribution (extension compensation) |
2024-05-15
- Added new response parameters:
Response parameter
Parameter | Type | Description |
---|---|---|
maxCopyTraderNum | String | Maximum number of copy traders |
copyTraderNum | String | Current number of copy traders |
2024-05-10
- Added new endpoints for spread trading market data
2024-05-09
- Add new push data parameters for spread tickers channel.
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
Added new endpoint
New enumeration value for sprdType field
Parameter | Type | Description |
---|---|---|
> sprdType | String | spread Type: hybrid |
- Added new endpoint
2024-05-06
- Added response parameters
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
- Commission detail download optimization
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
Added new endpoint
Added new endpoints
Added new response parameters
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 "" |
Added new response parameter ts.
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
- Added new response parameters
Parameter | Type | Description |
---|---|---|
redeemPeriod | Array of string | Redemption Period, format in [min time,max time]H : Hour, D : Daye.g. ["1H","24H"] represents redemption period is between 1 Hour and 24 Hours. ["14D","14D"] represents redemption period is 14 days. |
- The moon grid has been offline
2024-04-11
In order to improve system performance and optimize user experience, OKX decides to reduce some fields in the position risk warning channel. After the change, the corresponding fields will return "" or [], and after a period of time, it will be completely offline. Users can access the same fields using the positions channel.
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 |
- Added new response parameter acctStpMode
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
For better trading experience, the exchange exempts new and amendment request count of fiat trading symbols but still keep the trading volume when calculating rate limit
Add new request and response parameter subType for transaction details endpoints.
Request parameter
Parameter | Type | Required | Description |
---|---|---|---|
subType | String | No | Transaction type 1 : Buy2 : Sell3 : Open long4 : Open short5 : Close long6 : Close short 100 : Partial liquidation close long101 : Partial liquidation close short102 : Partial liquidation buy103 : Partial liquidation sell104 : Liquidation long105 : Liquidation short106 : Liquidation buy 107 : Liquidation sell 110 : Liquidation transfer in111 : Liquidation transfer out 118 : System token conversion transfer in119 : System token conversion transfer out 125 : ADL close long126 : ADL close short127 : ADL buy128 : ADL sell 212 : Auto borrow of quick margin213 : Auto repay of quick margin 204 : block trade buy205 : block trade sell206 : block trade open long207 : block trade open short208 : block trade close open209 : block trade close short 270 : Spread trading buy271 : Spread trading sell272 : Spread trading open long273 : Spread trading open short274 : Spread trading close long275 : Spread trading close short |
Response parameter
Parameter | Type | Description |
---|---|---|
subType | String | Transaction type |
2024-04-02
- Added new endpoint, Cancel All after for block trading quotes
2024-03-27
Decommissioned the order lite book endpoint
GET /api/v5/market/books-lite
.Exempted SPOT/MARGIN orders from the sub-account rate limit.
2024-03-19
- Released new feature connection count limit per private WebSocket channel
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:
- Orders channel
- Account channel
- Positions channel
- Balance and positions channel
- Position risk warning channel
- 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
Released new feature mandatory self trade prevention at 10:00 (UTC) on March 14
- Deprecated the
stpId
field in the Place order(Batch place orders) REST endpoint and WebSocket channel. - For order book trading, the default
stpMode
is Cancel Maker. Users can utilize thestpMode
request parameter of Place order(Batch place orders) REST endpoint and WebSocket channel to determine thestpMode
for new orders of certain order types. - For spread trading, Cancel maker is supported by default and only.
- For orders that are canceled due to self trade prevention, users can query the records of
cancelSource = 32
in the historical orders endpoint. The order channel will also push relevant information. - For block trading, the RFQ will face creation failure if all makers are under the same master account of the taker, and the taker will receive error code "56004". Otherwise, the RFQ will be created but not be received by makers that are under the same master account of the taker.
- Deprecated the
Added new enumeration values for cancelSource field
Parameter | Type | Description |
---|---|---|
> cancelSource | String | 38 : You have canceled market maker protection (MMP) orders39 : Your order was canceled because market maker protection (MMP) was triggered |
- New enumeration value for withdrawal
state
Parameter | Type | Description |
---|---|---|
state | String | 15 : Pending transaction validation16 : Due to local laws and regulations, your withdrawal may take up to 24 hours to arrive |
- Added new response parameters and numerations
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 "" |
- OKX restricted the use of the copy trading notification channel. Only the clients who are on the whitelist can get updates.
2024-03-12
Released new feature
Added new error code
Error Code | HTTP Status Code | Error Message |
---|---|---|
50061 | 200 | You've reached the maximum order rate limit for this account. |
2024-03-06
- Added new request parameters:
Parameter | Type | Required | Description |
---|---|---|---|
tpRatio | String | No | Take profit ratio, 0.1 represents 10% |
slRatio | String | No | Stop loss ratio, 0.1 represents 10% |
- Added new response parameters and numerations
Parameter | Type | Description |
---|---|---|
tpRatio | String | Take profit ratio, 0.1 represents 10% |
slRatio | String | Stop loss ratio, 0.1 represents 10% |
- Added new error codes
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.
- Added new request parameter:
Parameter | Type | Required | Description |
---|---|---|---|
> tpOrdKind | String | No | TP order kindcondition limit The default is condition |
- Added new request parameters:
Parameter | Type | Required | Description |
---|---|---|---|
> newTpOrdKind | String | No | TP order kindcondition limit |
- Added new response parameters and numerations
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 kindcondition limit |
> linkedAlgoOrd | Object | Linked SL order detail, only applicable to TP limit order of one-cancels-the-other order(oco) |
>> algoId | Object | Algo ID |
- Added new response parameters
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 |
- Added new error codes
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. |
Newly added endpoints
Newly added endpoints
Added a new endpoint to retrieve the full order book.
Added new fields for the trial fund balance
Parameters | Types | Description |
---|---|---|
> details | Array | Detailed asset information in all currencies |
rewardBal | String | Trial fund balance |
- Add new response parameter for premium
Parameters | Types | Description |
---|---|---|
premium | String | Premium between the mid price of perps market and the index price |
- Added new enumeration values of bill type and subtype for structured products
Parameters | Types | Description |
---|---|---|
type | String | Bill type26 : Structured products |
subtype | String | Bill subtype296 : From structured order placements297 : To structured order placements298 : From structured settlements299 : To structured settlements |
- Isolated margin trading settings parameter
isoMode
deprecatedquick_margin
2024-02-07
- Newly added endpoint, which returns rate limit and fill ratio related data. For more details, please refer to Fill ratio based sub-account rate limit.
2024-02-06
- Newly added endpoints
2024-02-01
- Add new response parameters
Parameter | Type | Description |
---|---|---|
verifiedName | String | Verified name (for recipient) |
2024-01-31
- Add newly endpoints for signal bot trading
- Improve the updateInterval request parameter
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\" } " |
- Deleted
isoMode
enum (autonomy
: Manual transfers) in Isolated margin trading settings
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.
- Added a new function module Savings, the relevant endpoints of the savings are adjusted as follows
- Get saving balance adjusted endpoint path from
/api/v5/asset/saving-balance
to/api/v5/finance/savings/balance
- Savings purchase/redemption adjusted endpoint path from
/api/v5/asset/purchase_redempt
to/api/v5/finance/savings/purchase-redempt
- Set lending rate adjusted endpoint path from
/api/v5/asset/set-lending-rate
to/api/v5/finance/savings/set-lending-rate
- Get lending history adjusted endpoint path from
/api/v5/asset/lending-history
to/api/v5/finance/savings/lending-history
- Get public borrow info (public) adjusted endpoint path from
/api/v5/asset/lending-rate-summary
to/api/v5/finance/savings/lending-rate-summary
- Get public borrow history (public) adjusted endpoint path from
/api/v5/asset/lending-rate-history
to/api/v5/finance/savings/lending-rate-history
- Get saving balance adjusted endpoint path from
2024-01-18
- Add new response parameters
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
Added new endpoints and channel
- Apply for lead trading
- Stop lead trading
- Amend profit sharing ratio
- Lead trader ranks (private)
- Lead trader weekly pnl (private)
- Lead trader daily pnl (private)
- Lead trader stats (private)
- Lead trader currency preferences (private)
- Lead trader current lead positions (private)
- Lead trader lead position history (private)
- Copy traders (private)
- Copy traders
- Account configuration
- Total unrealized profit sharing
- Lead trading notification channel
Added new response parameters:
Response parameter
Parameter | Type | Description |
---|---|---|
portLink | String | Portrait link |
- Added new error codes
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 |
- Bills related endpoints, Get bills details (last 7 days), Get bills details (last 3 months)
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 |
- Bills related endpoints, Get bills details (last 7 days), Get bills details (last 3 months)
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 |
- Bills related endpoints, Get bills details (last 7 days), Get bills details (last 3 months)
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
- Add new response parameters
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
- Updated the error messages for the error code below
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} |
- New enumeration value for cancelSource field
Parameter | Type | Description |
---|---|---|
> cancelSource | String | 15 : Order canceled: The order price is beyond the limit |
- Added historical ADL records into get insurance fund endpoint. Added new enumeration value
adl
for request parameter type; added new response parameters instType, maxBal, maxBalTs, decRate, adlType.
Request Parameters
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Typeadl : 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
- Newly added endpoints. Spread trading supports querying historical orders in the past three months.
2024-01-04
- Added request parameters
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. |
- Added new response parameter:
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. |
- Added new error codes
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.
- Added a new function module Savings, the relevant endpoints of the savings are adjusted as follows
- Get saving balance adjusted endpoint path from
/api/v5/asset/saving-balance
to/api/v5/finance/savings/balance
- Savings purchase/redemption adjusted endpoint path from
/api/v5/asset/purchase_redempt
to/api/v5/finance/savings/purchase-redempt
- Set lending rate adjusted endpoint path from
/api/v5/asset/set-lending-rate
to/api/v5/finance/savings/set-lending-rate
- Get lending history adjusted endpoint path from
/api/v5/asset/lending-history
to/api/v5/finance/savings/lending-history
- Get public borrow info (public) adjusted endpoint path from
/api/v5/asset/lending-rate-summary
to/api/v5/finance/savings/lending-rate-summary
- Get public borrow history (public) adjusted endpoint path from
/api/v5/asset/lending-rate-history
to/api/v5/finance/savings/lending-rate-history
- Get saving balance adjusted endpoint path from
2023-12-20
Set one year time range limit for response results
Added new response parameter or push data parameter
enabled
to indicate whether the price limit is in force
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 |
- Add new response parameter
method
to distinguish the difference of current period's mechanism and cross-period mechanism
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
- Added new endpoints to set and get MMP config in block trading
2023-12-11
- The cancel all after endpoint is now applicable to all users and all trading symbols through order book (except Spread trading)
2023-12-07
- Added new response parameter:
Parameter | Type | Description |
---|---|---|
lastRebate | String | Account monthly rebate amount. Only applicable to VIP4 and VIP5 |
2023-12-06
The
tag
for block and spread transactions in the below endpoints returns the inputtag
value for block and spread orders. Return "" if not populated.Added new request parameters:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | No | Order typemarket :Market order, the default valuelimit :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. |
Added new request parameters:
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 |
- Added new response parameter:
Parameter | Type | Description |
---|---|---|
availSubPos | String | Quantity of positions that can be closed |
Added new response parameters:
Parameter | Type | Description |
---|---|---|
closeSubPos | String | Quantity of positions that is already closed |
type | String | The type of closing position1 :Close position partially;2 :Close all |
2023-12-05
- Newly added endpoints
2023-12-04
- Adjusted response fields in Status and Status channel
Added enumeration value10
: Spread trading and11
: Copy trading forserviceType
field.
2023-11-30
Added new endpoints and channel
- First copy settings
- Amend copy settings
- Stop copying
- Copy settings
- Multiple leverages
- Set Multiple leverages
- My lead traders
- My history lead traders
- Lead trader ranks
- Lead trader weekly pnl
- Lead trader daily pnl
- Lead trader stats
- Lead trader currency preferences
- Lead trader current lead positions
- Lead trader lead position history
- Copy trading configuration
- Copy trading notification channel
Added new request parameters and response parameters:
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 valuecopy : 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 |
- Added new request parameter and response parameters:
Parameter | Type | Required | Description |
---|---|---|---|
subPosType | String | No | Data type.lead : lead trading, the default valuecopy : 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 |
- Added new request parameter
Parameter | Type | Required | Description |
---|---|---|---|
subPosType | String | No | Data type.lead : lead trading, the default valuecopy : copy trading |
- Added new error codes
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
- Added new channel
- Added new enumeration value for type field
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 "".
- Add new response parameters
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
- Add enumeration value for alias field
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:
- Weekly (this_week): November 24, 2023
- Bi-weekly (next_week): December 1, 2023
- 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.
- Bi-monthly (next_month): January 26, 2024. Newly listed contract.
- 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.
- 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.
- Added new endpoints
2023-11-15
Added a new function module Affiliate
Added enumeration for parameter
Parameter | Type | Description |
---|---|---|
period | String | Periodhourly |
- Added new parameters
Parameter | Type | Description |
---|---|---|
recurringHour | String | Recurring buy by hourly1 /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
- Added new response parameters
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 |
- Added new error code
Error Code | HTTP Status Code | Error Message |
---|---|---|
51185 | 200 | The maximum value allowed per order is {maxOrderValue} USD |
2023-11-10
- Added enumeration for request parameter:
Parameter | Type | Required | Description |
---|---|---|---|
tdMode | String | No | Trade modespot_isolated (only applicable to SPOT lead trading) |
- Added new response parameters
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 |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
> spotIsoBal | String | SPOT isolated balance. only applicable to copy trading |
- Added enumeration value
Parameter | Type | Required | Description |
---|---|---|---|
subType | String | No | Bill subtype280 : SPOT profit sharing expenses; 281 : SPOT profit sharing refund |
- Added new request parameter and response parameter:
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
instType | String | No | Instrument typeSPOT SWAP |
Response parameters
Parameter | Type | Description |
---|---|---|
instType | String | Instrument type |
- Added new error codes
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
Added a new function module ETH Staking
Migrated block trade public transactions old endpoint into a new one and added new response parameters. The request URL of new endpoint is "GET /api/v5/public/block-trades" and the old one will be offline in later November. New response parameters in new endpoint:
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 |
- Added new push data parameters
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.
- Add new request 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 typelast : last price index : index price mark : mark price The Default is last |
> slTriggerPxType | String | No | Stop-loss trigger price typelast : 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 triggered0 : disable, the default value 1 : Enable |
- Add new request parameters:
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 typelast : last price index : index price mark : mark priceOnly applicable to FUTURES /SWAP If you want to add the take-profit, this parameter is required |
> newSlTriggerPxType | String | Conditional | Stop-loss trigger price typelast : last price index : index price mark : mark priceOnly 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 |
- Add new response parameters
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 priceindex : index pricemark : mark price |
> tpOrdPx | String | Take-profit order price. |
> slTriggerPx | String | Stop-loss trigger price. |
> slTriggerPxType | String | Stop-loss trigger price type. last : last priceindex : index pricemark : 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 |
- Add new response parameters
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 |
- Add new error codes
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
- Added new enum value for request parameter ordType
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | No | ioc : Immediate-or-cancel order |
- Added new enum value for response parameter ordType
Parameter | Type | Description |
---|---|---|
ordType | String | ioc : Immediate-or-cancel order |
- Added new enum value for response parameter cancelSource
Parameter | Type | Description |
---|---|---|
cancelSource | String | 14 : Order canceled: IOC order was partially canceled due to incompletely filled. |
2023-11-02
- Added new parameters
Parameters | Type | Description |
---|---|---|
clTReqId | String | Client Order ID as assigned by the client |
2023-11-01
- Added new response parameter and push data parameter
Parameters | Type | Description |
---|---|---|
flowType | String | Identify the type of the RFQ. Only applicable to Makers, return "" for Takers |
- Added new response parameters
Parameters | Type | Description |
---|---|---|
> enable | Boolean | Sub-account statustrue : normalfalse : frozen |
> frozenFunc | Array of string | Frozen functionstrading 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 |
- Added new response parameters
Parameters | Type | Description |
---|---|---|
frozenFunc | Array of string | Frozen functionstrading convert transfer withdrawal deposit flexible_loan |
- Added connId field for WebSocket event response message to help users target a specific WebSocket connection
Parameter | Type | Required | Description |
---|---|---|---|
connId | String | Yes | WebSocket connection ID |
2023-10-31
- Added a new WebSocket channel for spread trading amend order. This endpoint is now only applicable to whitelisted users.
2023-10-27
- Fee rates endpoint adjustment
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 |
- Adjusted request parameters
Before:
Parameter | Type | Required | Description |
---|---|---|---|
quoteCcyType | String | No | Quote currency type2 : USDT/USDⓈ/Crypto3 : USDCApplicated to SPOT When specifying this parameter, instType is required. |
After:
Parameter | Type | Required | Description |
---|---|---|---|
quoteCcyType | String | No | Quote currency type2 : USDT3 : USDⓈ/CryptoApplicated to SPOT When specifying this parameter, instType is required. |
2023-10-24
- Added a new endpoint for spread trading amend order. This endpoint is now only applicable to whitelisted users.
2023-10-19
- Added a new function [Download the transaction details in the past 2 years]
2023-10-18
Trades channel adjustment, aggregate trades per taker order, per filled price
Added a new function module Signal bot trading
Added response parameters
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 |
Added new endpoint
Added request parameters
Parameter | Type | Required | Description |
---|---|---|---|
clientIP | String | No | Sub-account register IP Please use ND server IP for non personal accounts |
- Added enumeration value for cancelSource field
Parameter | Type | Description |
---|---|---|
> cancelSource | String | 33 : The order exceeds the maximum number of order matches per taker order |
- Added new error code
Error Code | HTTP Status Code | Error Message |
---|---|---|
51088 | 200 | You can only place 1 TP/SL order to close an entire position |
Added response parameter
Parameter | Type | Description |
---|---|---|
bePx | String | Breakeven price |
2023-09-29
- Added new request parameters
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
- Adjusted trading restriction
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:
- The limit orders will only be executed with a portion corresponding to 1000 maker orders and the remainder will be canceled.
- Fill or Kill (FOK) orders will be canceled directly.
2023-09-27
- Adjust parameter
Before:
Parameter | Type | Description |
---|---|---|
> amendResult | String | The result of amending the order-1 : failure0 : success1 : 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 : failure0 : success1 : 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
Added response parameters, the new fields will be applicable to both success and failure responses of those endpoints below
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 |
- Added response parameters
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 |
- Added push data parameter
Parameter | Type | Description |
---|---|---|
data | Array | Subscribed data |
> trades | Array | Details of trade |
>> instId | String | Instrument ID, e.g. BTC-USDT |
>> tradeId | String | Trade ID |
- Added new parameters for
trigger order
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 typelast : last priceindex : index pricemark : mark priceThe 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 typelast : last priceindex : index pricemark : mark priceThe 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. |
- Added new parameters for
trailing stop order
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. |
- Added new enum value
Parameter | Type | Description |
---|---|---|
source | String | Order source6 : 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 |
- Added new error codes
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
Add request and response parameters
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. |
- Add request parameters
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. |
- Add restriction of the last 3 months
2023-09-08
For placing orders endpoints:
- Adjust and add request parameters
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:
- Adjust and add request parameters
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:
- The limit orders will only be executed with a portion corresponding to 256 maker orders and the remainder will be canceled.
- 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:
- cancelSource = "33"
- cancelSourceReason = "The taker order was canceled because it exceeded the maximum number of maker orders matched"
2023-08-30
For order details, list and history endpoints:
- Adjusted and added request parameters
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 USD Only 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) |
- Add new enumeration value for
amendSource
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:
- Added response parameters
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 |
Added response parameters
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. |
- Added response parameters
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. |
- Adjusted the request parameter.
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. |
- New WebSocket channel
2023-08-23
- Added new parameters
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
Added new endpoints
Added new response parameters
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 Typeexchange :Withdraw to exchange walletprivate :Withdraw to private walletIf you withdraw to exchange wallet, exchId &rcvrFirstName &rcvrLastName is requiredIf 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 |
- Added new error codes
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
- Added new response parameters
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. |
- Adjusted response parameters:
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. |
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
px | String | No | The available amount corresponds to price of close position. Only applicable to reduceOnly MARGIN . |
Adjusted response parameter description
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 update
- Stop using error codes 51401, 51402, 51509 and 51510
- Consolidate error codes 51401 and 51402 into 51400, 51509 and 51510 into 51503
- The updated error messages of 51400 and 51503 are shown below.
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. |
- Added description about 1s candlestick supported
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:
- Limit
- Market
- Post only
- Fill or Kill (FOK)
- Immediate or Cancel (IOC)
- Market order with Immediate-or-Cancel order (optimal limit IOC)
- Take Profit / Stop Loss (TP/SL)
- Limit and market orders triggered under the order types below:
- Take Profit / Stop Loss (TP/SL)
- Trigger
- Trailing stop
- Arbitrage
- Iceberg
- TWAP
- Recurring buy
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
Added new endpoints
Added new response parameters
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
- Adjusted response fields
Before
Parameter | Type | Description |
---|---|---|
type | String | The reason that Broker cannot get broker rebate2 : The user level is equal to or more than VIP3 |
After
Parameter | Type | Description |
---|---|---|
type | String | The reason that Broker cannot get broker rebate2 : The trading fee level is VIP4/5 and the monthly commission amount has reached the upper limit3 : The trading fee level is greater than or equal to VIP6 |
clientRebateRatio | String | Commission rebate ratio for client |
2023-07-20
- Added new response fields
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 |
- Added new response fields for decompressed CSV file
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 |
- Added new response fields for decompressed CSV file
Parameter | Description |
---|---|
rebateCat | Rebate categoryspot 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
- Added new response fields
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 type0 : Normal order1 : Copy order without profit sharing2 : Copy order with profit sharing3 : Lead order |
- Added new response fields
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 |
- Added new response fields
Parameter | Type | Description |
---|---|---|
volLv | String | Implied volatility of at-the-money options |
- Added new endpoint
Added new enumeration value for
ordType
- Related endpoints about request parameter:
- Related endpoints about response parameter:
- Related endpoints about request parameter:
Parameter | Type | Description |
---|---|---|
ordType | String | mmp_and_post_only :Market Maker Protection and Post-only order(only applicable to Option in Portfolio Margin mode) |
- Added new endpoints
2023-07-17
- Added new response fields
Parameter | Type | Description |
---|---|---|
uid | String | sub-account uid |
- Added new request fields
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
Added new enumeration value for
ordType
- Related endpoints about request parameter:
- Related endpoints about response parameter:
- Related endpoints about request parameter:
Parameter | Type | Description |
---|---|---|
ordType | String | mmp_and_post_only :Market Maker Protection and Post-only order(only applicable to Option in Portfolio Margin mode) |
- Added new endpoints
2023-07-05
- Added enumeration value
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Bill type24 : Spread trading |
subType | String | No | Bill subtype270 : 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 |
- Added new response fields
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 |
- Added new push data parameters
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 |
- Added new request fields
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\" } " |
Added new endpoints
Order channel supported the update of the delivery orders(category=delivery).
Changed the request permission of Position builder from "Trade" to "Read"
2023-06-28
Added new enumeration value for
ordType
- Related endpoints about request parameter:
- Related endpoints about response parameter:
- Related endpoints about request parameter:
Parameter | Type | Description |
---|---|---|
ordType | String | mmp :Market Maker Protection (only applicable to Option in Portfolio Margin mode) |
Added new enumeration value for
state
- Related endpoints about request parameter:
- Related endpoints about response parameter:
- Related endpoints about request parameter:
Parameter | Type | Description |
---|---|---|
state | String | mmp_canceled :Order canceled automatically due to Market Maker Protection |
- Added new endpoints
2023-06-27
- Added new response parameters
Parameter | Type | Description |
---|---|---|
minFeeForCtAddr | String | Minimum withdrawal fee for contract address |
maxFeeForCtAddr | String | Maximum withdrawal fee for contract address |
2022-06-26
- Added API doc for Spread Orderbook. Currently only available for whitelisted users in demo trading environment
- Added new error codes
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
- Added new response parameters in Order book channel:
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 |
- The request parameter has been updated as follows:
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. |
- The request parameter has been updated as follows:
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. |
- The request parameter has been updated as follows:
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. |
- Added new response parameters:
Parameter | Type | Required | Description |
---|---|---|---|
uid | String | No | Sub-account uid |
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
attachAlgoClOrdId | String | No | Client-supplied Algo ID when placing order attaching TP/SL. |
- Added new response parameters to support self trade prevention:
Parameter | Type | Description |
---|---|---|
attachAlgoClOrdId | String | Client-supplied Algo ID when placing order attaching TP/SL. |
- Added new parameters
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
- Added a new endpoint
2023-06-15
- Planned system maintenance that may result in short interruption (lasting less than 5 seconds) or websocket disconnection (users can immediately reconnect) will not be announced. The maintenance will only be performed during times of low market volatility.
2023-06-07
- Added new request parameters to support self trade prevention:
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. |
- Added new response parameters to support self trade prevention:
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 |
- The adjustment of response parameters was launched in production environment.
Before:
Parameter | Type | Description |
---|---|---|
indexPx | String | Index price while trading |
After:
Parameter | Type | Description |
---|---|---|
idxPx | String | Index price while trading |
- Added new response parameters
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. |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
idxPx | String | Latest underlying index price |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
kycLv | String | Main account KYC level0 : 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
- Added new endpoint
2023-06-02
- The adjustment of response parameters will be launched in production environment on June 7, 2023.
Before:
Parameter | Type | Description |
---|---|---|
indexPx | String | Index price while trading |
After:
Parameter | Type | Description |
---|---|---|
idxPx | String | Index price while trading |
2023-05-29
- Additional enumeration value
pending_fill
will be added to response parameterstate
of Quotes Websocket channel on June 1, 2023
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
- Added new response parameters
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 |
- Added new response parameters:
Parameter | Type | Description |
---|---|---|
tag | String | Order tag |
algoClOrdId | String | Client-supplied Algo ID |
- Added new response parameters:
- Instant trigger grid algo order
- Get grid algo order list
- Get grid algo order history
- Get grid algo order details
- Get grid algo sub orders
- Get grid algo order positions
- Spot/Moon grid withdraw income
- Adjust margin balance
- Spot grid algo orders channel
- Contract grid algo orders channel
- Moon grid algo orders channel
- Grid positions channel
- Grid sub orders channel
Parameter | Type | Description |
---|---|---|
algoClOrdId | String | Client-supplied Algo ID |
2023-05-10
- Added new response parameters:
Parameter | Type | Description |
---|---|---|
> uid | String | Sub-account user ID |
2023-04-27
- Added new request parameters:
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 typelast : last price index : index price mark : mark price |
newSlTriggerPxType | String | Conditional | Stop-loss trigger price typelast : last price index : index price mark : mark price |
- Added a new endpoint: Amend algo order
- Added new response parameters:
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. |
- Added new request parameters:
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. |
- Added new response parameters:
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
- The request parameters made some changes as follows:
Before:
Parameter | Type | Required | Description |
---|---|---|---|
mgnType | String | No | Margin type1 : USDT-margined 2 : crypto-marginedApplicated to FUTURES/SWAP |
After:
Parameter | Type | Required | Description |
---|---|---|---|
quoteCcyType | String | No | Quote currency type2 : USDT/USDⓈ/Crypto3 : USDCApplicated to SPOT When specifying this parameter, instType is required. |
mgnType | String | No | Margin type1 : USDT-margined 2 : crypto-margined3 : USDC-marginedApplicated to FUTURES/SWAP When specifying this parameter, instType is required. |
Added new endpoint:
The response parameters made some changes as follows:
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 |
Adjusted parameters
- The endpoints:
- Get positions history
- Get positions
- Positions channel, Balance and position channel, Position risk warning channel
- Get positions history
- posId added one more attribute expiration, the posId and position information will be cleared if it is more than 30 days after the last close position.
- The endpoints:
Added response parameter
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
Below WebSocket channels are migrated to the new WebSocket URL
wss://ws.okx.com:8443/ws/v5/business
andwss://wsaws.okx.com:8443/ws/v5/business
. Those channels will no longer be supported by the existing websocket URL by the end of May 2023. More details can refer to: Changes to V5 API WebSocket subscription parameter and URL- Block trading channels
- Algo and strategy trading channels
- Candlesticks channels
Adjustment below to V5 API WebSocket subscription parameter uly. More details can also refer to: Changes to V5 API WebSocket subscription parameter and URL
- Currently, the websocket subscription parameter uly is mapped to the parameter instFamily. After the end of May 2023, the subscription parameter uly will be ignored and no longer be processed. Please replace uly with instFamily as soon as possible.
Websocket no longer supported multiple account batch login.
2023-04-10
- There were changes to V5 API, as OKX supports USDC index.
For details, please refer to Changes to V5 API users as OKX supports USDC index
2023-04-07
- Websocket will not support multiple account batch login from April 19, 2023.
2023-04-06
- Added new push data parameter
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 user2 : Order amended by user, but the order quantity is overriden by system due to reduce-only3 : New order placed by user, but the order quantity is overriden by system due to reduce-only4 : Order amended by system due to other pending orders |
2023-04-03
- OKX will no longer support users to retrieve platform historical liquidation orders through the REST endpoint by the end of April 2023. Please subscribe to the websocket channel below to receive real time data:
- Added new response parameters
- Status endpoint.
- Status channel
- Status endpoint.
Parameter | Type | Description |
---|---|---|
maintType | String | Maintenance type1 : Scheduled maintenance; 2 : Unscheduled maintenance; 3 : System disruption |
env | String | Environment.1 : Production Trading, 2 : Demo Trading |
2023-03-30
- The response parameters made some changes as follows:
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
Added a new function module Recurring buy
WebSocket API added new channels
2023-03-27
- The response parameters will make some changes as follows on March 30,2023:
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
- There will be changes to V5 API on April 10,2023, as OKX supports USDC index.
For details, please refer to Changes to V5 API users as OKX supports USDC index
2023-03-16
- Added new endpoint:
2023-03-15
- Added a new function module Savings, the relevant endpoints of the savings are adjusted as follows
- Get saving balance adjusted endpoint path from
/api/v5/asset/saving-balance
to/api/v5/finance/savings/balance
- Savings purchase/redemption adjusted endpoint path from
/api/v5/asset/purchase_redempt
to/api/v5/finance/savings/purchase-redempt
- Set lending rate adjusted endpoint path from
/api/v5/asset/set-lending-rate
to/api/v5/finance/savings/set-lending-rate
- Get lending history adjusted endpoint path from
/api/v5/asset/lending-history
to/api/v5/finance/savings/lending-history
- Get public borrow info (public) adjusted endpoint path from
/api/v5/asset/lending-rate-summary
to/api/v5/finance/savings/lending-rate-summary
- Get public borrow history (public) adjusted endpoint path from
/api/v5/asset/lending-rate-history
to/api/v5/finance/savings/lending-rate-history
- Get saving balance adjusted endpoint path from
2023-03-14
- Adjusted response parameter
wdQuota
,usedWdQuota
in Get currencies
- Withdrawal quota unit is adjusted from
BTC
toUSD
- Withdrawal quota unit is adjusted from
2023-03-01
- Added new response parameters
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 |
- The change of request and response parameters
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 |
- Added new response parameters
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 "". |
- Added new endpoint:
2023-02-20
- Adjusted push data parameter
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 system1 : Order canceled by user2 : Pre reduce-only order canceled, due to insufficient margin in user position3 : 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 system1 : Order canceled by user2 : Order canceled: Pre reduce-only order canceled, due to insufficient margin in user position3 : 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 triggered21 : Order canceled: The TP/SL order was canceled because the position had been closed22 , 23 : Order canceled: Reduce-only orders only allow reducing your current position. System has already canceled this order. |
2023-02-17
- Added new endpoint:
2022-02-15
- Added new error codes
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. |
- Added new response fields
Parameter | Type | Description |
---|---|---|
fillTime | String | Trade time which is the same as fillTime for the order channel. |
2023-02-08
- Added new response parameters
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 |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
> nonTradableAsset | String | Whether it is a non-tradable asset or nottrue : non-tradable asset, false : tradable asset |
> feeCcy | String | Withdrawal fee currency, e.g. USDT |
2023-02-07
- The websocket close frame status code will be updated with reason text.
The change can be ignored if client is not processing websocket close frame status code number.
The change will be effective in production environment from February 15, 2023.
2023-02-02
- Added new response parameters
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. |
- Added new endpoints
2023-02-01
- Added enumeration value to
type
of Asset bills details
Parameter | Type | Description |
---|---|---|
type | String | Bill type225 : Shark Fin subscribe226 : Shark Fin collection227 : Shark Fin profit228 : Shark Fin refund |
2023-01-30
- Added new request parameter
Request parameter
Parameter | Type | Required | Description |
---|---|---|---|
rfqId | String | No | RFQ ID. |
2023-01-19
- Added new channel:
2023-01-09
- Added new endpoint:
2022-12-30
- Added new request & response parameter
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
The Bar size of candlesticks have made some changes:
The change content: To better system performance, the endpoints and channels below do not support these bar sizes: 6M, 1Y, 6Mutc, 1Yutc.The push logic of “Instruments channel” has been changed:
The change content: To better system performance, the full instrument list is not pushed for the first time after the subscription on “Instruments channel”. Please get the full instrument list from Get instruments, and get updates from “Instruments channel”.Added new endpoint and channel:
2022-12-23
Added a new function module Fast API
Added new response parameters
Parameter | Type | Description |
---|---|---|
opAuth | String | Whether the option trading was activated0 not activate, 1 activated |
2022-12-20
Added new endpoint:
Added a new response parameter
Parameter | Type | Description |
---|---|---|
last | String | Last filled price while placing |
- Added new request parameters
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 |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
quickMgnType | String | Quick Margin type, Only applicable to Quick Margin Mode of isolated marginmanual , auto_borrow , auto_repay |
- Added new response parameters
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) |
- Adjust request parameters
Before:
Parameter | Type | Required | Description |
---|---|---|---|
type | String | Yes | add : add marginreduce : 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) |
- Added enumeration value
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) |
- Added enumeration value
Parameter | Type | Description |
---|---|---|
isoMode | String | quick_margin: Quick Margin Mode |
- Added enumeration value
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Bill type15 : Quick Margin |
subType | String | No | Bill subtype210 : Manual Borrowing 211 : Manual Repayment 212 : Auto borrow 213 : Auto repay 16 : Repay forcibly 17 : Repay interest by borrowing forcibly |
Added endpoints
Added new error codes
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
- Added new response parameter
Parameter | Type | Description |
---|---|---|
state | String | Product statepurchasable : Purchasablesold_out : Sold outStop : Suspension of subscription |
- Added new request & response parameter
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 |
- Added new response parameter
Parameter | Type | Description |
---|---|---|
tag | String | Order tag |
- Added new response parameter
Parameter | Type | Description |
---|---|---|
estSettlementTime | String | Estimated redemption settlement time |
cancelRedemptionDeadline | String | Deadline for cancellation of redemption application |
tag | String | Order tag |
- Added new error codes
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 |
- Added new response parameters
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 |
- Added enumeration value
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Bill type18 : Profit sharing |
subType | String | No | Bill subtype250 : Profit sharing expenses; 251 : Profit sharing refund; 252 : Profit sharing income; |
Added rate limit rules of leading contracts:
Added new endpoints:
Added new error codes
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
- Added new response parameters
Parameter | Type | Description |
---|---|---|
bizRefId | String | External business id, e.g. experience coupon id |
bizRefType | String | External business type |
- Added new response parameter
Parameter | Type | Description |
---|---|---|
cancelSource | String | Code of the cancellation source. |
cancelSourceReason | String | Reason for the cancellation. |
- The change of request and response parameters
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 |
- Added new response parameter
Parameter | Type | Description |
---|---|---|
> avgRate | String | Average interest of Already borrowed coin, only applicable to VIP loans |
- Added new endpoints:
2022-12-12
The Bar size of candlesticks will make some changes:
The change date of demo trading environment: December 15, 2022.
The change date of production environment: December 28, 2022.
The change content: To better system performance, the endpoints and channels below will not support these bar sizes: 6M, 1Y, 6Mutc, 1Yutc.
2022-12-09
- Added new endpoint
2022-12-08
- Added new response parameter
Parameter | Type | Description |
---|---|---|
depQuoteDailyLayer2 | String | Layer2 network daily deposit limit |
- Added new request & response parameter
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. |
- Added new request & response parameter
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. |
- Added new 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. |
- Added new 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. |
- Added new response parameter
Parameter | Type | Description |
---|---|---|
> tag | String | Trade tag. The block trade will have the tag of the RFQ or Quote it corresponds to. |
- Added new push data 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. |
- Added new push data 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. |
- Added new push data parameter
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
The push logic of “Instruments channel” will be changed:
The change date of demo trading environment: December 15, 2022.
The change date of production environment: December 28, 2022.
The change content: To better system performance, the full instrument list will not be pushed for the first time after the subscription on “Instruments channel”. Please get the full instrument list from Get instruments, and get updates from “Instruments channel”.Logic optimization of reduce-only orders launched.
- After launch, There may be conditions that the system modify order size and cancel reduce-only pending orders(Depending on the priority of orders, more detail can refer to the related product document)
- It is applicable for reduce-only orders coming from FUTURES and SWAP in buy/sell mode.
- You can check returned
sMsg
to get the prompt message if the system modifies order size after placement; - The
cancelSource
of orders channel will be 22 or 23 if the system cancels reduce-only pending orders.
- After launch, There may be conditions that the system modify order size and cancel reduce-only pending orders(Depending on the priority of orders, more detail can refer to the related product document)
2022-12-01
Logic optimization of reduce-only orders will be launched on December 5, 2022.
- After launch, There may be conditions that the system modify order size and cancel reduce-only pending orders(Depending on the priority of orders, more detail can refer to the related product document)
- It is applicable for reduce-only orders coming from FUTURES and SWAP in buy/sell mode.
- You can check returned
sMsg
to get the prompt message if the system modifies order size after placement; - The
cancelSource
of orders channel will be 22 or 23 if the system cancels reduce-only pending orders.
- After launch, There may be conditions that the system modify order size and cancel reduce-only pending orders(Depending on the priority of orders, more detail can refer to the related product document)
The response fields within Get instruments and Instruments channel have been adjusted in the production trading service.
The test trading pairs will be returned, and theirstate
will betest
.Adjusted response parameters:
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. |
Added new endpoint
Added new response parameter
Parameter | Type | Description |
---|---|---|
nonTradableAsset | Boolean | Whether it is a non-tradable asset or nottrue : non-tradable asset, false : tradable asset |
feeCcy | String | Withdrawal fee currency, e.g. USDT |
- Added new error codes
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
Added new endpoint
Added new response parameters
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. |
- Added enumeration value for
perm
field
Parameter | Type | Description |
---|---|---|
perm | String | API Key permissionswithdraw : Withdraw |
- New rate limit rules
- Place order
- Place multiple orders
- Amend order
- Amend multiple orders
- Cancel order
- Cancel multiple orders
- Place algo order
- Cancel algo order
- Cancel advance algo order
- Place grid algo order
- Amend grid algo order
- Stop grid algo order
- Close positions
- Get order details
- Websocket Place order
- Websocket Place multiple orders
- Websocket Amend order
- Websocket Amend multiple orders
- Websocket Cancel order
- Websocket Cancel multiple orders
Adjusted rate limit rule
Before:
- Derivatives rate limit rule: UserID + (instrumentType + underlying)
- Spot & Margin rate limit rule: UserID + (instrumentType + instrumentID)
After:
- Rate limit rule (except Options): UserID + Instrument ID
- Rate limit rule (Options only): UserID + Instrument Family
- Added a new request parameter and requirement of an existing parameter
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. |
- Added a new response parameter
Parameter | Type | Description |
---|---|---|
closeFraction | String | Fraction of position to be closed when the algo order is triggered. |
- Added new response parameters
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 priceindex :index pricemark :mark price |
>> tpTriggerPx | String | Take-profit trigger price. |
>> tpTriggerPxType | String | Take-profit trigger price type. last :last priceindex :index pricemark :mark price |
>> closeFraction | String | Fraction of position to be closed when the algo order is triggered. |
- Added new error codes
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 |
- Added new request parameters
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 |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
quickMgnType | String | Quick Margin type, Only applicable to Quick Margin Mode of isolated marginmanual , auto_borrow , auto_repay |
- Added new response parameters
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) |
- Adjust request parameters
Before:
Parameter | Type | Required | Description |
---|---|---|---|
type | String | Yes | add : add marginreduce : 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) |
- Added enumeration value
Parameter | Type | Description |
---|---|---|
mgnIsoMode | String | quick_margin: Quick Margin Mode |
- Added enumeration value
Parameter | Type | Description |
---|---|---|
mgnIsoMode | String | quick_margin: Quick Margin Mode |
- Added enumeration value
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Bill type15 : Quick Margin |
subType | String | No | Bill subtype210 : Manual Borrowing 211 : Manual Repayment 212 : Auto borrow 213 : Auto repay 16 : Repay forcibly 17 : Repay interest by borrowing forcibly |
Added endpoints
Added new error codes
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
- The change of request and response parameters
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 |
- Added new response parameter
Parameter | Type | Description |
---|---|---|
> avgRate | String | Average interest of Already borrowed coin, only applicable to VIP loans |
- Added new endpoints:
2022-11-28
- Added new response parameter
Parameter | Type | Description |
---|---|---|
confirm | String | The state of candlesticks.0 represents that it is uncompleted, 1 represents that it is completed. |
- Added new endpoint
2022-11-25
- Adjusted response fields in Status and Status channel
Added enumeration value8
: Trading service (in batches of accounts) and9
: Trading service (in batches of products) forserviceType
field.
2022-11-24
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
mgnType | String | No | Margin type1 : USDT-margined 2 : crypto-marginedApplicate to FUTURES/SWAP |
2022-11-21
- New response parameter will be added on November 28, 2022, at the earliest
Parameter | Type | Description |
---|---|---|
confirm | String | The state of candlesticks.0 represents that it is uncompleted, 1 represents that it is completed. |
- Added new request parameters
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 typelast : last price index : index price mark : mark price The Default is last |
slTriggerPxType | String | No | Stop-loss trigger price typelast : last price index : index price mark : mark price The Default is last |
2022-11-11
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
areaCode | String | Optional | Area code for phone number If toAddr is a phone number, this parameter is required. |
- Added new response parameters
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 |
- Added new response parameters
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
- Added new push data parameter
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 system1 : Order canceled by user2 : Pre reduce-only order canceled, due to insufficient margin in user position3 : 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 |
- Added new request and return parameters
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
- New response parameter was added
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
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
brokerType | String | Optional | Broker Typeapi : API Brokeroauth : Oauth BrokerWhen the broker has only one broker type, this parameter can be left blank This parameter is required when the broker has multiple broker types |
- Added new error codes
Error Code | HTTP Status Code | Error Message |
---|---|---|
50044 | 200 | Must select one broker type |
2022-11-01
- New response parameter will be added on November 8, 2022, at the earliest
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
- Added new request parameters
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 |
- Added new error codes
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
- Added new parameters
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 begin
and 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
The response fields within Get instruments and Instruments channel have been adjusted in the production trading service.
The preopen trading pairs will be returned, and theirstate
will bepreopen
.Added new return parameters:
Parameter | Type | Description |
---|---|---|
reduceOnly | String | Whether the order can only reduce the position size. Valid options: true or false. |
- Related candlesticks Channels changed the push frequency
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.
Adjusted response fields in Status and Status channel
Added enumeration value6
: Block trading forserviceType
field.Added new endpoint
2022-10-19
- The response fields within Get instruments and Instruments channel will be adjusted in the production trading service on October 20, 2022 at the earliest.
After adjustment, the preopen trading pairs will be returned, and theirstate
will bepreopen
.
2022-10-14
- Added new parameters
Parameter | Type | Description |
---|---|---|
instFamily | String | Instrument family Applicable to FUTURES/SWAP/OPTION |
- Added new request fields
Parameter | Type | Required | Description |
---|---|---|---|
instFamily | String | No | Instrument family Applicable to FUTURES/SWAP/OPTION |
- Added new request and response fields
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 |
- Added new request and response fields
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 |
- Added new request fields
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. |
- Adjusted request fields
Before:
Parameter | Type | Required | Description |
---|---|---|---|
> uly | String | Conditional | underlying |
After:
Parameter | Type | Required | Description |
---|---|---|---|
> instFamily | String | Conditional | Instrument family Applicable to FUTURES/SWAP/OPTION |
- Adjusted request fields
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. |
- Adjusted request fields
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. |
- Adjusted request fields
Before:
Parameter | Type | Description |
---|---|---|
> uly | String | underlying |
After:
Parameter | Type | Description |
---|---|---|
> instFamily | String | Instrument family Applicable to FUTURES/SWAP/OPTION |
- Added new response fields
Parameter | Type | Description |
---|---|---|
> instFamily | String | Instrument family Applicable to FUTURES/SWAP/OPTION |
2022-10-13
- Added new response parameter
Parameter | Type | Description |
---|---|---|
> nextFundingTime | String | Forecasted funding time for the next period, Unix timestamp format in milliseconds, e.g. 1597026383085 |
2022-10-10
- Added new request fields
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. |
- Added new request fields
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 |
- Added new request fields
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. |
- Added new response fields
- Create RFQ
- Get rfqs
- Rfqs channel
Response Parameter:
- Create RFQ
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. |
- Added new error codes
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
- Added new request fields
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Deposit Type3 : internal transfer4 : deposit from chain |
- Added new request and response fields
Request Parameter:
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Withdrawal type 3 : internal transfer4 : 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
- Added new parameters
Parameter | Type | Description |
---|---|---|
instFamily | String | Instrument family Applicable to FUTURES/SWAP/OPTION |
- Added new request fields
Parameter | Type | Required | Description |
---|---|---|---|
instFamily | String | No | Instrument family Applicable to FUTURES/SWAP/OPTION |
- Added new request and response fields
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 |
- Added new request and response fields
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 |
- Added new request fields
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. |
- Adjusted request fields
Before:
Parameter | Type | Required | Description |
---|---|---|---|
> uly | String | Conditional | underlying |
After:
Parameter | Type | Required | Description |
---|---|---|---|
> instFamily | String | Conditional | Instrument family Applicable to FUTURES/SWAP/OPTION |
- Adjusted request fields
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. |
- Adjusted request fields
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. |
- Adjusted request fields
Before:
Parameter | Type | Description |
---|---|---|
> uly | String | underlying |
After:
Parameter | Type | Description |
---|---|---|
> instFamily | String | Instrument family Applicable to FUTURES/SWAP/OPTION |
- Added new response fields
Parameter | Type | Description |
---|---|---|
> instFamily | String | Instrument family Applicable to FUTURES/SWAP/OPTION |
2022-09-22
- Added new endpoints
2022-09-08
- The response fields within Get fee rates have been adjusted in the production trading service.
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 |
- Added new parameters
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
- Added new response parameters
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 |
- The response fields within Get fee rates will be adjusted in the production trading service on September 8, 2022 at the earliest
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
- Added new parameter for CSV file
Parameter | Description |
---|---|
affiliated | Whether there is affiliated relation. true or false |
2022-09-01
Added new endpoint
Added new request parameters
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 |
- Added new response parameter
Parameter | Type | Description |
---|---|---|
> reason | String | Reasons of state. Valid values can be mmp_canceled . |
- Added new request and response parameter
Parameter | Type | Description |
---|---|---|
clOrdId | String | Client-supplied ID A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters. |
Grid trading
added enumeration value foralgoOrdType
field
Parameter | Type | Description |
---|---|---|
algoOrdType | String | moon_grid : Moon grid |
Added new channel
Added new error codes
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
- New request and response parameter will be added on Sep 29, 2022, at the earliest
Parameter | Type | Description |
---|---|---|
clOrdId | String | Client-supplied ID A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 32 characters. |
- Adjusted request fields in Set trading fee rate for the sub-account
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
- Added new request and response parameter
Parameter | Type | Description |
---|---|---|
tag | String | Order tag A combination of case-sensitive alphanumerics, all numbers, or all letters of up to 16 characters. |
- Added new error codes
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
Added new WebSocket channel
Added new endpoints
Added new error codes
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
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
unSpotOffset | Boolean | No | true : disable Spot-Derivatives risk offset, false : enable Spot-Derivatives risk offsetDefault is false Only applicable to Portfolio margin It is effective when Spot-Derivatives risk offset is turned on, otherwise this parameter is ignored. |
- Added new response parameters
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 |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
spotOffsetType | String | Risk offset type1 : Spot-Derivatives(USDT) to be offsetted2 : Spot-Derivatives(Coin) to be offsetted3 : Only derivatives to be offsettedOnly applicable to Portfolio margin |
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
omitPosRisk | String | No | Ignore position risk Default is false Applicable to Portfolio margin |
- Added new response parameters
Parameter | Type | Description |
---|---|---|
> spotInUseAmt | String | Spot in use amount Applicable to Portfolio margin |
- Added new response parameters
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 |
- Added new error codes
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
- Added new response parameter
Parameter | Type | Description |
---|---|---|
uid | String | Account ID |
- Adjusted request fields in Reset the API Key of a sub-account
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 : TradeSeparate 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 : TradeSeparate with commas if more than one. The field will be reset if set. |
2022-08-10
Added new endpoints
Added new error codes
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
- Added new error codes
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
- Added a new function module Earn
2022-07-25
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
posId | String | No | Position ID |
2022-07-22
- Added new endpoints
2022-07-18
- Added a new function module Transaction timeliness
2022-07-15
Added new endpoints
Added new return parameters
Parameter | Type | Description |
---|---|---|
tag | String | Order tag |
2022-07-11
- Adjusted request fields in Get trades history
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 : timestampThe 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
- Added new endpoints
2022-06-30
Added request parameters
anonymous
andexpiresIn
in the endpoint Create QuoteAdded new return parameters
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 |
- Added new return parameters
Parameter | Type | Description |
---|---|---|
actualDepBlkConfirm | String | The actual amount of blockchain confirmed in a single deposit |
2022-06-24
Added new endpoints
Adjusted request fields in Get position tiers
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
- The response fields within Get positions history was adjusted
before:
Response Parameters
Parameter | Type | Description |
---|---|---|
type | String | The type of closing positionpartClose :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 position1 :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
- Adjusted request and response fields in Status
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) |
- Adjusted push data fields in Status channel
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
- Removed request parameter :
acctLv
2022-06-14
- The response fields within Get positions history will be adjusted in the production trading service on June 16, 2022 at the earliest
before:
Parameter | Type | Description |
---|---|---|
type | String | The type of closing positionpartClose :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 position1 :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
- REST API added a new function module Grid trading
WebSocket API added new channels
Added new error codes
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 |
- Added new endpoints
2022-06-09
- Block trading goes live
- Adjusted request fields in Create sub-account
- Adjusted request fields in Create sub-account
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. |
- Adjusted request fields in Create an API Key for a sub-account
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. |
- Adjusted request fields in Reset the API Key of a sub-account
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
- The function below has been gone live in production trading service:
- All ND sub-accounts have the permission of transfer out by default, and cannot be set permission of transfer out any more with Set Permission Of Transfer Out.
- All ND sub-accounts have the permission of transfer out by default, and cannot be set permission of transfer out any more with Set Permission Of Transfer Out.
2022-06-01
- The function below will go live on June 6, 2022 at the earliest:
- All ND subaccounts will have the permission of transfer out by default, and cannot be set permission of transfer out any more with Set Permission Of Transfer Out.
- All ND subaccounts will have the permission of transfer out by default, and cannot be set permission of transfer out any more with Set Permission Of Transfer Out.
2022-05-26
- Added new parameters
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 |
- Added new endpoints
2022-05-23
- Block trading feature has been gone live in demo trading service
- REST API refer to here
- WebSocket refer to private channel and public channel
- REST API refer to here
2022-05-20
- Added new parameters
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 begin
and 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
Added new endpoints for Fully-Disclosed Broker
The push logic of "Tickers channel" ws changed as follows:
- For currency pairs and contracts that have not been traded, the condition that
last
is an empty string will occur, which is common in newly launched currency pairs and contracts (especially options contracts).
- For currency pairs and contracts that have not been traded, the condition that
Added functionality below into Live trading:
- The changes of "book5" depth channel from pushing data every "200" ms to pushing data every "100" ms
- The changes of "book5" depth channel from pushing data every "200" ms to pushing data every "100" ms
2022-05-18
- Adjusted request fields in Create an API Key for a sub-account
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. |
- Adjusted request fields in Reset the API Key of a sub-account
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
- Added new parameters
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
The push logic of "Tickers channel" will be changed as follows on May 12, 2022:
- For currency pairs and contracts that have not been traded, the condition that
last
is an empty string will occur, which is common in newly launched currency pairs and contracts (especially options contracts).
- For currency pairs and contracts that have not been traded, the condition that
The following changes was made to the 'Get fee rates' interface.
- The
category
field was removed, but it would not affect the existing program calls. A request returns the same data with or without the category value. - Newly added return parameters: takerU and makerU, representing the fee rates of USDT-margined futures and perpetual contracts. When users check the fee rates of futures and perpetual contracts, the meaning of the original taker and maker parameters would change, representing only the fee rates of crypto-margined contracts.
- The
For details, please refer to OKX Will Make Changes to the 'Get Fee Rates' Interface
2022-05-05
- Added functionality below into Live trading:
- New "bbo-tbt" depth channel that sends tick-by-tick Level 1 data will be available on WebSocket API
- The changes of "book5" depth channel from pushing data every "200" ms to pushing data every "100" ms will
go live within two weeks
- 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
- New "bbo-tbt" depth channel that sends tick-by-tick Level 1 data will be available on WebSocket API
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 . |
Added new endpoints
Added new values for type
3
and4
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) |
- Added new return parameters
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 |
- Added new error codes
Error Message | Error Code |
---|---|
{0} Sub-account has no permission to transfer out, please set first | 58119 |
2022-04-28
- Newly added reponse parameters in the endpoint
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 |
- Newly added a enumeration and reponse parameters to push data for WebSocket channel
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operationsubscribe unsubscribe |
args | Array | Yes | List of subscribed channels |
> channel | String | Yes | Channel nameinstruments |
> instType | String | Yes | Instrument typeMARGIN |
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
- Added new return parameters
Parameter | Type | Description |
---|---|---|
logoLink | String | Logo link of currency |
2022-04-25
- Added functionality below into Demo trading, and go live on May 5, 2022 at the earliest:
- New "bbo-tbt" depth channel that sends tick-by-tick Level 1 data will be available on WebSocket API
- 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
- New "bbo-tbt" depth channel that sends tick-by-tick Level 1 data will be available on WebSocket API
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
- Update notice on May 2022. The following changes will be made to the 'Get fee rates' interface.
- The
category
field will be removed, but it will not affect the existing program calls. A request returns the same data with or without the category value. - Newly added return parameters: takerU and makerU, representing the fee rates of USDT-margined futures and perpetual contracts. When users check the fee rates of futures and perpetual contracts, the meaning of the original taker and maker parameters will change, representing only the fee rates of crypto-margined contracts.
- The
For details, please refer to OKX Will Make Changes to the 'Get Fee Rates' Interface
2022-04-14
- Update notice on April 25, 2022 about Demo trading and go live on May 5, 2022 at the earliest:
- New "bbo-tbt" depth channel that sends tick-by-tick Level 1 data will be available on WebSocket API
- New "bbo-tbt" depth channel that sends tick-by-tick Level 1 data will be available on WebSocket API
{
"op": "subscribe",
"args": [
{
"channel": "bbo-tbt",
"instId": "BTC-USDT"
}
]
}
Request parameters
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operationsubscribe unsubscribe |
args | Array | Yes | List of subscribed channels |
> channel | String | Yes | Channel namebooks 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
- Demo trading supported endpoints as follows:
2022-04-07
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
tag | String | No | Order tag |
- Added new return parameters
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 |
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
depId | String | No | Deposit ID |
- Added new request parameters
Parameter | Type | Required | Description |
---|---|---|---|
wdId | String | No | Withdrawal ID |
Added new endpoints
Added new error codes
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
- Offlined endpoints
- Removed funds password :
pwd
If the user continues to pass in the funds password, the parameter will be ignored and no error will be reported.
Added new endpoints for Non-Disclosed Broker
Added new return parameters
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 |
- Added new error codes
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
- Adjusted request field in Savings purchase/redemption:
before:
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% |
2022-01-26
Added new endpoints
Added new return parameters
Parameter | Type | Description |
---|---|---|
type | String | Sub-account type 1 :Standard sub-account 2 :Custody trading sub-account |
2022-01-25
- Added new return parameters
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
- The new domain name has been enabled. Click here to see the details
2022-01-18
Added a new request parameter
tag
Added new return parameters
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
- Added new return parameters:
Parameter | Type | Description |
---|---|---|
triggerPxType | String | Trigger price type last : last priceindex : index pricemark : mark price |
- Added new request fields to Place Algo Order for trigger order placement
Parameter | Type | Required | Description |
---|---|---|---|
triggerPxType | String | No | Trigger price type last : last priceindex : index pricemark : mark priceThe Default is last |
2022-01-14
Added a new request parameter
autoCxl
:Added a new endpoint and a WebSocket channel
2022-01-11
Broker API
migrated to Broker
2022-01-06
- Added new return parameters:
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 |
- Added new request fields to Place algo 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 |
Endpoint
Get piggyBank balance
changed to Get saving balanceAdded new error codes
Error Message | Error Code |
---|---|
Wrong passphrase | 60024 |
2021-12-24
Added new endpoints
Added new return fields to Get account configuration
Parameter | Type | Description |
---|---|---|
ctIsoMode | String | Contract isolated margin trading settingsautomatic :Auto transfers autonomy :Manual transfers |
mgnIsoMode | String | Margin isolated margin trading settingsautomatic :Auto transfers autonomy :Manual transfers |
- Added new return fields toGet positions 、Get account and position risk、Positions channel、Balance and position channel
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) |
- Added a new request field to Increase/decrease margin
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 |
- Added a new request field to Get maximum available balance/equity
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
Added new endpoints
Added new return fields to Get PiggyBank Balance
Parameter | Type | Description |
---|---|---|
rate | String | Lending rate |
loanAmt | String | Lending amount |
pendingAmt | String | Pending amount |
redemptAmt | String | Redempting amount |
- Added a new field to PiggyBank Purchase/Redemption
Parameter | Type | Description |
---|---|---|
rate | String | Lending rate |
- Adjusted response field in Get Interest Rate and Loan Quota
Parameter | Type | Description |
---|---|---|
> irDiscount | String | Interest rate discount Discarded field, always return "" |
2021-12-06
- Added a new request field to Funds transfer , Master accounts manage the transfers between sub-accounts, Increase/Decrease margin
Parameter | Type | Required | Description |
---|---|---|---|
loanTrans | Boolean | No | Whether or not borrowed coins can be transferred out under Multi-currency margin the default is false |
- Added a response field to Get maximum withdrawals
Parameter | Type | Description |
---|---|---|
maxWdEx | String | Max withdrawal (allowing borrowed crypto transfer out under Multi-currency margin ) |
- Adjusted response field in Get interest rate and loan quota for VIP loans :
Parameter | Type | Description |
---|---|---|
> level | String | VIP Level, e.g. VIP5 |
2021-12-04
- Added new return parameters:
Parameter | Type | Description |
---|---|---|
tpTriggerPxType | String | Take-profit trigger price type. last : last priceindex : index pricemark : mark price |
slTriggerPxType | String | Stop-loss trigger price type. last : last priceindex : index pricemark : mark price |
- Added new request fields to Place Algo Order for stop order placement
Parameter | Type | Required | Description |
---|---|---|---|
tpTriggerPxType | String | No | Take-profit trigger price typelast : last priceindex : index pricemark : mark priceThe Default is last |
slTriggerPxType | String | No | Stop-loss trigger price typelast : last priceindex : index pricemark : mark priceThe Default is last |
2021-11-26
- Adjusted request field in Place Order、Place Multiple Orders:
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
Added new endpoints
Added a new field to Get interest accrued data
Parameter | Type | Description |
---|---|---|
type | String | Loan type1 : VIP loans2 : Market loans |
- Get Bills Details (last 7 days) and Get Bills Details (last 3 months) added enumeration value for
subType
field
Parameter | Type | Description |
---|---|---|
subType | String | 14 : Interest deduction for VIP loans |
- Added new error codes
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
Added a new function module ND-Broker
Added a new endpoint Get account asset valuation
2021-11-20
- Added new response field to Increase/Decrease margin for stop order placement
Response Parameters
Parameter | Type | Description |
---|---|---|
leverage | String | Real leverage after the margin adjustment |
2021-11-02
- Added a new request field to Get maximum buy/sell amount or open amount
Parameter | Type | Required | Description |
---|---|---|---|
leverage | String | No | Leverage for instrument The default is current leverage Only applicable to MARGIN/FUTURES/SWAP |
2021-11-01
Added a new endpoint Get account risk state
Get Order Details Added enumeration value ddh for category field
Parameter | Type | Description |
---|---|---|
category | String | Categorynormal twap adl full_liquidation partial_liquidation delivery ddh : Delta dynamic hedge |
- Get Order History (last 7 days) Added enumeration value ddh for category field
Parameter | Type | Description |
---|---|---|
category | String | Categorynormal twap adl full_liquidation partial_liquidation delivery ddh : Delta dynamic hedge |
- Get Order History (last 3 months) Added enumeration value ddh for category field
Parameter | Type | Description |
---|---|---|
category | String | Categorynormal twap adl full_liquidation partial_liquidation delivery ddh : Delta dynamic hedge |
- Order Channel Added enumeration value ddh for category field
Parameter | Type | Description |
---|---|---|
category | String | Categorynormal twap adl full_liquidation partial_liquidation delivery ddh : Delta dynamic hedge |
- Get Bills Details (last 7 days) New enumeration value 13 for type field: ddh; new enumeration value for subType field:
131
: ddh buy and132
: ddh sell
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Bill type1 : 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 subtype1 : 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 |
- Get Bills Details (last 3 months) New enumeration value 13 for type field: ddh; new enumeration value for subType field:
131
: ddh buy and132
: ddh sell
Parameter | Type | Required | Description |
---|---|---|---|
type | String | No | Bill type1 : 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 subtype1 : 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 |
- Get Account Configuration Added enumeration value 4 for acctLv field
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 |
- Get Candlesticks 、Get Candlesticks History、Get Index Candlesticks 、Get Mark Price Candlesticks Add enumeration value to the bar field, support to get UTC time zone k-line[/6Hutc/12Hutc/1Dutc/1Wutc/1Mutc/3Mutc/6Mutc/1Yutc]
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] |
- Index Candlesticks Channel Added UTC time zone k-line channel
Parameter | Type | Required | Description |
---|---|---|---|
> channel | String | Yes | Channel nameindex-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 |
- Mark Price Candlesticks Channel Added UTC time zone k-line channel
Parameter | Type | Required | Description |
---|---|---|---|
> channel | String | Yes | Channel namemark-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 |
- Candlesticks Channel Added UTC time zone k-line channel
Parameter | Type | Required | Description |
---|---|---|---|
channel | String | Yes | Channel namecandle1Y 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 |
- Get Bills Details (last 7 days) Added the field execType
Parameter | Type | Description |
---|---|---|
execType | String | Liquidity taker or makerT : takerM : maker |
- Get Bills Details (last 3 months) Added the field execType
Parameter | Type | Description |
---|---|---|
execType | String | Liquidity taker or makerT : takerM : maker |
- Added new error codes
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
- Get Positions Add the field markPx:
The return parameter adds the marked price field:
Parameter | Type | Description |
---|---|---|
markPx | String | Mark price |
- Positions Channel Add the field markPx:
The return parameter adds the marked price field :
Parameter | Type | Description |
---|---|---|
>markPx | String | Mark price |
2021-10-18
Get Maximum Withdrawals Support query with multiple currencies. Currencies should be separated by half-width commas and no more than 20.
Added new return fields to Get Currencies
Parameters | Types | Description |
---|---|---|
mainNet | Boolean | If current chain is main net then return true |
- Added new error codes
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.
- Adjusted request field in Place Algo Order:
before:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | Yes | Order type conditional : One-way stop order oco : One-cancels-the-other ordertrigger : Trigger order |
after:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | Yes | Order type conditional : One-way stop order oco : One-cancels-the-other ordertrigger : Trigger ordericeberg : Iceberg ordertwap : 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 |
- Adjusted request field in Get Algo Order History、Get Algo Order List
before:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | Yes | Order type conditional : One-way stop order oco : One-cancels-the-other ordertrigger : Trigger order |
after:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | Yes | Order type conditional : One-way stop order oco : One-cancels-the-other ordertrigger : Trigger ordericeberg : Iceberg ordertwap : 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 |
Added interface: Cancel Advance Algo Order
Added new channel: Advance Algo Orders Channel
2021-10-14
- Added a new function module demo trading explorer
2021-10-12
- Get maximum available balance/equity and Get the maximum loan of instrument Support query with multiple instrument IDs(instId). Instrument IDs should be separated by half-width commas and no more than 5.
- Added endpoint: Get Funds Transfer State
2021-09-30
- Added endpoint: Lightning Deposits
- Added endpoint: Lightning Withdrawals
- Added new error codes
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
- Added new error codes
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
- Get Leverage:
Support query with multiple instrument IDs(instId). Instrument IDs should be separated by half-width commas and no more than 20.
Parameter | Type | Required | Description |
---|---|---|---|
instId | String | No | Single instrument or multiple instruments (no more than 20) separated with comma. |
- Added interface: Get index components
2021-09-06
Demo Trading supported iceberg
order and twap
order.
- Adjusted request field in Place Algo Order:
before:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | Yes | Order type conditional : One-way stop order oco : One-cancels-the-other ordertrigger : Trigger order |
after:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | Yes | Order type conditional : One-way stop order oco : One-cancels-the-other ordertrigger : Trigger ordericeberg : Iceberg ordertwap : 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 |
- Adjusted request field in Get Algo Order History、Get Algo Order List
before:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | Yes | Order type conditional : One-way stop order oco : One-cancels-the-other ordertrigger : Trigger order |
after:
Parameter | Type | Required | Description |
---|---|---|---|
ordType | String | Yes | Order type conditional : One-way stop order oco : One-cancels-the-other ordertrigger : Trigger ordericeberg : Iceberg ordertwap : 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 |
Added interface: Cancel Advance Algo Order
Added new channel: Advance Algo Orders Channel
2021-09-03
- Added a new function module trading statistics function
2021-08-31
- Added new return fields
stgyEq
andisoUpl
to Get Balance - Added new fields
stgyEq
andisoUpl
to push data for Account Channel
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
- Added a new request field
txId
to Get Withdrawal History, Get Deposit History
Parameter | Type | Required | Description |
---|---|---|---|
txId | String | No | Hash record of the deposit |
- Withdrawal supported universal address
2021-07-30
- Added a new request parameter
tgtCcy
for order placement:
Parameter | Type | Required | Description |
---|---|---|---|
tgtCcy | String | No | The number of transactions the typebase_ccy : Base currency ,quote_ccy : Quote currency Only applicable to SPOT |
- Added a new response parameter
tgtCcy
for order query:
Parameter | Type | Description |
---|---|---|
tgtCcy | String | The number of transactions the typebase_ccy : Base currency ,quote_ccy : Quote currency Only applicable to SPOT |
- Added a field
tgtCcy
to push data for WebSocket channel:
Parameter | Type | Description |
---|---|---|
tgtCcy | String | The number of transactions the typebase_ccy : Base currency ,quote_ccy : Quote currency Only applicable to SPOT |
- Added a new error code
59110
Error Message | HTTP Status Code | Error Code |
---|---|---|
The instrument type corresponding to this {0} does not support the tgtCcy parameter. | 200 | 59110 |
- Added a new error code
51281
Error Message | HTTP Status Code | Error Code |
---|---|---|
trigger not support the tgtCcy parameter. | 200 | 51281 |
2021-07-20
- Added endpoint: Get Transaction Details (last 3 months)
- Get Transaction details (last 3 days) The transaction details endpoint will be modified from obtaining historical data of the past 3 months to historical data of the past 3 days.
- Added endpoint: Get Position Tiers
2021-07-08
- Added a new endpoint: Get PiggyBank balance
2021-06-15
- Added a new returned field
ctAddr
to Get Deposit Address
Parameter | Type | Description |
---|---|---|
ctAddr | String | Last 6 digits of contract address |
- Added a new returned field
chain
to Get Deposit Address, Withdrawal, Get Withdrawal History, Get Deposit History
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
- Added a new error code
55000
Error Message | HTTP Status Code | Error Code |
---|---|---|
Cannot be transferred out within 30 minutes after delivery. | 200 | 55000 |
- Get maximum order quantity:
Support query with multiple instrument IDs(instId). Instrument IDs should be separated by half-width commas and no more than 5.
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
- Adjusted returned fields in Master accounts manage the transfers between sub-accounts
before:
Parameter name | Type | Description |
---|---|---|
transferId | int | Transfer ID |
after:
Parameter name | Type | Description |
---|---|---|
transId | String | Transfer ID |
- Updated data type for error code
50011
before:
code | type | httpcode | msg |
---|---|---|---|
50011 | int | 429 | Requests too frequent. |
after:
code | type | httpcode | msg |
---|---|---|---|
50011 | String | 429 | Requests too frequent. |
- Get Positions: Support query with multiple instrument IDs(instId). Instrument IDs should be separated by half-width commas and no more than 5.
Parameter | Type | Required | Description |
---|---|---|---|
instType | String | No | Instrument typeMARGIN 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 |
- Added new fields to Order Channel
Parameter | Type | Description |
---|---|---|
> fillNotionalUsd | String | Filled notional value in USD of order |
> notionalUsd | String | Estimated national value in USD of order |
- Added new fields to Algo Orders Channel
Parameter | Type | Description |
---|---|---|
> notionalUsd | String | Estimated national value in USD of order |
2021-05-25
- Added new fields to Get Discount Rate And Interest-Free Quota
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. |
- Added Get the underlying index of derivatives: Get Underlying
- Added Get the public information interface of Margin interest rate and borrow limit: Get Interest Rate and Loan Quota
- Added enumeration value to
ordType
of Place Order,Place Multiple Orders,Place Order Channel,Place Multiple Orders Channel:optimal_limit_ioc
Parameter | Type | Description |
---|---|---|
ordType | String | Order typemarket : market orderlimit : limit orderpost_only : Post-only orderfok : Fill-or-kill orderioc : Immediate-or-cancel order optimal_limit_ioc : Market order with immediate-or-cancel order (applicable only to Futures and Perpetual swap). |
2021-05-18
- Get Balance, Get Sub-account Balance, Account Channel add new response parameters:
notionalUsd
(Notional value of positions inUSD
),notionalLever
(Leverage of the currency),eqUsd
(EquityUSD
of the currency),maxLoan
(Max loan of the currency).
2021-05-12
- Adjusted fields in REST API Status:
begin
andend
timestamps changed from seconds to milliseconds.
2021-04-27
- Modified the
clOrdId
rules of the WebSocket transaction module interface WebSocket Trade
2021-04-21
- Added books50-l2-tbt with 50 depth levels books50-l2-tbt with 50 depth levels
- Added new fields to Get orders channel:
fillFee
(the fee of the last filled) ,fillFeeCcy
(the currency of the last filled),execType
(liquidity taker or maker of the last filled,T
: takerM
: maker ) - Added new fields to Get account configuration:
level
(fee tier), andlevelTmp
(trial fee tier) - Added an interface for obtaining position tiers of derivatives
- Added an on-chain transaction data interface
- Added an enumeration value
interest_deduction
ofeventType
to balance and position channel - Deleted
subType
109: liquidation fee in Get Bills Details (last 7 days) and Get Bills Details (last 3 months) - Add new response fields to Positions Channel and Get Positions:
Parameter | Type | Description |
---|---|---|
> deltaBS | String | delta:Black-Scholes Greeks in dollars, only applicable to OPTION |
> deltaPA | String | delta:Greeks in coins, only applicable to FUTURES 、SWAP 、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 |
2021-04-16
- Added endpoint: Get account and position risk
- Added new fields to Get Balance, Get sub-account trading balance, Account Channel:
cashBal
(balance of a certain currency), anduTime
(balance update time of a certain currency) - Added endpoint: Get interest rate
- Added endpoint: Get 24H Total Volume
2021-03-31
- Added new fields to Get Balance:
ordFroz
(position margin of cross pending orders converted to USD). - Added new fields to Query detailed balance info of Trading Account of a sub-account (applies to master accounts only):
ordFroz
(position margin of cross pending orders converted to USD). - Added new fields to Account Channel:
ordFroz
(position margin of cross pending orders converted to USD).
2021-03-24
- Added AWS domain name to Real market.
- Added domain name to Demo trading. The old domain name will be replaced by the new one.
2021-03-02
- Added Push channel: balance and position
2021-02-26
- Added new fields to Get Balance:
disEq
(equity of a certain currency converted to USD).
2021-02-05
Due to the logic change of discount rate calculation used to acquire the interest-free limit and discount rate will return parameters of discount level(discountLv)instead of discount rate(discount). For more info, please refer to Discount rates.
response before:
{ "code":"0", "msg":"", "data":[ { "ccy":"BTC", "amt" :"2" , "discount" :"0.8" } ] }
response after:
{ "code":"0", "msg":"", "data":[ { "ccy":"BTC", "amt" :"2" , "discountLv" :"1" } ] }
Added a new response field to Get Balance: uplLiab(liabilities due to Unrealized loss of the position).