OKX JavaScript SDK
Build with the OKX REST API & WebSockets with our JavaScript SDK, TypeScript-first package declarations, and Node.js-compatible runtime patterns. Discover installation, common examples, a detailed endpoint-to-function map, and the REST API/WebSocket patterns shared across our Siebly SDK family.
Use the same TypeScript-first REST API and WebSocket clients from plain JavaScript or TypeScript in Node.js-compatible runtimes.
Package surfaces
Explore the following API capabilities are covered by our OKX SDK:
- Spot
- Futures
- Options
- Grid
- WebSockets
- WebSocket API
- WebSocket clients with:
- Built-in heartbeats.
- Automatic reconnection.
- Automatic reauthentication and resubscribe where the exchange supports it.
- Promise-wrapped WebSocket API commands you can await like a REST API.
- Typed requests and responses for Node.js, JavaScript, and TypeScript IDEs.
- Framework-neutral JavaScript snippets that stay approachable in Node.js-compatible runtimes.
- TypeScript-first package declarations for stricter services, shared libraries, and editor-assisted integrations.
Install OKX SDK
# Via your favourite package manager, e.g. npm:
npm install okx-api
# or pnpm:
pnpm install okx-api
# or yarn:
yarn add okx-apiQuickstart Examples with the OKX JavaScript SDK
Get started with just a few lines of JavaScript. TypeScript, while not required, is absolutely recommended. TypeScript declarations are included with all our SDKs and provide convenient definitions on request & response fields, WebSocket payloads, and generally safer integrations.
REST walkthrough
Easily start calling OKX's REST APIs in JavaScript.
- Install the OKX JavaScript SDK via NPM:
npm install okx-api. - Import the RestClient class (REST API wrapper for OKX's REST APIs).
- Create an instance with your API credentials (different key types are automatically detected & handled).
- Call the desired REST API methods as functions and await the promise containing the response.
In this example, we:
- Query account balances and find the available stablecoin balance (USDT).
- Prepare & submit a simple market buy, using 50% of the available balance.
- Log the responses of both REST API calls to console.
For a full map of available REST API methods, check out the endpoint reference below.
/* eslint-disable @typescript-eslint/no-unused-vars */import { OrderRequest, RestClient } from 'okx-api'; // read from environmental variablesconst API_KEY = process.env.API_KEY_COM;const API_SECRET = process.env.API_SECRET_COM;const API_PASS = process.env.API_PASS_COM; // If running from CLI in unix, you can pass env vars as such:// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-private-trade.ts// note the single quotes, preventing special characters such as $ from being incorrectly parsed by the shell if (!API_KEY || !API_SECRET || !API_PASS) { throw new Error( 'Missing api credentials. Use environmental variables or hard code in the script', );} console.log(new Date(), 'Using credentials: ', { API_KEY, API_SECRET, API_PASS,}); const client = new RestClient({ apiKey: API_KEY, // apiKey: 'apiKeyHere', apiSecret: API_SECRET, // apiSecret: 'apiSecretHere', apiPass: API_PASS, // apiPass: 'apiPassHere',}); // const wsClient = new WebsocketClient({// apiKey: API_KEY,// apiSecret: API_SECRET,// apiPass: API_PASS,// }); function logWSEvent(type: string, data: any) { console.log(new Date(), `WS ${type} event: `, data);} // simple sleep functionfunction promiseSleep(milliseconds: number) { return new Promise((resolve) => setTimeout(resolve, milliseconds));} // WARNING: for sensitive math you should be using a library such as decimal.js!function roundDown(value: any, decimals: number) { return Number( Math.floor(parseFloat(value + 'e' + decimals)) + 'e-' + decimals, );} /** This is a simple script wrapped in a immediately invoked function expression, designed to check for any available BTC balance and immediately buy with 50% of the available USDT */(async () => { try { // // Add event listeners to log websocket events on account // wsClient.on('update', (data) => logWSEvent('update', data)); // wsClient.on('open', (data) => logWSEvent('open', data)); // wsClient.on('response', (data) => logWSEvent('response', data)); // wsClient.on('reconnect', (data) => logWSEvent('reconnect', data)); // wsClient.on('reconnected', (data) => logWSEvent('reconnected', data)); // wsClient.on('authenticated', (data) => logWSEvent('authenticated', data)); // wsClient.on('exception', (data) => logWSEvent('exception', data)); // // Subscribe to private account topics // wsClient.subscribeTopic('SPBL', 'account'); // wsClient.subscribeTopic('SPBL', 'orders'); // wait briefly for ws to be ready (could also use the response or authenticated events, to make sure topics are subscribed to before starting) await promiseSleep(2.5 * 1000); const allBalances = await client.getBalance(); // const balances = allBalances.filter((bal) => Number(bal.available) != 0); const usdtBalanceResult = allBalances[0].details.find( (bal) => bal.ccy === 'USDT', ); console.log('BTC balance result: ', usdtBalanceResult); const usdtBalance = Number(usdtBalanceResult?.availBal); // console.log('balance: ', JSON.stringify(balances, null, 2)); if (!usdtBalanceResult || !usdtBalance) { console.error('No USDT to trade'); return; } console.log(`USDT available: ${usdtBalance}`); const symbol = 'BTC-USDT'; const quantity = 0.002; const order: OrderRequest = { instId: symbol, ordType: 'market', side: 'buy', sz: String(usdtBalance * 0.5), tdMode: 'cash', tgtCcy: 'base_ccy', }; const buyResult = await client.submitOrder(order); console.log('result: ', buyResult); return; // example to find minimum allowed size for a symbol and place an order with it /* const symbol = 'BTC-USDT-SWAP'; const symbolsResult = await client.getInstruments({ instType: 'SWAP', }); const btcRules = symbolsResult.find((rule) => rule.instId === symbol); console.log('btc trading rules: ', btcRules); if (!btcRules) { return console.log('no rules found for trading ' + symbol); } const minSize = Number(btcRules.minSz); const order = { instId: symbol, tdMode: 'cross', ordType: 'market', side: 'sell', sz: String(minSize), } as const; console.log('submitting order: ', order); const sellResult = await client.submitOrder(order); console.log('sell result: ', sellResult); */ } catch (e) { console.error('request failed: ', e); }})();WebSocket walkthrough
Connecting to OKX's WebSocket streams is straightforward with the WebsocketClient.
- Install the OKX JavaScript SDK via NPM:
npm install okx-api. - Import the WebsocketClient (General WebSocket wrapper for all available OKX WebSocket streams)
- Create an instance of the WebsocketClient (API credentials not required unless you want to consume private topics).
- Configure event handlers for the emitted events you are interested in. The minimum recommended handlers are 'exception', 'update' and 'reconnected'. The latter informs you if a connection dropped and was successfully re-established by the client.
- Call the subscribe method for the desired channels and handle incoming events.
In this example, we demonstrate how you can easily subscribe to one or more available channels via the instanced WebsocketClient across all available topics and product groups.
This setup allows you to receive real-time updates on any activity on the exchange, a much faster alternative to polling REST endpoints for the same data.
The WebsocketClient handles most of the complexity for you:
- Automatically opens connections to Bybit's WebSocket streams.
- Automatically authenticates as needed.
- Tracks the topics you've subscribed to.
- Automatically detects if a connected stream becomes faulty.
- Automatically tears down the faulty stream, before replacing it with a fresh connection and automatically resubscribing to the topics you were subscribed to before.
import { DefaultLogger, WebsocketClient } from 'okx-api'; // Optional: Inject a custom logger.// This example overrides the default logger to also log "trace" (super verbose) messages, which are disabled by defaultconst logger = { ...DefaultLogger, // trace: (...params) => console.log('trace', ...params),}; // For private events, all 3 of the following are required (per account):const API_KEY = process.env.API_KEY_COM;const API_SECRET = process.env.API_SECRET_COM;const API_PASSPHRASE = process.env.API_PASSPHRASE_COM; // If running from CLI in unix, you can pass env vars as such:// API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts // note the single quotes, preventing special characters such as $ from being incorrectly passed if (!API_KEY) { throw new Error('API_KEY is missing');} if (!API_SECRET) { throw new Error('API_SECRET is missing');} if (!API_PASSPHRASE) { throw new Error('API_PASSPHRASE is missing');} const wsClient = new WebsocketClient( { // For Global users (www.okx.com), you don't need to set the market. // It will use global by default. // Not needed: market: 'GLOBAL', // For EEA users (my.okx.com), set market to "EEA": // market: 'EEA', // For US users (app.okx.com), set market to "US": // market: 'US', accounts: [ // For private topics, include one or more accounts in an array. Otherwise only public topics will work { apiKey: API_KEY, apiSecret: API_SECRET, apiPass: API_PASSPHRASE, }, // { // apiKey: 'yourApiKeyHere', // apiSecret: 'yourApiSecretHere', // apiPass: 'yourApiPassHere', // }, // { // apiKey: 'anotherAccountKey', // apiSecret: 'anotherAccountSecret', // apiPass: 'anotherAccountPass', // }, ], }, logger,); // Raw data will arrive on the 'update' eventwsClient.on('update', (data) => { // console.log('ws update (raw data received)', JSON.stringify(data, null, 2)); console.log('ws update (raw data received)', JSON.stringify(data));}); wsClient.on('open', (data) => { console.log('connection opened open:', data.wsKey);}); // Replies (e.g. authenticating or subscribing to channels) will arrive on the 'response' eventwsClient.on('response', (data) => { // console.log('ws response: ', JSON.stringify(data, null, 2)); console.log('ws response: ', JSON.stringify(data));}); wsClient.on('reconnect', ({ wsKey }) => { console.log('ws automatically reconnecting.... ', wsKey);});wsClient.on('reconnected', (data) => { console.log('ws has reconnected ', data?.wsKey);});wsClient.on('exception', (data) => { console.error('ws exception: ', data);}); // Optional, connect before subscribing:// wsClient.connectPrivate(); // This is optional though. The wsclient will automatically open and subscribe if the connection doesn't exist yet. /** * # Subscribing to channels * * Subscribe to channels using the inner "args" part of the subscription request described in the OKX API docs. * * For example, if the docs state your request should look as such: { op: "subscribe", args: [ { channel: "account" } ] } * * You should call the wsClient.subscribe function using only the "args". * * Either of these examples is correct (one channel vs one or more channels in an array): wsClient.subscribe({ channel: 'account' }); wsClient.subscribe([ { channel: "account" } ]) */ // Subscribe one event at a time:wsClient.subscribe({ channel: 'account',}); // OR, combine multiple subscription events into one request using an array instead of an object:wsClient.subscribe([ { channel: 'account', }, { channel: 'positions', instType: 'ANY', },]); /** * Examples for each private channel listed in the API docs: * https://www.okx.com/docs-v5/en/#websocket-api-private-channel */ // Account events for all symbolswsClient.subscribe({ channel: 'account',}); // Account events for specific symbol onlywsClient.subscribe({ channel: 'account', ccy: 'BTC',}); // Withdrawal events for specific symbol onlywsClient.subscribe({ channel: 'withdrawal-info', ccy: 'BTC',}); // Position events on any instrument typewsClient.subscribe({ channel: 'positions', instType: 'ANY',}); // Position events on specific instrumentswsClient.subscribe({ channel: 'positions', instType: 'SWAP', instFamily: 'ETH-USD', instId: 'ETH-USD-SWAP',}); // Balance & position channelwsClient.subscribe({ channel: 'balance_and_position',}); // Order channelwsClient.subscribe({ channel: 'orders', instType: 'ANY',}); // Order channel with extra argswsClient.subscribe({ channel: 'orders', instType: 'FUTURES', instFamily: 'BTC-USD',}); // Algo orders channelwsClient.subscribe({ channel: 'orders-algo', instType: 'ANY',}); // Advance algo orders channelwsClient.subscribe({ channel: 'algo-advance', instType: 'ANY',}); // Position risk warning channelwsClient.subscribe({ channel: 'liquidation-warning', instType: 'ANY',}); // Account greeks channelwsClient.subscribe({ channel: 'account-greeks',}); // Spot grid algo orders channelwsClient.subscribe({ channel: 'grid-orders-spot', instType: 'SPOT',}); // Contract grid orders channelwsClient.subscribe({ channel: 'grid-orders-contract', instType: 'ANY',}); // Moon grid orders channelwsClient.subscribe({ channel: 'grid-orders-moon', instType: 'ANY',}); // Moon grid orders channelwsClient.subscribe({ channel: 'grid-orders-moon', instType: 'ANY',}); // Grid positions channelwsClient.subscribe({ channel: 'grid-positions', algoId: '449327675342323712',}); // Grid sub orders channelwsClient.subscribe({ channel: 'grid-sub-orders', algoId: '449327675342323712',});WebSocket API walkthrough
OKX's WebSocket API (WS-API) is a powerful tool to send commands over a persisted and pre-authenticated WebSocket connection, allowing for lower latency interactions with the exchange compared to REST API calls.
The WS-API supports a wide range of commands, including order submission and cancellation, making it ideal for latency sensitive integrations.
To use the WebSocket API:
- Import the dedicated WebsocketAPIClient (a specialised wrapper around the WebsocketClient)
- Create an instance of the WebsocketAPIClient with credentials.
- Call the dedicated functions to send WS-API commands and await the responses.
Note that:
- Authentication is automatic.
- Connectivity is persistent with automatic failover.
- All WS-API commands are wrapped in promises, allowing you to await individual Websocket API commands as if it were a REST API call.
import { DefaultLogger, WebsocketAPIClient } from 'okx-api'; // function attachEventHandlers<TWSClient extends WebsocketClient>(// wsClient: TWSClient,// ): void {// wsClient.on('update', (data) => {// console.log('raw message received ', JSON.stringify(data));// });// wsClient.on('open', (data) => {// console.log('ws connected', data.wsKey);// });// wsClient.on('reconnect', ({ wsKey }) => {// console.log('ws automatically reconnecting.... ', wsKey);// });// wsClient.on('reconnected', (data) => {// console.log('ws has reconnected ', data?.wsKey);// });// wsClient.on('authenticated', (data) => {// console.log('ws has authenticated ', data?.wsKey);// });// } (async () => { const logger = { ...DefaultLogger, trace: (...params: any[]) => console.log('trace', ...params), }; // For private events, all 3 of the following are required (per account): const API_KEY = process.env.API_KEY_COM; const API_SECRET = process.env.API_SECRET_COM; const API_PASSPHRASE = process.env.API_PASSPHRASE_COM; // If running from CLI in unix, you can pass env vars as such: // API_KEY_COM='lkm12n3-2ba3-1mxf-fn13-lkm12n3a' API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts const wsClient = new WebsocketAPIClient( { // For Global users (www.okx.com), you don't need to set the market. // It will use global by default. // Not needed: market: 'GLOBAL', // For EEA users (my.okx.com), set market to "EEA": // market: 'EEA', // For US users (app.okx.com), set market to "US": // market: 'US', accounts: [ // For private topics, include one or more accounts in an array. Otherwise only public topics will work { apiKey: API_KEY || '', apiSecret: API_SECRET || '', apiPass: API_PASSPHRASE || '', }, ], }, logger, ); // Optional, see above "attachEventListeners". Attach basic event handlers, so nothing is left unhandled // attachEventHandlers(wsClient.getWSClient()); // Optional: prepare the WebSocket API connection in advance. // This happens automatically but you can do this early before making any API calls, to prevent delays from a cold start. // await wsClient.connectWSAPI(); /** * OKX's WebSocket API be used like a REST API, through this SDK's WebsocketAPIClient. The WebsocketAPIClient is a utility class wrapped around WebsocketClient's sendWSAPIRequest() capabilities. * * Each request sent via the WebsocketAPIClient will automatically: * - route via the active WS API connection * - return a Promise, which automatically resolves/rejects when a matching response is received */ /** * Place Order * https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-place-order */ try { const res = await wsClient.submitNewOrder({ instId: 'BTC-USDT', tdMode: 'cash', side: 'buy', ordType: 'market', sz: '100', }); /** const res = { id: '2', op: 'order', code: '1', msg: '', data: [ { tag: '159881cb7207BCDE', ts: '1753714603721', ordId: '', clOrdId: '', sCode: '51008', sMsg: 'Order failed. Insufficient USDT balance in account.' } ], inTime: '1753714603720755', outTime: '1753714603721942', wsKey: 'prodPrivate', isWSAPIResponse: false } const res = { id: '2', op: 'order', code: '1', msg: '', data: [ { tag: '159881cb7207BCDE', ts: '1753714567149', ordId: '', clOrdId: '', sCode: '51010', sMsg: "You can't complete this request under your current account mode." } ], inTime: '1753714567149196', outTime: '1753714567149913', wsKey: 'prodPrivate', isWSAPIResponse: false } */ console.log(new Date(), 'WS API "submitNewOrder()" result: ', res); } catch (e) { console.error(new Date(), 'Exception with WS API "submitNewOrder()": ', e); } /** * Submit multiple orders in a batch * https://www.okx.com/docs-v5/en/#order-book-trading-trade-ws-place-multiple-orders */ try { const res = await wsClient.submitMultipleOrders([ { instId: 'BTC-USDT', tdMode: 'cash', side: 'buy', ordType: 'market', sz: '100', }, { instId: 'BTC-USDT', tdMode: 'cash', side: 'buy', ordType: 'market', sz: '50', }, ]); console.log(new Date(), 'WS API "submitMultipleOrders()" result: ', res); } catch (e) { console.error( new Date(), 'Exception with WS API "submitMultipleOrders()": ', e, ); } console.log(new Date(), 'Reached end of example.');})();Common OKX implementation tasks
Start from the behavior you need, not just from REST or WebSocket as a transport. Market-data driven systems should be event driven. Backfill via the REST API once and let WebSockets passively stream new data to you, as it becomes available.
REST API hydration or backfill
Start from the REST API quickstart and endpoint reference, then normalize exchange-specific IDs, timestamps, symbols, and product scope.
Open endpoint referenceWebSocket consumer
Start from the WebSocket quickstart that matches the task boundary, verify subscription acknowledgement semantics, and keep reconnect handling explicit.
Open WebSocket quickstartAgent prompt recipe
Use the AI prompt generator when the task combines REST API hydration, live streams, in-memory state, operational outputs, or strategy code.
Build an agent promptFor coding agents
Give these files to an agent before implementation so it can find the package, examples, task guidance, and safety rules from the normal SDK-page flow.
AI prompt framework
Prompt generator and task recipes for exchange API projects.
llms.txt
Compact discovery file for agents choosing where to start.
llms-full.txt
Full route and implementation guidance index for machine readers.
SDK catalog
Machine-readable package, docs, examples, and task guidance.
Agent skill
Reusable workflow rules for coding agents using exchange APIs.
Endpoint Function Reference
Endpoint maps
Each REST client is a JavaScript class, which provides functions individually mapped to each endpoint available in the exchange's API offering.
The following table shows all methods available in each REST client, whether the method requires authentication (automatically handled if API keys are provided), as well as the exact endpoint each method is connected to.
This can be used to easily find which method to call, once you have found which endpoint you're looking to use.
All REST clients are in the src folder. For usage examples, make sure to check the examples folder.
List of clients:
If anything is missing or wrong, please open an issue or let us know in our Node.js Traders telegram group!
How to use table
Table consists of 4 parts:
- Function name
- AUTH
- HTTP Method
- Endpoint
Function name is the name of the function that can be called through the SDK. Check examples folder in the repo for more help on how to use them!
AUTH is a boolean value that indicates if the function requires authentication - which means you need to pass your API key and secret to the SDK.
HTTP Method shows HTTP method that the function uses to call the endpoint. Sometimes endpoints can have same URL, but different HTTP method so you can use this column to differentiate between them.
Endpoint is the URL that the function uses to call the endpoint. Best way to find exact function you need for the endpoint is to search for URL in this table and find corresponding function name.
rest-client.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in rest-client.ts.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| getAccountInstruments() | 🔐 | GET | /api/v5/account/instruments |
| getBalance() | 🔐 | GET | /api/v5/account/balance |
| getPositions() | 🔐 | GET | /api/v5/account/positions |
| getPositionsHistory() | 🔐 | GET | /api/v5/account/positions-history |
| getAccountPositionRisk() | 🔐 | GET | /api/v5/account/account-position-risk |
| getBills() | 🔐 | GET | /api/v5/account/bills |
| getBillsArchive() | 🔐 | GET | /api/v5/account/bills-archive |
| getAccountBillSubtypes() | 🔐 | GET | /api/v5/account/subtypes |
| requestBillsHistoryDownloadLink() | 🔐 | POST | /api/v5/account/bills-history-archive |
| getRequestedBillsHistoryLink() | 🔐 | GET | /api/v5/account/bills-history-archive |
| getAccountConfiguration() | 🔐 | GET | /api/v5/account/config |
| setPositionMode() | 🔐 | POST | /api/v5/account/set-position-mode |
| setSettleCurrency() | 🔐 | POST | /api/v5/account/set-settle-currency |
| setFeeType() | 🔐 | POST | /api/v5/account/set-fee-type |
| setLeverage() | 🔐 | POST | /api/v5/account/set-leverage |
| getMaxBuySellAmount() | 🔐 | GET | /api/v5/account/max-size |
| getMaxAvailableTradableAmount() | 🔐 | GET | /api/v5/account/max-avail-size |
| changePositionMargin() | 🔐 | POST | /api/v5/account/position/margin-balance |
| movePositions() | 🔐 | POST | /api/v5/account/move-positions |
| getMovePositionsHistory() | 🔐 | GET | /api/v5/account/move-positions-history |
| getLeverage() | 🔐 | GET | /api/v5/account/leverage-info |
| getLeverageV2() | 🔐 | GET | /api/v5/account/leverage-info |
| getLeverageEstimatedInfo() | 🔐 | GET | /api/v5/account/adjust-leverage-info |
| getMaxLoan() | 🔐 | GET | /api/v5/account/max-loan |
| getFeeRates() | 🔐 | GET | /api/v5/account/trade-fee |
| getInterestAccrued() | 🔐 | GET | /api/v5/account/interest-accrued |
| getInterestRate() | 🔐 | GET | /api/v5/account/interest-rate |
| setGreeksDisplayType() | 🔐 | POST | /api/v5/account/set-greeks |
| setIsolatedMode() | 🔐 | POST | /api/v5/account/set-isolated-mode |
| getMaxWithdrawals() | 🔐 | GET | /api/v5/account/max-withdrawal |
| getAccountRiskState() | 🔐 | GET | /api/v5/account/risk-state |
| setAccountCollateralAssets() | 🔐 | POST | /api/v5/account/set-collateral-assets |
| getAccountCollateralAssets() | 🔐 | GET | /api/v5/account/collateral-assets |
| submitQuickMarginBorrowRepay() | 🔐 | POST | /api/v5/account/quick-margin-borrow-repay |
| getQuickMarginBorrowRepayHistory() | 🔐 | GET | /api/v5/account/quick-margin-borrow-repay-history |
| borrowRepayVIPLoan() | 🔐 | POST | /api/v5/account/borrow-repay |
| getVIPLoanBorrowRepayHistory() | 🔐 | GET | /api/v5/account/borrow-repay-history |
| getVIPInterestAccrued() | 🔐 | GET | /api/v5/account/vip-interest-accrued |
| getVIPInterestDeducted() | 🔐 | GET | /api/v5/account/vip-interest-deducted |
| getVIPLoanOrders() | 🔐 | GET | /api/v5/account/vip-loan-order-list |
| getVIPLoanOrder() | 🔐 | GET | /api/v5/account/vip-loan-order-detail |
| getBorrowInterestLimits() | 🔐 | GET | /api/v5/account/interest-limits |
| getFixedLoanBorrowLimit() | 🔐 | GET | /api/v5/account/fixed-loan/borrowing-limit |
| getFixedLoanBorrowQuote() | 🔐 | GET | /api/v5/account/fixed-loan/borrowing-quote |
| submitFixedLoanBorrowOrder() | 🔐 | POST | /api/v5/account/fixed-loan/borrowing-order |
| updateFixedLoanBorrowOrder() | 🔐 | POST | /api/v5/account/fixed-loan/amend-borrowing-order |
| manualRenewFixedLoanBorrowOrder() | 🔐 | POST | /api/v5/account/fixed-loan/manual-reborrow |
| repayFixedLoanBorrowOrder() | 🔐 | POST | /api/v5/account/fixed-loan/repay-borrowing-order |
| convertFixedLoanToMarketLoan() | 🔐 | POST | /api/v5/account/fixed-loan/convert-to-market-loan |
| reduceFixedLoanLiabilities() | 🔐 | POST | /api/v5/account/fixed-loan/reduce-liabilities |
| getFixedLoanBorrowOrders() | 🔐 | GET | /api/v5/account/fixed-loan/borrowing-orders-list |
| manualBorrowRepay() | 🔐 | POST | /api/v5/account/spot-manual-borrow-repay |
| setAutoRepay() | 🔐 | POST | /api/v5/account/set-auto-repay |
| getBorrowRepayHistory() | 🔐 | GET | /api/v5/account/spot-borrow-repay-history |
| positionBuilder() | 🔐 | POST | /api/v5/account/position-builder |
| updateRiskOffsetAmount() | 🔐 | POST | /api/v5/account/set-riskOffset-amt |
| getGreeks() | 🔐 | GET | /api/v5/account/greeks |
| getPMLimitation() | 🔐 | GET | /api/v5/account/position-tiers |
| updateRiskOffsetType() | 🔐 | POST | /api/v5/account/set-riskOffset-type |
| activateOption() | 🔐 | POST | /api/v5/account/activate-option |
| setAutoLoan() | 🔐 | POST | /api/v5/account/set-auto-loan |
| presetAccountLevelSwitch() | 🔐 | POST | /api/v5/account/account-level-switch-preset |
| getAccountSwitchPrecheck() | 🔐 | GET | /api/v5/account/set-account-switch-precheck |
| setAccountMode() | 🔐 | POST | /api/v5/account/set-account-level |
| resetMMPStatus() | 🔐 | POST | /api/v5/account/mmp-reset |
| setMMPConfig() | 🔐 | POST | /api/v5/account/mmp-config |
| getMMPConfig() | 🔐 | GET | /api/v5/account/mmp-config |
| setTradingConfig() | 🔐 | POST | /api/v5/account/set-trading-config |
| precheckSetDeltaNeutral() | 🔐 | GET | /api/v5/account/precheck-set-delta-neutral |
| submitOrder() | 🔐 | POST | /api/v5/trade/order |
| submitMultipleOrders() | 🔐 | POST | /api/v5/trade/batch-orders |
| cancelOrder() | 🔐 | POST | /api/v5/trade/cancel-order |
| cancelMultipleOrders() | 🔐 | POST | /api/v5/trade/cancel-batch-orders |
| amendOrder() | 🔐 | POST | /api/v5/trade/amend-order |
| amendMultipleOrders() | 🔐 | POST | /api/v5/trade/amend-batch-orders |
| closePositions() | 🔐 | POST | /api/v5/trade/close-position |
| getOrderDetails() | 🔐 | GET | /api/v5/trade/order |
| getOrderList() | 🔐 | GET | /api/v5/trade/orders-pending |
| getOrderHistory() | 🔐 | GET | /api/v5/trade/orders-history |
| getOrderHistoryArchive() | 🔐 | GET | /api/v5/trade/orders-history-archive |
| getFills() | 🔐 | GET | /api/v5/trade/fills |
| getFillsHistory() | 🔐 | GET | /api/v5/trade/fills-history |
| getEasyConvertCurrencies() | 🔐 | GET | /api/v5/trade/easy-convert-currency-list |
| submitEasyConvert() | 🔐 | POST | /api/v5/trade/easy-convert |
| getEasyConvertHistory() | 🔐 | GET | /api/v5/trade/easy-convert-history |
| getOneClickRepayCurrencyList() | 🔐 | GET | /api/v5/trade/one-click-repay-currency-list |
| submitOneClickRepay() | 🔐 | POST | /api/v5/trade/one-click-repay |
| getOneClickRepayHistory() | 🔐 | GET | /api/v5/trade/one-click-repay-history |
| cancelMassOrder() | 🔐 | POST | /api/v5/trade/mass-cancel |
| cancelAllAfter() | 🔐 | POST | /api/v5/trade/cancel-all-after |
| getAccountRateLimit() | 🔐 | GET | /api/v5/trade/account-rate-limit |
| submitOrderPrecheck() | 🔐 | POST | /api/v5/trade/order-precheck |
| placeAlgoOrder() | 🔐 | POST | /api/v5/trade/order-algo |
| cancelAlgoOrder() | 🔐 | POST | /api/v5/trade/cancel-algos |
| amendAlgoOrder() | 🔐 | POST | /api/v5/trade/amend-algos |
| cancelAdvanceAlgoOrder() | 🔐 | POST | /api/v5/trade/cancel-advance-algos |
| getAlgoOrderDetails() | 🔐 | GET | /api/v5/trade/order-algo |
| getAlgoOrderList() | 🔐 | GET | /api/v5/trade/orders-algo-pending |
| getAlgoOrderHistory() | 🔐 | GET | /api/v5/trade/orders-algo-history |
| placeGridAlgoOrder() | 🔐 | POST | /api/v5/tradingBot/grid/order-algo |
| amendGridAlgoOrder() | 🔐 | POST | /api/v5/tradingBot/grid/amend-order-algo |
| stopGridAlgoOrder() | 🔐 | POST | /api/v5/tradingBot/grid/stop-order-algo |
| closeGridContractPosition() | 🔐 | POST | /api/v5/tradingBot/grid/close-position |
| cancelGridContractCloseOrder() | 🔐 | POST | /api/v5/tradingBot/grid/cancel-close-order |
| instantTriggerGridAlgoOrder() | 🔐 | POST | /api/v5/tradingBot/grid/order-instant-trigger |
| getGridAlgoOrderList() | 🔐 | GET | /api/v5/tradingBot/grid/orders-algo-pending |
| getGridAlgoOrderHistory() | 🔐 | GET | /api/v5/tradingBot/grid/orders-algo-history |
| getGridAlgoOrderDetails() | 🔐 | GET | /api/v5/tradingBot/grid/orders-algo-details |
| getGridAlgoSubOrders() | 🔐 | GET | /api/v5/tradingBot/grid/sub-orders |
| getGridAlgoOrderPositions() | 🔐 | GET | /api/v5/tradingBot/grid/positions |
| spotGridWithdrawIncome() | 🔐 | POST | /api/v5/tradingBot/grid/withdraw-income |
| computeGridMarginBalance() | 🔐 | POST | /api/v5/tradingBot/grid/compute-margin-balance |
| adjustGridMarginBalance() | 🔐 | POST | /api/v5/tradingBot/grid/margin-balance |
| adjustGridInvestment() | 🔐 | POST | /api/v5/tradingBot/grid/adjust-investment |
| getGridAIParameter() | GET | /api/v5/tradingBot/grid/ai-param | |
| computeGridMinInvestment() | POST | /api/v5/tradingBot/grid/min-investment | |
| getRSIBackTesting() | GET | /api/v5/tradingBot/public/rsi-back-testing | |
| getMaxGridQuantity() | GET | /api/v5/tradingBot/grid/grid-quantity | |
| createSignal() | 🔐 | POST | /api/v5/tradingBot/signal/create-signal |
| getSignals() | 🔐 | GET | /api/v5/tradingBot/signal/signals |
| createSignalBot() | 🔐 | POST | /api/v5/tradingBot/signal/order-algo |
| cancelSignalBots() | 🔐 | POST | /api/v5/tradingBot/signal/stop-order-algo |
| updateSignalMargin() | 🔐 | POST | /api/v5/tradingBot/signal/margin-balance |
| updateSignalTPSL() | 🔐 | POST | /api/v5/tradingBot/signal/amendTPSL |
| setSignalInstruments() | 🔐 | POST | /api/v5/tradingBot/signal/set-instruments |
| getSignalBotOrder() | 🔐 | GET | /api/v5/tradingBot/signal/orders-algo-details |
| getActiveSignalBot() | 🔐 | GET | /api/v5/tradingBot/signal/orders-algo-details |
| getSignalBotHistory() | 🔐 | GET | /api/v5/tradingBot/signal/orders-algo-history |
| getSignalBotPositions() | 🔐 | GET | /api/v5/tradingBot/signal/positions |
| getSignalBotPositionHistory() | 🔐 | GET | /api/v5/tradingBot/signal/positions-history |
| closeSignalBotPosition() | 🔐 | POST | /api/v5/tradingBot/signal/close-position |
| placeSignalBotSubOrder() | 🔐 | POST | /api/v5/tradingBot/signal/sub-order |
| cancelSubOrder() | 🔐 | POST | /api/v5/tradingBot/signal/cancel-sub-order |
| getSignalBotSubOrders() | 🔐 | GET | /api/v5/tradingBot/signal/sub-orders |
| getSignalBotEventHistory() | 🔐 | GET | /api/v5/tradingBot/signal/event-history |
| submitRecurringBuyOrder() | 🔐 | POST | /api/v5/tradingBot/recurring/order-algo |
| amendRecurringBuyOrder() | 🔐 | POST | /api/v5/tradingBot/recurring/amend-order-algo |
| stopRecurringBuyOrder() | 🔐 | POST | /api/v5/tradingBot/recurring/stop-order-algo |
| getRecurringBuyOrders() | 🔐 | GET | /api/v5/tradingBot/recurring/orders-algo-pending |
| getRecurringBuyOrderHistory() | 🔐 | GET | /api/v5/tradingBot/recurring/orders-algo-history |
| getRecurringBuyOrderDetails() | 🔐 | GET | /api/v5/tradingBot/recurring/orders-algo-details |
| getRecurringBuySubOrders() | 🔐 | GET | /api/v5/tradingBot/recurring/sub-orders |
| getCopytradingSubpositions() | 🔐 | GET | /api/v5/copytrading/current-subpositions |
| getCopytradingSubpositionsHistory() | 🔐 | GET | /api/v5/copytrading/subpositions-history |
| submitCopytradingAlgoOrder() | 🔐 | POST | /api/v5/copytrading/algo-order |
| closeCopytradingSubposition() | 🔐 | POST | /api/v5/copytrading/close-subposition |
| getCopytradingInstruments() | 🔐 | GET | /api/v5/copytrading/instruments |
| setCopytradingInstruments() | 🔐 | POST | /api/v5/copytrading/set-instruments |
| getCopytradingProfitDetails() | 🔐 | GET | /api/v5/copytrading/profit-sharing-details |
| getCopytradingTotalProfit() | 🔐 | GET | /api/v5/copytrading/total-profit-sharing |
| getCopytradingUnrealizedProfit() | 🔐 | GET | /api/v5/copytrading/unrealized-profit-sharing-details |
| getCopytradingTotalUnrealizedProfit() | 🔐 | GET | /api/v5/copytrading/total-unrealized-profit-sharing |
| applyCopytradingLeadTrading() | 🔐 | POST | /api/v5/copytrading/apply-lead-trading |
| stopCopytradingLeadTrading() | 🔐 | POST | /api/v5/copytrading/stop-lead-trading |
| updateCopytradingProfitSharing() | 🔐 | POST | /api/v5/copytrading/amend-profit-sharing-ratio |
| getCopytradingAccount() | 🔐 | GET | /api/v5/copytrading/config |
| setCopytradingFirstCopy() | 🔐 | POST | /api/v5/copytrading/first-copy-settings |
| updateCopytradingCopySettings() | 🔐 | POST | /api/v5/copytrading/amend-copy-settings |
| stopCopytradingCopy() | 🔐 | POST | /api/v5/copytrading/stop-copy-trading |
| getCopytradingCopySettings() | 🔐 | GET | /api/v5/copytrading/copy-settings |
| getCopytradingBatchLeverageInfo() | 🔐 | GET | /api/v5/copytrading/batch-leverage-info |
| setCopytradingBatchLeverage() | 🔐 | POST | /api/v5/copytrading/batch-set-leverage |
| getCopytradingMyLeadTraders() | 🔐 | GET | /api/v5/copytrading/current-lead-traders |
| getCopytradingLeadTradersHistory() | 🔐 | GET | /api/v5/copytrading/lead-traders-history |
| getCopytradingConfig() | GET | /api/v5/copytrading/public-config | |
| getCopytradingLeadRanks() | GET | /api/v5/copytrading/public-lead-traders | |
| getCopytradingLeadWeeklyPnl() | GET | /api/v5/copytrading/public-weekly-pnl | |
| getCopytradingLeadDailyPnl() | GET | /api/v5/copytrading/public-pnl | |
| getCopytradingLeadStats() | GET | /api/v5/copytrading/public-stats | |
| getCopytradingLeadPreferences() | GET | /api/v5/copytrading/public-preference-currency | |
| getCopytradingLeadOpenPositions() | GET | /api/v5/copytrading/public-current-subpositions | |
| getCopytradingLeadPositionHistory() | GET | /api/v5/copytrading/public-subpositions-history | |
| getCopyTraders() | GET | /api/v5/copytrading/public-copy-traders | |
| getCopytradingLeadPrivateRanks() | 🔐 | GET | /api/v5/copytrading/lead-traders |
| getCopytradingLeadPrivateWeeklyPnl() | 🔐 | GET | /api/v5/copytrading/weekly-pnl |
| getCopytradingPLeadPrivateDailyPnl() | 🔐 | GET | /api/v5/copytrading/pnl |
| geCopytradingLeadPrivateStats() | 🔐 | GET | /api/v5/copytrading/stats |
| getCopytradingLeadPrivatePreferences() | 🔐 | GET | /api/v5/copytrading/preference-currency |
| getCopytradingLeadPrivateOpenPositions() | 🔐 | GET | /api/v5/copytrading/performance-current-subpositions |
| getCopytradingLeadPrivatePositionHistory() | 🔐 | GET | /api/v5/copytrading/performance-subpositions-history |
| getCopyTradersPrivate() | 🔐 | GET | /api/v5/copytrading/copy-traders |
| getTickers() | GET | /api/v5/market/tickers | |
| getTicker() | GET | /api/v5/market/ticker | |
| getOrderBook() | GET | /api/v5/market/books | |
| getFullOrderBook() | GET | /api/v5/market/books-full | |
| getCandles() | GET | /api/v5/market/candles | |
| getHistoricCandles() | GET | /api/v5/market/history-candles | |
| getTrades() | GET | /api/v5/market/trades | |
| getHistoricTrades() | GET | /api/v5/market/history-trades | |
| getOptionTradesByInstrument() | GET | /api/v5/market/option/instrument-family-trades | |
| getOptionTrades() | GET | /api/v5/public/option-trades | |
| get24hrTotalVolume() | GET | /api/v5/market/platform-24-volume | |
| getBlockCounterParties() | 🔐 | GET | /api/v5/rfq/counterparties |
| createBlockRFQ() | 🔐 | POST | /api/v5/rfq/create-rfq |
| cancelBlockRFQ() | 🔐 | POST | /api/v5/rfq/cancel-rfq |
| cancelMultipleBlockRFQs() | 🔐 | POST | /api/v5/rfq/cancel-batch-rfqs |
| cancelAllRFQs() | 🔐 | POST | /api/v5/rfq/cancel-all-rfqs |
| executeBlockQuote() | 🔐 | POST | /api/v5/rfq/execute-quote |
| getQuoteProducts() | 🔐 | GET | /api/v5/rfq/maker-instrument-settings |
| updateBlockQuoteProducts() | 🔐 | POST | /api/v5/rfq/maker-instrument-settings |
| resetBlockMmp() | 🔐 | POST | /api/v5/rfq/mmp-reset |
| updateBlockMmpConfig() | 🔐 | POST | /api/v5/rfq/mmp-config |
| getBlockMmpConfig() | 🔐 | GET | /api/v5/rfq/mmp-config |
| createBlockQuote() | 🔐 | POST | /api/v5/rfq/create-quote |
| cancelBlockQuote() | 🔐 | POST | /api/v5/rfq/cancel-quote |
| cancelMultipleBlockQuotes() | 🔐 | POST | /api/v5/rfq/cancel-batch-quotes |
| cancelAllBlockQuotes() | 🔐 | POST | /api/v5/rfq/cancel-all-quotes |
| cancelAllBlockAfter() | 🔐 | POST | /api/v5/rfq/cancel-all-after |
| getBlockRFQs() | 🔐 | GET | /api/v5/rfq/rfqs |
| getBlockQuotes() | 🔐 | GET | /api/v5/rfq/quotes |
| getBlockTrades() | 🔐 | GET | /api/v5/rfq/trades |
| getPublicRFQBlockTrades() | GET | /api/v5/rfq/public-trades | |
| getBlockTickers() | GET | /api/v5/market/block-tickers | |
| getBlockTicker() | GET | /api/v5/market/block-ticker | |
| getBlockPublicTrades() | GET | /api/v5/public/block-trades | |
| submitSpreadOrder() | 🔐 | POST | /api/v5/sprd/order |
| cancelSpreadOrder() | 🔐 | POST | /api/v5/sprd/cancel-order |
| cancelAllSpreadOrders() | 🔐 | POST | /api/v5/sprd/mass-cancel |
| updateSpreadOrder() | 🔐 | POST | /api/v5/sprd/amend-order |
| getSpreadOrder() | 🔐 | GET | /api/v5/sprd/order |
| getSpreadActiveOrders() | 🔐 | GET | /api/v5/sprd/orders-pending |
| getSpreadOrdersRecent() | 🔐 | GET | /api/v5/sprd/orders-history |
| getSpreadOrdersArchive() | 🔐 | GET | /api/v5/sprd/orders-history-archive |
| getSpreadTrades() | 🔐 | GET | /api/v5/sprd/trades |
| getSpreads() | GET | /api/v5/sprd/spreads | |
| getSpreadOrderBook() | GET | /api/v5/sprd/books | |
| getSpreadTicker() | GET | /api/v5/market/sprd-ticker | |
| getSpreadPublicTrades() | GET | /api/v5/sprd/public-trades | |
| getSpreadCandles() | GET | /api/v5/market/sprd-candles | |
| getSpreadHistoryCandles() | GET | /api/v5/market/sprd-history-candles | |
| cancelSpreadAllAfter() | 🔐 | POST | /api/v5/sprd/cancel-all-after |
| getInstruments() | GET | /api/v5/public/instruments | |
| getEventContractSeries() | GET | /api/v5/public/event-contract/series | |
| getEventContractEvents() | GET | /api/v5/public/event-contract/events | |
| getEventContractMarkets() | GET | /api/v5/public/event-contract/markets | |
| getDeliveryExerciseHistory() | GET | /api/v5/public/delivery-exercise-history | |
| getOpenInterest() | GET | /api/v5/public/open-interest | |
| getFundingRate() | GET | /api/v5/public/funding-rate | |
| getFundingRateHistory() | GET | /api/v5/public/funding-rate-history | |
| getMinMaxLimitPrice() | GET | /api/v5/public/price-limit | |
| getOptionMarketData() | GET | /api/v5/public/opt-summary | |
| getEstimatedDeliveryExercisePrice() | GET | /api/v5/public/estimated-price | |
| getDiscountRateAndInterestFreeQuota() | GET | /api/v5/public/discount-rate-interest-free-quota | |
| getSystemTime() | GET | /api/v5/public/time | |
| getHistoricalMarketData() | GET | /api/v5/public/market-data-history | |
| getMarkPrice() | GET | /api/v5/public/mark-price | |
| getPositionTiers() | GET | /api/v5/public/position-tiers | |
| getInterestRateAndLoanQuota() | GET | /api/v5/public/interest-rate-loan-quota | |
| getVIPInterestRateAndLoanQuota() | GET | /api/v5/public/vip-interest-rate-loan-quota | |
| getUnderlying() | GET | /api/v5/public/underlying | |
| getInsuranceFund() | GET | /api/v5/public/insurance-fund | |
| getUnitConvert() | GET | /api/v5/public/convert-contract-coin | |
| getOptionTickBands() | GET | /api/v5/public/instrument-tick-bands | |
| getPremiumHistory() | GET | /api/v5/public/premium-history | |
| getIndexTickers() | GET | /api/v5/market/index-tickers | |
| getIndexCandles() | GET | /api/v5/market/index-candles | |
| getHistoricIndexCandles() | GET | /api/v5/market/history-index-candles | |
| getMarkPriceCandles() | GET | /api/v5/market/mark-price-candles | |
| getHistoricMarkPriceCandles() | GET | /api/v5/market/history-mark-price-candles | |
| getOracle() | GET | /api/v5/market/open-oracle | |
| getExchangeRate() | GET | /api/v5/market/exchange-rate | |
| getIndexComponents() | GET | /api/v5/market/index-components | |
| getEconomicCalendar() | 🔐 | GET | /api/v5/public/economic-calendar |
| getPublicBlockTrades() | GET | /api/v5/market/block-trades | |
| getSupportCoin() | GET | /api/v5/rubik/stat/trading-data/support-coin | |
| getOpenInterestHistory() | GET | /api/v5/rubik/stat/contracts/open-interest-history | |
| getTakerVolume() | GET | /api/v5/rubik/stat/taker-volume | |
| getContractTakerVolume() | GET | /api/v5/rubik/stat/taker-volume-contract | |
| getMarginLendingRatio() | GET | /api/v5/rubik/stat/margin/loan-ratio | |
| getTopTradersAccountRatio() | GET | /api/v5/rubik/stat/contracts/long-short-account-ratio-contract-top-trader | |
| getTopTradersContractPositionRatio() | GET | /api/v5/rubik/stat/contracts/long-short-position-ratio-contract-top-trader | |
| getLongShortContractRatio() | GET | /api/v5/rubik/stat/contracts/long-short-account-ratio-contract | |
| getLongShortRatio() | GET | /api/v5/rubik/stat/contracts/long-short-account-ratio | |
| getContractsOpenInterestAndVolume() | GET | /api/v5/rubik/stat/contracts/open-interest-volume | |
| getOptionsOpenInterestAndVolume() | GET | /api/v5/rubik/stat/option/open-interest-volume | |
| getPutCallRatio() | GET | /api/v5/rubik/stat/option/open-interest-volume-ratio | |
| getOpenInterestAndVolumeExpiry() | GET | /api/v5/rubik/stat/option/open-interest-volume-expiry | |
| getOpenInterestAndVolumeStrike() | GET | /api/v5/rubik/stat/option/open-interest-volume-strike | |
| getTakerFlow() | GET | /api/v5/rubik/stat/option/taker-block-volume | |
| getCurrencies() | 🔐 | GET | /api/v5/asset/currencies |
| getBalances() | 🔐 | GET | /api/v5/asset/balances |
| getNonTradableAssets() | 🔐 | GET | /api/v5/asset/non-tradable-assets |
| getAccountAssetValuation() | 🔐 | GET | /api/v5/asset/asset-valuation |
| fundsTransfer() | 🔐 | POST | /api/v5/asset/transfer |
| getFundsTransferState() | 🔐 | GET | /api/v5/asset/transfer-state |
| getAssetBillsDetails() | 🔐 | GET | /api/v5/asset/bills |
| getAssetBillsHistoric() | 🔐 | GET | /api/v5/asset/bills-history |
| getLightningDeposits() | 🔐 | GET | /api/v5/asset/deposit-lightning |
| getDepositAddress() | 🔐 | GET | /api/v5/asset/deposit-address |
| getDepositHistory() | 🔐 | GET | /api/v5/asset/deposit-history |
| submitWithdraw() | 🔐 | POST | /api/v5/asset/withdrawal |
| submitWithdrawLightning() | 🔐 | POST | /api/v5/asset/withdrawal-lightning |
| cancelWithdrawal() | 🔐 | POST | /api/v5/asset/cancel-withdrawal |
| getWithdrawalHistory() | 🔐 | GET | /api/v5/asset/withdrawal-history |
| getDepositWithdrawStatus() | 🔐 | GET | /api/v5/asset/deposit-withdraw-status |
| getExchanges() | GET | /api/v5/asset/exchange-list | |
| applyForMonthlyStatement() | 🔐 | POST | /api/v5/asset/monthly-statement |
| getMonthlyStatement() | 🔐 | GET | /api/v5/asset/monthly-statement |
| getConvertCurrencies() | 🔐 | GET | /api/v5/asset/convert/currencies |
| getConvertCurrencyPair() | 🔐 | GET | /api/v5/asset/convert/currency-pair |
| estimateConvertQuote() | 🔐 | POST | /api/v5/asset/convert/estimate-quote |
| convertTrade() | 🔐 | POST | /api/v5/asset/convert/trade |
| getConvertHistory() | 🔐 | GET | /api/v5/asset/convert/history |
| getSubAccountList() | 🔐 | GET | /api/v5/users/subaccount/list |
| resetSubAccountAPIKey() | 🔐 | POST | /api/v5/users/subaccount/modify-apikey |
| getSubAccountBalances() | 🔐 | GET | /api/v5/account/subaccount/balances |
| getSubAccountFundingBalances() | 🔐 | GET | /api/v5/asset/subaccount/balances |
| getSubAccountMaxWithdrawal() | 🔐 | GET | /api/v5/account/subaccount/max-withdrawal |
| getSubAccountTransferHistory() | 🔐 | GET | /api/v5/asset/subaccount/bills |
| getManagedSubAccountTransferHistory() | 🔐 | GET | /api/v5/asset/subaccount/managed-subaccount-bills |
| transferSubAccountBalance() | 🔐 | POST | /api/v5/asset/subaccount/transfer |
| setSubAccountTransferOutPermission() | 🔐 | POST | /api/v5/users/subaccount/set-transfer-out |
| getSubAccountCustodyTradingList() | 🔐 | GET | /api/v5/users/entrust-subaccount-list |
| setSubAccountLoanAllocation() | 🔐 | POST | /api/v5/account/subaccount/set-loan-allocation |
| getSubAccountBorrowInterestAndLimit() | 🔐 | GET | /api/v5/account/subaccount/interest-limits |
| getStakingOffers() | 🔐 | GET | /api/v5/finance/staking-defi/offers |
| submitStake() | 🔐 | POST | /api/v5/finance/staking-defi/purchase |
| redeemStake() | 🔐 | POST | /api/v5/finance/staking-defi/redeem |
| cancelStakingRequest() | 🔐 | POST | /api/v5/finance/staking-defi/cancel |
| getActiveStakingOrders() | 🔐 | GET | /api/v5/finance/staking-defi/orders-active |
| getStakingOrderHistory() | 🔐 | GET | /api/v5/finance/staking-defi/orders-history |
| getETHStakingProductInfo() | GET | /api/v5/finance/staking-defi/eth/product-info | |
| getSOLStakingProductInfo() | GET | /api/v5/finance/staking-defi/sol/product-info | |
| purchaseETHStaking() | 🔐 | POST | /api/v5/finance/staking-defi/eth/purchase |
| redeemETHStaking() | 🔐 | POST | /api/v5/finance/staking-defi/eth/redeem |
| getETHStakingBalance() | 🔐 | GET | /api/v5/finance/staking-defi/eth/balance |
| getETHStakingHistory() | 🔐 | GET | /api/v5/finance/staking-defi/eth/purchase-redeem-history |
| cancelRedeemETHStaking() | 🔐 | POST | /api/v5/finance/staking-defi/eth/cancel-redeem |
| getAPYHistory() | GET | /api/v5/finance/staking-defi/eth/apy-history | |
| getSavingBalance() | 🔐 | GET | /api/v5/finance/savings/balance |
| savingsPurchaseRedemption() | 🔐 | POST | /api/v5/finance/savings/purchase-redempt |
| setLendingRate() | 🔐 | POST | /api/v5/finance/savings/set-lending-rate |
| getLendingHistory() | 🔐 | GET | /api/v5/finance/savings/lending-history |
| getPublicBorrowInfo() | GET | /api/v5/finance/savings/lending-rate-summary | |
| getPublicBorrowHistory() | GET | /api/v5/finance/savings/lending-rate-history | |
| getLendingOffers() | GET | /api/v5/finance/fixed-loan/lending-offers | |
| getLendingAPYHistory() | GET | /api/v5/finance/fixed-loan/lending-apy-history | |
| getLendingVolume() | GET | /api/v5/finance/fixed-loan/pending-lending-volume | |
| placeLendingOrder() | 🔐 | POST | /api/v5/finance/fixed-loan/lending-order |
| amendLendingOrder() | 🔐 | POST | /api/v5/finance/fixed-loan/amend-lending-order |
| getLendingOrders() | 🔐 | GET | /api/v5/finance/fixed-loan/lending-orders-list |
| getLendingSubOrders() | 🔐 | GET | /api/v5/finance/fixed-loan/lending-sub-orders |
| getBorrowableCurrencies() | GET | /api/v5/finance/flexible-loan/borrow-currencies | |
| getCollateralAssets() | GET | /api/v5/finance/flexible-loan/collateral-assets | |
| getMaxLoanAmount() | 🔐 | POST | /api/v5/finance/flexible-loan/max-loan |
| adjustCollateral() | 🔐 | POST | /api/v5/finance/flexible-loan/adjust-collateral |
| getLoanInfo() | 🔐 | GET | /api/v5/finance/flexible-loan/loan-info |
| getLoanHistory() | 🔐 | GET | /api/v5/finance/flexible-loan/loan-history |
| getAccruedInterest() | 🔐 | GET | /api/v5/finance/flexible-loan/interest-accrued |
| getDcdCurrencyPairs() | 🔐 | GET | /api/v5/finance/sfp/dcd/currency-pair |
| getDcdProducts() | 🔐 | GET | /api/v5/finance/sfp/dcd/products |
| requestDcdQuote() | 🔐 | POST | /api/v5/finance/sfp/dcd/quote |
| submitDcdTrade() | 🔐 | POST | /api/v5/finance/sfp/dcd/trade |
| requestDcdRedeemQuote() | 🔐 | POST | /api/v5/finance/sfp/dcd/redeem-quote |
| submitDcdRedeem() | 🔐 | POST | /api/v5/finance/sfp/dcd/redeem |
| getDcdOrderStatus() | 🔐 | GET | /api/v5/finance/sfp/dcd/order-status |
| getDcdOrderHistory() | 🔐 | GET | /api/v5/finance/sfp/dcd/order-history |
| getStableRewardsProductInfo() | 🔐 | GET | /api/v5/finance/stable-rewards/product-info |
| requestStableRewardsQuote() | 🔐 | POST | /api/v5/finance/stable-rewards/quote |
| submitStableRewardsTrade() | 🔐 | POST | /api/v5/finance/stable-rewards/trade |
| getStableRewardsBalance() | 🔐 | GET | /api/v5/finance/stable-rewards/balance |
| getStableRewardsApyHistory() | GET | /api/v5/finance/stable-rewards/apy-history | |
| getStableRewardsSubscribeRedeemHistory() | 🔐 | GET | /api/v5/finance/stable-rewards/subscribe-redeem-history |
| getAffiliatePerformanceSummary() | 🔐 | GET | /api/v5/affiliate/performance/summary |
| getInviteeDetail() | 🔐 | GET | /api/v5/affiliate/invitee/detail |
| getAffiliateInviteeList() | 🔐 | GET | /api/v5/affiliate/invitee/list |
| getAffiliateLinkList() | 🔐 | GET | /api/v5/affiliate/link/list |
| getAffiliateCoInviterLinkList() | 🔐 | GET | /api/v5/affiliate/co-inviter/list |
| getAffiliateSubAffiliateList() | 🔐 | GET | /api/v5/affiliate/sub-affiliate/list |
| getAffiliateRebateInfo() | 🔐 | GET | /api/v5/users/partner/if-rebate |
| getSystemStatus() | GET | /api/v5/system/status | |
| getAnnouncements() | GET | /api/v5/support/announcements | |
| getAnnouncementTypes() | GET | /api/v5/support/announcement-types | |
| createSubAccount() | 🔐 | POST | /api/v5/broker/nd/create-subaccount |
| deleteSubAccount() | 🔐 | POST | /api/v5/broker/nd/delete-subaccount |
| createSubAccountAPIKey() | 🔐 | POST | /api/v5/broker/nd/subaccount/apikey |
websocket-api-client.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in websocket-api-client.ts.
This client provides WebSocket API endpoints which allow for faster interactions with the OKX API via a WebSocket connection.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| submitNewOrder() | 🔐 | WS | order |
| submitMultipleOrders() | 🔐 | WS | batch-orders |
| cancelOrder() | 🔐 | WS | cancel-order |
| cancelMultipleOrders() | 🔐 | WS | batch-cancel-orders |
| amendOrder() | 🔐 | WS | amend-order |
| amendMultipleOrders() | 🔐 | WS | batch-amend-orders |
| massCancelOrders() | 🔐 | WS | mass-cancel |
| submitSpreadOrder() | 🔐 | WS | sprd-order |
| amendSpreadOrder() | 🔐 | WS | sprd-amend-order |
| cancelSpreadOrder() | 🔐 | WS | sprd-cancel-order |
| massCancelSpreadOrders() | 🔐 | WS | sprd-mass-cancel |
OKX JavaScript FAQ
What does the OKX JavaScript SDK cover?
OKX supports Spot, Futures, Options, Grid, WebSockets, and WebSocket API workflows. The JavaScript guide covers the main REST and WebSocket integration patterns.
How do I authenticate private OKX API calls in JavaScript?
Install okx-api from npm & pass API credentials into the SDK client options, as shown in the OKX JavaScript examples above. The SDK handles the exchange-specific signing requirements for private requests.
Does the OKX JavaScript SDK help with WebSocket connection management?
Yes. Use the SDK WebSocket client for subscriptions, reconnect handling, and stream lifecycle management instead of building raw socket flows yourself.
When should I use the OKX WebSocket API instead of REST?
Use REST for standard request and response workflows such as account queries and order management. Use the WebSocket API flow when you want persistent low-latency interactions over a connected session.
Direct Example Files
Open the example files below for JavaScript and TypeScript-compatible request, authentication, WebSocket, and Node.js service patterns.