OKX API v5 updates report Q4 2021
BRAZILIEX
相關類型: Others
2022-09-02 14:28
Dear API users: To: OKX API users From: OKX API product team Issue Date: Mar. 31, 2022 Contact us: https://t.me/OKXAPI The OKX API v5 service received numerous updates in Q4 2021 as part of our efforts to continually improve its user experience. This report summarizes those updates, and users can review detailed change logs here. Summary of updates to API v5 in Q4 2021: Trade module . Id Endpoint Change summary Date 1 Place algo order Supported iceberg order and twap order 2021-10-15 Added new request fields tpTriggerPxType,slTriggerPxType 2021-12-04 2 Cancel advance algo order Added interfaces 2021-10-15 3 Get algo order history Supported iceberg order and twap order 2021-10-15 Added new fields tpTriggerPxType,slTriggerPxType 2021-12-04 4 Get algo order list Supported iceberg order and twap order 2021-10-15 Added new fields tpTriggerPxType,slTriggerPxType 2021-12-04 5 Get order details Added enumeration value ddh for category field 2021-11-01 Added new fields tpTriggerPxType,slTriggerPxType 2021-12-04 6 Get order history Added enumeration value ddh for category field 2021-11-01 Added new fields tpTriggerPxType,slTriggerPxType 2021-12-04 7 Get order history Added enumeration value ddh for category field 2021-11-01 Added new fields tpTriggerPxType,slTriggerPxType 2021-12-04 8 Place order Adjusted request field reduceOnly 2021-11-26 9 Place multiple orders Adjusted request field reduceOnly 2021-11-26 10 Get order List Added new fields tpTriggerPxType,slTriggerPxType 2021-12-04 Funding module . Id Endpoint Change summary Date 1 Get funds transfer state Added interfaces 2021-10-12 2 Get currencies Added a new return field mainNet 2021-10-18 3 Get account asset valuation Added interfaces 2021-10-23 4 Funds transfer Added a new request field loanTrans 2021-12-06 5 Set lending rate Added interfaces 2021-12-14 6 Get lending history 7 Get public borrow info 8 Get public borrow history 9 Get saving balance Added new return fields rate, loanAmt, pendingAmt, redemptAmt 2021-12-14 10 Savings purchase/redemption Added a new return field rate 2021-12-14 Account module . Id Endpoint Change summary Date 1 Get maximum available tradable amount Supported query with multiple instrument IDs. Instrument IDs should be separated by half-width commas and no more than 5. 2021-10-12 Added a new field px 2021-12-24 2 Get the maximum loan of instrument Supported query with multiple instrument IDs. Instrument IDs should be separated by half-width commas and no more than 5. 2021-10-12 3 Get maximum withdrawals Supported query with multiple currencies. Currencies should be separated by half-width commas and no more than 20. 2021-10-18 Added a new response field maxWdEx 2021-12-06 4 Get positions Added a new field markPx 2021-10-19 Added new return fields baseBal,quoteBal 2021-12-24 5 Get account and position risk Added new return fields baseBal,quoteBal 2021-12-24 6 Get account risk state Added interfaces 2021-11-01 7 Get bills details Added enumeration value ddh for type field . Added new enumeration value for subType field, 131: ddh buy and 132: ddh sell . 2021-11-01 Added a new response field execType 2021-11-01 Added enumeration value for subType field, 14: Interest deduction for VIP loans 2021-11-25 8 Get bills details Added enumeration value ddh for type field . Added new enumeration value for subType field, 131: ddh buy and 132: ddh sell . 2021-11-01 Added a new response field execType 2021-11-01 Added enumeration value for subType field, 14: Interest deduction for VIP loans 2021-11-25 9 Get account configuration Added enumeration value 4 for acctLv field 2021-11-01 Added new response fields ctIsoMode,mgnIsoMode 2021-12-24 10 Get maximum buy/sell amount or open amount Added a new request field leverage 2021-11-02 11 Increase/decrease margin Added a new response field leverage 2021-11-20 Added a new request field loanTrans 2021-12-06 Added new fields ccy, auto 2021-12-24 12 VIP loans borrow and repay Added interfaces 2021-11-25 13 Get borrow and repay history for VIP loans 14 Get borrow interest and limit 15 Get interest accrued data Added a new field type 2021-11-25 16 Position builder Added interfaces 2021-12-24 17 Isolated margin trading settings Added interfaces 2021-12-24 SubAccount module . Id Endpoint Change summary Date 1 Master accounts manage the transfers between sub-accounts Added a new request field loanTrans 2021-12-06 Market data module . Id Endpoint Change summary Date 1 Get candlesticks Added enumeration value to the bar field, support to get UTC time zone k-line 2021-11-01 2 Get candlesticks history 3 Get index candlesticks 4 Get mark price candlesticks Public data module . Id Endpoint Change summary Date 1 Get interest rate and loan quota for VIP loans Added interfaces 2021-11-25 2 Get interest rate and loan quota Adjusted field irDiscount 2021-12-14 Broker API module . Added a new function module ND-Broker WebSocket module . Id Endpoint Change summary Date 1 Advance algo orders channel Added new channel 2021-10-15 2 Orders channel Added enumeration value ddh for category field 2021-11-01 Added new fields tpTriggerPxType,slTriggerPxType 2021-12-04 3 Algo orders channel Added new fields tpTriggerPxType,slTriggerPxType 2021-12-04 4 Positions channel Added new fields markPx 2021-10-19 Added new return fields baseBal,quoteBal 2021-12-24 5 Balance and position channel Added new return fields baseBal,quoteBal 2021-12-24 6 Index candlesticks channel Added UTC time zone k-line channel 2021-11-01 7 Mark price candlesticks channel 8 Candlesticks channel Demo Trading Explorer . Added a new function module demo trading explorer Error code . Id Change summary Date 1 Add new error code 50030 No permission to use this API 2021-10-18 2 Add new error code 51298 Trigger orders are not available in the net mode of futures and perpetual swaps 3 Add new error code 58214 Withdrawals suspended due to {chainName} maintenance 4 Add new error code 59004 Only IDs with the same instrument type are supported 5 Add new error code 51037 The current account risk status only supports you to place IOC orders that can reduce the risk of your account. 2021-11-01 6 Add new error code 51038 There is already an IOC order under the current risk module that reduces the risk of the account. 7 Add new error code 51039 Leverage cannot be adjusted for the cross positions of Futures and Perpetual swap under the PM account. 8 Add new error code 51040 Cannot adjust margins for long isolated options positions 9 Add new error code 51010 The current account mode does not support this API interface. 10 Add new error code 51295 Portfolio margin account does not support ordType {0} in Trading bot mode 11 Add new error code 51041 Portfolio margin account only supports net mode. 12 Add new error code 51512 Failed to amend bulk orders. You cannot add duplicate batch orders in your Portfolio margin account. 13 Add new error code 51019 No net long positions can be held under cross margin mode in options. 14 Add new error code 59303 Insufficient available margin, add margin or reduce the borrowing amount 2021-11-25 15 Add new error code 59304 Insufficient equity for borrowing, keep enough funds to pay interest for at least one day 16 Add new error code 59305 Use VIP loan first to set the VIP loan priority 17 Add new error code 59306 Your borrowing amount exceeds the max limit 18 Add new error code 59307 You are not eligible for VIP loans 19 Add new error code 59308 Unable to repay VIP loan due to insufficient borrow limit 20 Add new error code 59309 Unable to repay an amount that exceeds the borrowed amount 21 Add new error code 59310 Your account does not support VIP loan 22 Add new error code 59311 Unable to set up as there is VIP loan 23 Add new error code 59312 {currency} does not support VIP loans Change details: Trade module . Change 1 Date:2021-10-15 . REST endpoints: . Place algo order . Get algo order history . Get algo order list . Cancel advance algo order . REST URLs: . POST /api/v5/trade/order-algo . GET /api/v5/trade/orders-algo-history . GET /api/v5/trade/orders-algo-pending . POST /api/v5/trade/cancel-advance-algos . Description: . Supported iceberg order and twap order for endpoints Place algo order, Get algo order history, Get algo order list . Added interfaces : Cancel advance algo order . Benefit:Algo Order supported iceberg order and twap order . Change 2 Date:2021-11-01 . REST endpoints: . Get order details . Get order history . Get order history . REST URLs: . GET /api/v5/trade/order . GET /api/v5/trade/orders-history . GET /api/v5/trade/orders-history-archive . Description: . Added enumeration value ddh for category field . Benefit:This makes the query more flexible. . Change 3 Date:2021-11-26 . REST endpoints: . Place order . Place multiple orders . REST URLs: . POST /api/v5/trade/order . POST /api/v5/trade/batch-orders . Description:Adjusted request field reduceOnly . Benefit:This enabled reduce-only position function for future and swap. . Change 3 Date:2021-12-04 . REST endpoints: . Get order details . Get order List . Get order history . Get order history . Place algo order . Get algo order list . Get algo order history . REST URLs: . GET /api/v5/trade/order . GET /api/v5/trade/orders-pending . GET /api/v5/trade/orders-history . GET /api/v5/trade/orders-history-archive . POST /api/v5/trade/order-algo . GET /api/v5/trade/orders-algo-pending . GET /api/v5/trade/orders-algo-history . Description:Added new fields tpTriggerPxType,slTriggerPxType . Benefit:Stop order supported multiple trigger price type . Funding module . Change 1 Date:2021-10-12 . REST endpoints:Get funds transfer state . REST URLs:GET /api/v5/asset/transfer-state . Description:Added interfaces . Benefit:Users can fetch the status of funds transfer . Change 2 Date:2021-10-18 . REST endpoints:Get currencies . REST URLs:GET /api/v5/asset/currencies . Description:Added a new return field mainNet . Benefit:Users can fetch the mainnet of currencies . Change 3 Date:2021-10-18 . REST endpoints:Get account asset valuation . REST URLs:GET /api/v5/asset/asset-valuation . Description:Added interfaces . Benefit:Users can fetch the account asset valuation . Change 4 Date:2021-12-06 . REST endpoints:Funds transfer . REST URLs:POST /api/v5/asset/transfer . Description:Added a new request field loanTrans . Benefit:This enabled loan transfer. . Change 5 Date:2021-12-14 . REST endpoints: . Set lending rate . Get lending history . Get public borrow info . Get public borrow history . Get saving balance . Savings purchase/redemption . REST URLs: . POST /api/v5/asset/set-lending-rate . GET /api/v5/asset/lending-history . GET /api/v5/asset/lending-rate-summary . GET /api/v5/asset/lending-rate-history . GET /api/v5/asset/saving-balance . POST /api/v5/asset/purchase_redempt . Description: . Added interfaces : Set lending rate, Get lending history, Get public borrow info ,Get public borrow history . Added new return fields rate,loanAmt,pendingAmt,redemptAmt for endpoint Get saving balance . Added a new return field rate for endpoint Savings purchase/redemption . Benefit:This enabled Interest rate marketization. . Account module . Change 1 Date:2021-10-12 . REST endpoints: . Get maximum available tradable amount . Get the maximum loan of instrument . REST URLs: . GET /api/v5/account/max-avail-size . GET /api/v5/account/max-loan . Description:Supported query with multiple instrument IDs. Instrument IDs should be separated by half-width commas and no more than 5. . Benefit:This improved query efficiency. . Change 2 Date:2021-10-18 . REST endpoints:Get maximum withdrawals . REST URLs:GET /api/v5/account/max-withdrawal . Description:Supported query with multiple currencies. Currencies should be separated by half-width commas and no more than 20. . Benefit:This improved query efficiency. . Change 3 Date:2021-10-19 . REST endpoints:Get positions . REST URLs:GET /api/v5/account/positions . Description:Added a new field markPx . Benefit:Users can fetch market price of position. . Change 4 Date:2021-11-01 . REST endpoints:Get account risk state . REST URLs:GET /api/v5/account/risk-state . Description:Added interfaces . Benefit:Users can fetch account risk state. . Change 5 Date:2021-11-01 . REST endpoints:Get account configuration . REST URLs:GET /api/v5/account/config . Description:Added enumeration value 4 for acctLv field . Benefit:This enabled portfolio margin account for endpoint Get account configuration. . Change 6 Date:2021-11-01 . REST endpoints: . Get bills details . Get bills details . REST URLs: . GET /api/v5/account/bills . GET /api/v5/account/bills-archive . Description: . Added a new response field execType . Added enumeration value ddh for type field . Added new enumeration value for subType field, 131: ddh buy and 132: ddh sell . Benefit:This makes the query more flexible. . Change 7 Date:2021-11-02 . REST endpoints:Get maximum buy/sell amount or open amount . REST URLs:GET /api/v5/account/max-size . Description:Added a new request field leverage . Benefit:Users can fetch the maximum buy/sell amount or open amount at specified leverage. . Change 8 Date:2021-11-20 . REST endpoints:Increase/decrease margin . REST URLs:POST /api/v5/account/position/margin-balance . Description:Added a new response field leverage . Benefit:Users can fetch the real leverage of position after margin adjustment. . Change 9 Date:2021-11-25 . REST endpoints: . VIP loans borrow and repay . Get borrow and repay history for VIP loans . Get borrow interest and limit . Get interest accrued data . Get bills details . Get bills details . REST URLs: . POST /api/v5/account/borrow-repay . GET /api/v5/account/borrow-repay-history . GET /api/v5/account/interest-limits . GET /api/v5/account/interest-accrued . GET /api/v5/account/bills . GET /api/v5/account/bills-archive . Description: . Added interfaces : VIP loans borrow and repay, Get borrow and repay history for VIP loans, Get borrow interest and limit . Added a new field type for endpoint Get interest accrued data . Added enumeration value for subType field for endpoints Get bills details , Get bills details . Benefit:This enabled VIP loans for API. . Change 10 Date:2021-12-06 . REST endpoints:Get maximum withdrawals . REST URLs:GET /api/v5/account/max-withdrawal . Description:Added a new response field maxWdEx . Benefit:Users can fetch maximum withdrawal of trading account when your portfolio margin account enabled loan transfer. . Change 11 Date:2021-12-24 . REST endpoints:Position builder . REST URLs:POST /api/v5/account/simulated_margin . Description:Added interfaces . Benefit:Users can calculates portfolio margin information for simulated position or current position of the user. . Change 12 Date:2021-12-24 . REST endpoints:Isolated margin trading settings . REST URLs:POST /api/v5/account/set-isolated-mode . Description:Added interfaces . Benefit:Users can set the currency margin and futures/perpetual Isolated margin trading mode. . Change 13 Date:2021-12-24 . REST endpoints: . Get account configuration . Get positions . Get account and position risk . Increase/decrease margin . REST URLs: . GET /api/v5/account/config . GET /api/v5/account/positions . GET /api/v5/account/account-position-risk . POST /api/v5/account/position/margin-balance . Description: . Added new response fields ctIsoMode,mgnIsoMode for endpoint Get account configuration . Added new return fields baseBal,quoteBal for endpoints Get positions, Get account and position risk . Added new fields ccy, auto for endpoint Increase/decrease margin . Benefit:This enabled autonomous transfer for ioslated margin. . Change 14 Date:2021-12-24 . REST endpoints:Get maximum available tradable amount . REST URLs:GET /api/v5/account/max-avail-size . Description:Added a new field px . Benefit:This makes the query more flexible. . SubAccount module . Change 1 Date:2021-12-06 . REST endpoints:Master accounts manage the transfers between sub-accounts . REST URLs:POST /api/v5/asset/subaccount/transfer . Description:Added a new request field loanTrans . Benefit:This enabled loan transfer. . Market data module . Change 1 Date:2021-11-01 . REST endpoints: . Get candlesticks . Get candlesticks history . Get index candlesticks . Get mark price candlesticks . REST URLs: . GET /api/v5/market/candles . GET /api/v5/market/history-candles . GET /api/v5/market/index-candles . GET /api/v5/market/mark-price-candles . Description:Added enumeration value to the bar field, support to get UTC time zone k-line. . Benefit:This makes the query more flexible. . Public data module . Change 1 Date:2021-11-25 . REST endpoints:Get interest rate and loan quota for VIP loans . REST URLs:GET /api/v5/public/vip-interest-rate-loan-quota . Description:Added interfaces . Benefit:This enabled VIP loans for API. . Change 2 Date:2021-12-14 . REST endpoints:Get interest rate and loan quota . REST URLs:GET /api/v5/public/vip-interest-rate-loan-quota . Description:Discarded the return field irdiscount . Benefit:Users can fetch the real leverage of position after margin adjustment. . Broker API module . Added a new function module ND-Broker, link : https://www.OKX.com/docs-v5/broker_en/#non-disclosed-broker WebSocket module . Change 1 Date:2021-10-15 . Channel:Advance algo orders channel . Subscription name:algo-advance . Description:Added new channel . Benefit:Algo Order supported iceberg order and twap order. . Change 2 Date:2021-10-19 . Channel:Positions channel . Subscription name:positions . Description:Added a new field markPx . Benefit:Users can fetch market price of position. . Change 3 Date:2021-11-01 . Channel:Orders channel . Subscription name:orders . Description:Added enumeration value ddh for category field . Benefit:This newly added field allows users to get ddh order. . Change 4 Date:2021-11-01 . Channel:Index candlesticks channel,Mark price candlesticks channel,Candlesticks channel . Subscription name:index-candle, mark-price-candle, candle . Description:Added new channels. . Benefit:Supported to get UTC time zone k-line. . Change 5 Date:2021-12-04 . Channel:Orders channel, Algo orders channel . Subscription name:orders, orders-algo . Description:Added new fields tpTriggerPxType, slTriggerPxType . Benefit:Stop order supported multiple trigger price type. . Change 6 Date:2021-12-24 . Channel:Positions channel, Balance and position channel . Subscription name:positions, balance_and_position . Description:Added new return fields baseBal, quoteBal . Benefit:This enabled autonomous transfer for ioslated margin. . Demo Trading Explorer . Added a new function module demo trading explorer, link : https://www.OKX.com/demo-trading-explorer/v5/en There is now a demo trading explorer containing the API endpoints which allows you to debug API on webpage. Error code . Change 1 Date:2021-10-18 . Description: . Add new error code 50030 No permission to use this API . Add new error code 51298 Trigger orders are not available in the net mode of futures and perpetual swaps . Add new error code 58214 Withdrawals suspended due to {chainName} maintenance . Add new error code 59004 Only IDs with the same instrument type are supported . Benefit:The error situation is made more clear to users. . Change 2 Date:2021-11-01 . Description: . Add new error code 50037 The current account risk status only supports you to place IOC orders that can reduce the risk of your account. . Add new error code 51038 There is already an IOC order under the current risk module that reduces the risk of the account. . Add new error code 51039 Leverage cannot be adjusted for the cross positions of Futures and Perpetual swap under the PM account. . Add new error code 51040 Cannot adjust margins for long isolated options positions . Add new error code 51010 The current account mode does not support this API interface. . Add new error code 51295 Portfolio margin account does not support ordType {0} in Trading bot mode . Add new error code 51041 Portfolio margin account only supports net mode. . Add new error code 51512 Failed to amend bulk orders. You cannot add duplicate batch orders in your Portfolio margin account. . Add new error code 51019 No net long positions can be held under cross margin mode in options. . Benefit:The error situation is made more clear to users. . Change 3 Date:2021-11-25 . Description: . Add new error code 59303 Insufficient available margin, add margin or reduce the borrowing amount . Add new error code 59304 Insufficient equity for borrowing, keep enough funds to pay interest for at least one day . Add new error code 59305 Use VIP loan first to set the VIP loan priority . Add new error code 59306 Your borrowing amount exceeds the max limit . Add new error code 59307 You are not eligible for VIP loans . Add new error code 59308 Unable to repay VIP loan due to insufficient borrow limit . Add new error code 59309 Unable to repay an amount that exceeds the borrowed amount . Add new error code 59310 Your account does not support VIP loan . Add new error code 59311 Unable to set up as there is VIP loan . Add new error code 59312 {currency} does not support VIP loans . Benefit:The error situation is made more clear to users. . . . OKX, April 14, 2022. . Click Here to Download OKX App >>>. Click Here for OKX Twitter >>>. Click Here to Join OKX Official Community >>>.