Gate JavaScript SDK
Use gateio-api to read Gate market data, manage orders, and consume streams from Node.js. JavaScript and TypeScript use the same clients; request and response types are included.
Choose a client
- RestClient
- Public and private REST API calls
- WebsocketClient
- Public and private WebSocket subscriptions
- WebsocketAPIClient
- Awaitable Spot and Futures order commands
Make a first public request
In a Node.js project, install the package once. The REST and WebSocket API examples below use .mjs files so Node.js can run their imports directly.
npm install gateio-api
REST walkthrough
Read public BTC_USDT Spot data with RestClient. These public requests require no credentials.
Save the code as rest-public.mjs and run:
node rest-public.mjs
import { RestClient } from 'gateio-api'; const client = new RestClient(); async function main() { try { const time = await client.getServerTime(); console.log('Server time:', time.server_time); } catch (error) { console.error('Server time request failed:', error); } try { const pair = await client.getSpotCurrencyPair({ currency_pair: 'BTC_USDT', }); console.log('BTC_USDT metadata:', pair); } catch (error) { console.error('Currency pair request failed:', error); } try { const tickers = await client.getSpotTicker({ currency_pair: 'BTC_USDT', }); console.log('BTC_USDT ticker:', tickers[0]); } catch (error) { console.error('Ticker request failed:', error); } try { const orderBook = await client.getSpotOrderBook({ currency_pair: 'BTC_USDT', limit: 5, }); console.log('Best bid:', orderBook.bids[0]); console.log('Best ask:', orderBook.asks[0]); } catch (error) { console.error('Order book request failed:', error); } try { const candles = await client.getSpotCandles({ currency_pair: 'BTC_USDT', interval: '1h', limit: 10, }); console.log('Latest candle:', candles[0]); } catch (error) { console.error('Candles request failed:', error); }} main();Expected response
Market values change on each run. These are the fields to check in the logged output.
| Field | Expected result |
|---|---|
| Server time / metadata | A Unix-millisecond number and the BTC_USDT currency-pair object. |
| Ticker / best bid / best ask | A ticker object and [price, quantity] decimal-string levels. |
| Latest candle | An array starting with Unix seconds, quote volume, close, high, low, and open. The example logs the first returned row. |
WebSocket walkthrough
Connecting to Gate's private spot WebSocket streams is straightforward with the WebsocketClient.
- Install the Gate JavaScript SDK via NPM:
npm install gateio-api. - Import the WebsocketClient and create an authenticated instance with your API credentials.
- Configure event handlers for key events such as
open,update,response,reconnect,reconnected,close,authenticated, andexception. - Subscribe to private spot topics and process incoming updates in real time.
In this example, we:
- Subscribe to private spot topics including balances, orders, user trades, and price orders.
- Demonstrate both single-topic and batched multi-topic subscription patterns.
- Show that duplicate subscriptions are filtered by the client.
This setup lets you track account-level spot activity without polling REST endpoints.
/* eslint-disable @typescript-eslint/no-unused-vars */import { LogParams, WebsocketClient, WsTopicRequest } from 'gateio-api'; // eslint-disable-next-line @typescript-eslint/no-unused-varsconst account = { key: process.env.API_KEY || 'apiKeyHere', secret: process.env.API_SECRET || 'apiSecretHere',}; // Define a custom logger object to handle logging at different levelsconst customLogger = { // Trace level logging: used for detailed debugging information trace: (...params: LogParams): void => { // Uncomment the line below to enable trace logging // console.log(new Date(), 'trace', ...params); }, // Info level logging: used for general informational messages info: (...params: LogParams): void => { console.log(new Date(), 'info', ...params); }, // Error level logging: used for error messages error: (...params: LogParams): void => { console.error(new Date(), 'error', ...params); },}; async function start() { const client = new WebsocketClient( { apiKey: account.key, apiSecret: account.secret, }, customLogger, ); // console.log('auth with: ', account); client.on('open', (data) => { console.log('connected ', data?.wsKey); }); // Data received client.on('update', (data) => { console.info('data received: ', JSON.stringify(data)); }); // Something happened, attempting to reconnect client.on('reconnect', (data) => { console.log('reconnect: ', data); }); // Reconnect successful client.on('reconnected', (data) => { console.log('reconnected: ', data); }); // Connection closed. If unexpected, expect reconnect -> reconnected. client.on('close', (data) => { console.error('close: ', data); }); // Reply to a request, e.g. "subscribe"/"unsubscribe"/"authenticate" client.on('response', (data) => { console.info('server reply: ', JSON.stringify(data), '\n'); }); client.on('exception', (data) => { console.error('exception: ', data); }); client.on('authenticated', (data) => { console.error('authenticated: ', data); }); try { // client.subscribe(topics, 'spotV4'); const topicWithoutParamsAsString = 'spot.balances'; // This has the same effect as above, it's just a different way of messaging which topic this is for // const topicWithoutParamsAsObject: WsTopicRequest = { // topic: 'spot.balances', // }; const userOrders: WsTopicRequest = { topic: 'spot.orders', payload: ['BTC_USDT', 'ETH_USDT', 'MATIC_USDT'], }; const userTrades: WsTopicRequest = { topic: 'spot.usertrades', payload: ['BTC_USDT', 'ETH_USDT', 'MATIC_USDT'], }; const userPriceOrders: WsTopicRequest = { topic: 'spot.priceorders', payload: ['!all'], }; /** * Either send one topic (with optional params) at a time */ // client.subscribe(topicWithoutParamsAsObject, 'spotV4'); /** * Or send multiple topics in a batch (grouped by ws connection (WsKey)) * You can also use strings for topics that don't have any parameters, even if you mix multiple requests into one function call: */ client.subscribe( [topicWithoutParamsAsString, userOrders, userTrades, userPriceOrders], 'spotV4', ); /** * You can also subscribe in separate function calls as you wish. * * Any duplicate requests should get filtered out (e.g. here we subscribed to "spot.balances" twice, but the WS client will filter this out) */ client.subscribe( [ 'spot.balances', 'spot.margin_balances', 'spot.funding_balances', 'spot.cross_balances', ], 'spotV4', ); } catch (e) { console.error('Req error: ', e); }} start();WebSocket API walkthrough
WebSocket API commands require API credentials. Set the environment variables shown in the code using credentials for the live environment. This example only constructs the client; it sends no request and places no order. Continue with the maintained example below for supported commands and connection handling.
Save the code as ws-api-setup.mjs and run:
node ws-api-setup.mjs
import { WebsocketAPIClient } from 'gateio-api'; const credentials = { apiKey: process.env.GATE_API_KEY, apiSecret: process.env.GATE_API_SECRET,}; if (Object.values(credentials).some((value) => !value)) { throw new Error('Set GATE_API_KEY, GATE_API_SECRET before running.');} const wsApi = new WebsocketAPIClient(credentials);console.log('Client configured. No request sent.');Gate API JavaScript Tutorial
A practical JavaScript guide to using gateio-api across the Gate REST API, public and private streams, Spot and Futures TestNet orders, API hosts, proxies, and WebSocket API commands.
Your app / service
bot, dashboard, worker
gateio-api
RestClient, WebsocketClient, WebsocketAPIClient
Gate API
REST API, public streams, private streams, WebSocket API
Common Gate 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.
RestClient.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in RestClient.ts.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| getSystemMaintenanceStatus() | GET | /v1/public/system_info | |
| listAnnouncementArticles() | POST | /ann/list_article | |
| submitWithdrawal() | 🔐 | POST | /withdrawals |
| submitSpotMainAccountTransfer() | 🔐 | POST | /withdrawals/push |
| cancelWithdrawal() | 🔐 | DELETE | /withdrawals/{withdrawal_id} |
| getCurrencyChains() | GET | /wallet/currency_chains | |
| createDepositAddress() | 🔐 | GET | /wallet/deposit_address |
| getWithdrawalRecords() | 🔐 | GET | /wallet/withdrawals |
| getDepositRecords() | 🔐 | GET | /wallet/deposits |
| submitTransfer() | 🔐 | POST | /wallet/transfers |
| getTransfer() | 🔐 | GET | /wallet/transfers |
| submitMainSubTransfer() | 🔐 | POST | /wallet/sub_account_transfers |
| getMainSubTransfers() | 🔐 | GET | /wallet/sub_account_transfers |
| submitSubToSubTransfer() | 🔐 | POST | /wallet/sub_account_to_sub_account |
| getTransferStatus() | 🔐 | GET | /wallet/order_status |
| getWithdrawalStatus() | 🔐 | GET | /wallet/withdraw_status |
| getSubBalance() | 🔐 | GET | /wallet/sub_account_balances |
| getSubMarginBalances() | 🔐 | GET | /wallet/sub_account_margin_balances |
| getSubFuturesBalances() | 🔐 | GET | /wallet/sub_account_futures_balances |
| getSubCrossMarginBalances() | 🔐 | GET | /wallet/sub_account_cross_margin_balances |
| getSavedAddresses() | 🔐 | GET | /wallet/saved_address |
| getTradingFees() | 🔐 | GET | /wallet/fee |
| getBalances() | 🔐 | GET | /wallet/total_balance |
| getSmallBalances() | 🔐 | GET | /wallet/small_balance |
| convertSmallBalance() | 🔐 | POST | /wallet/small_balance |
| getSmallBalanceHistory() | 🔐 | GET | /wallet/small_balance_history |
| getPushOrders() | 🔐 | GET | /wallet/push |
| getLowCapExchangeList() | 🔐 | GET | /wallet/getLowCapExchangeList |
| createSubAccount() | 🔐 | POST | /sub_accounts |
| getSubAccounts() | 🔐 | GET | /sub_accounts |
| getSubAccount() | 🔐 | GET | /sub_accounts/{user_id} |
| createSubAccountApiKey() | 🔐 | POST | /sub_accounts/{user_id}/keys |
| getSubAccountApiKeys() | 🔐 | GET | /sub_accounts/{user_id}/keys |
| updateSubAccountApiKey() | 🔐 | PUT | /sub_accounts/{user_id}/keys/{key} |
| deleteSubAccountApiKey() | 🔐 | DELETE | /sub_accounts/{user_id}/keys/{key} |
| getSubAccountApiKey() | 🔐 | GET | /sub_accounts/{user_id}/keys/{key} |
| lockSubAccount() | 🔐 | POST | /sub_accounts/{user_id}/lock |
| unlockSubAccount() | 🔐 | POST | /sub_accounts/{user_id}/unlock |
| getSubAccountMode() | 🔐 | GET | /sub_accounts/unified_mode |
| getUnifiedAccountInfo() | 🔐 | GET | /unified/accounts |
| getUnifiedMaxBorrow() | 🔐 | GET | /unified/borrowable |
| getUnifiedMaxTransferable() | 🔐 | GET | /unified/transferable |
| getUnifiedMaxTransferables() | 🔐 | GET | /unified/transferables |
| getUnifiedBatchMaxBorrowable() | 🔐 | GET | /unified/batch_borrowable |
| submitUnifiedBorrowOrRepay() | 🔐 | POST | /unified/loans |
| getUnifiedLoans() | 🔐 | GET | /unified/loans |
| getUnifiedLoanRecords() | 🔐 | GET | /unified/loan_records |
| getUnifiedInterestRecords() | 🔐 | GET | /unified/interest_records |
| getUnifiedRiskUnitDetails() | 🔐 | GET | /unified/risk_units |
| setUnifiedAccountMode() | 🔐 | PUT | /unified/unified_mode |
| getUnifiedAccountMode() | 🔐 | GET | /unified/unified_mode |
| getUnifiedEstimateRate() | 🔐 | GET | /unified/estimate_rate |
| getUnifiedCurrencyDiscountTiers() | GET | /unified/currency_discount_tiers | |
| getLoanMarginTiers() | GET | /unified/loan_margin_tiers | |
| portfolioMarginCalculate() | POST | /unified/portfolio_calculator | |
| setUserLeverage() | 🔐 | POST | /unified/leverage/user_setting |
| getUserCurrencyLeverageConfig() | 🔐 | GET | /unified/leverage/user_currency_config |
| getUserCurrencyLeverageSettings() | 🔐 | GET | /unified/leverage/user_currency_setting |
| updateUserCurrencyLeverage() | 🔐 | POST | /unified/leverage/user_currency_setting |
| getUnifiedLoanCurrencies() | 🔐 | GET | /unified/currencies |
| getHistoricalLendingRates() | 🔐 | GET | /unified/history_loan_rate |
| submitUnifiedLoanRepay() | 🔐 | POST | /unified/loans/repay |
| getEstimatedQuickRepayment() | 🔐 | GET | /unified/estimated_quick_repayment |
| createQuickRepayment() | 🔐 | POST | /unified/quick_repayment |
| setUnifiedDeltaNeutral() | 🔐 | POST | /unified/delta_neutral |
| getUnifiedDeltaNeutral() | 🔐 | GET | /unified/delta_neutral |
| getSpotCurrencies() | GET | /spot/currencies | |
| getSpotCurrency() | GET | /spot/currencies/{currency} | |
| getSpotCurrencyPairs() | GET | /spot/currency_pairs | |
| getSpotCurrencyPair() | GET | /spot/currency_pairs/{currency_pair} | |
| getSpotTicker() | GET | /spot/tickers | |
| getSpotOrderBook() | GET | /spot/order_book | |
| getSpotTrades() | GET | /spot/trades | |
| getSpotCandles() | GET | /spot/candlesticks | |
| getSpotFeeRates() | 🔐 | GET | /spot/fee |
| getSpotBatchFeeRates() | 🔐 | GET | /spot/batch_fee |
| getSpotAccounts() | 🔐 | GET | /spot/accounts |
| getSpotAccountBook() | 🔐 | GET | /spot/account_book |
| submitSpotBatchOrders() | 🔐 | POST | /spot/batch_orders |
| getSpotOpenOrders() | 🔐 | GET | /spot/open_orders |
| submitSpotClosePosCrossDisabled() | 🔐 | POST | /spot/cross_liquidate_orders |
| submitSpotOrder() | 🔐 | POST | /spot/orders |
| getSpotOrders() | 🔐 | GET | /spot/orders |
| cancelSpotOpenOrders() | 🔐 | DELETE | /spot/orders |
| batchCancelSpotOrders() | 🔐 | POST | /spot/cancel_batch_orders |
| getSpotOrder() | 🔐 | GET | /spot/orders/{order_id} |
| updateSpotOrder() | 🔐 | PATCH | /spot/orders/{order_id} |
| cancelSpotOrder() | 🔐 | DELETE | /spot/orders/{order_id} |
| getSpotTradingHistory() | 🔐 | GET | /spot/my_trades |
| submitSpotCountdownOrders() | 🔐 | POST | /spot/countdown_cancel_all |
| batchUpdateSpotOrders() | 🔐 | POST | /spot/amend_batch_orders |
| getSpotInsuranceHistory() | 🔐 | GET | /spot/insurance_history |
| submitSpotPriceTriggerOrder() | 🔐 | POST | /spot/price_orders |
| getSpotAutoOrders() | 🔐 | GET | /spot/price_orders |
| cancelAllOpenSpotOrders() | 🔐 | DELETE | /spot/price_orders |
| getPriceTriggeredOrder() | 🔐 | GET | /spot/price_orders/{order_id} |
| cancelSpotTriggeredOrder() | 🔐 | DELETE | /spot/price_orders/{order_id} |
| getSpotPovOrders() | 🔐 | GET | /spot/pov_orders |
| createSpotPovOrder() | 🔐 | POST | /spot/pov_orders |
| cancelSpotPovOrders() | 🔐 | DELETE | /spot/pov_orders |
| getSpotPovOrder() | 🔐 | GET | /spot/pov_orders/{order_id} |
| cancelSpotPovOrder() | 🔐 | DELETE | /spot/pov_orders/{order_id} |
| setCollateralCurrency() | 🔐 | POST | /unified/collateral_currencies |
| getMarginAccounts() | 🔐 | GET | /margin/accounts |
| getMarginBalanceHistory() | 🔐 | GET | /margin/account_book |
| getFundingAccounts() | 🔐 | GET | /margin/funding_accounts |
| updateAutoRepaymentSetting() | 🔐 | POST | /margin/auto_repay |
| getAutoRepaymentSetting() | 🔐 | GET | /margin/auto_repay |
| getMarginTransferableAmount() | 🔐 | GET | /margin/transferable |
| getCrossMarginCurrencies() | GET | /margin/cross/currencies | |
| getCrossMarginCurrency() | GET | /margin/cross/currencies/{currency} | |
| getCrossMarginAccount() | 🔐 | GET | /margin/cross/accounts |
| getCrossMarginAccountHistory() | 🔐 | GET | /margin/cross/account_book |
| submitCrossMarginBorrowLoan() | 🔐 | POST | /margin/cross/loans |
| getCrossMarginBorrowHistory() | 🔐 | GET | /margin/cross/loans |
| getCrossMarginBorrowLoan() | 🔐 | GET | /margin/cross/loans/{loan_id} |
| submitCrossMarginRepayment() | 🔐 | POST | /margin/cross/repayments |
| getCrossMarginRepayments() | 🔐 | GET | /margin/cross/repayments |
| getCrossMarginInterestRecords() | 🔐 | GET | /margin/cross/interest_records |
| getCrossMarginTransferableAmount() | 🔐 | GET | /margin/cross/transferable |
| getEstimatedInterestRates() | 🔐 | GET | /margin/cross/estimate_rate |
| getCrossMarginBorrowableAmount() | 🔐 | GET | /margin/cross/borrowable |
| getMarginUserLoanTiers() | 🔐 | GET | /margin/user/loan_margin_tiers |
| getMarginPublicLoanTiers() | GET | /margin/loan_margin_tiers | |
| setMarginUserLeverage() | 🔐 | POST | /margin/leverage/user_market_setting |
| getMarginUserAccounts() | 🔐 | GET | /margin/user/account |
| getLendingMarkets() | GET | /margin/uni/currency_pairs | |
| getLendingMarket() | GET | /margin/uni/currency_pairs/{currency_pair} | |
| getEstimatedInterestRate() | 🔐 | GET | /margin/uni/estimate_rate |
| submitMarginUNIBorrowOrRepay() | 🔐 | POST | /margin/uni/loans |
| getMarginUNILoans() | 🔐 | GET | /margin/uni/loans |
| getMarginUNILoanRecords() | 🔐 | GET | /margin/uni/loan_records |
| getMarginUNIInterestRecords() | 🔐 | GET | /margin/uni/interest_records |
| getMarginUNIMaxBorrow() | 🔐 | GET | /margin/uni/borrowable |
| getFlashSwapCurrencyPairs() | GET | /flash_swap/currency_pairs | |
| submitFlashSwapOrder() | 🔐 | POST | /flash_swap/orders |
| getFlashSwapOrders() | 🔐 | GET | /flash_swap/orders |
| getFlashSwapOrder() | 🔐 | GET | /flash_swap/orders/{order_id} |
| submitFlashSwapOrderPreview() | 🔐 | POST | /flash_swap/orders/preview |
| getFuturesContracts() | GET | /futures/{settle}/contracts | |
| getFuturesContract() | GET | /futures/{settle}/contracts/{contract} | |
| listFuturesADLRiskStates() | GET | /futures/{settle}/adl_risk_states | |
| getFuturesOrderBook() | GET | /futures/{settle}/order_book | |
| getFuturesTrades() | GET | /futures/{settle}/trades | |
| getFuturesCandles() | GET | /futures/{settle}/candlesticks | |
| getPremiumIndexKLines() | GET | /futures/{settle}/premium_index | |
| getFuturesTickers() | GET | /futures/{settle}/tickers | |
| getFundingRates() | GET | /futures/{settle}/funding_rate | |
| getBatchFundingRates() | POST | /futures/{settle}/funding_rates | |
| getFuturesInsuranceBalanceHistory() | GET | /futures/{settle}/insurance | |
| getFuturesStats() | GET | /futures/{settle}/contract_stats | |
| getIndexConstituents() | GET | /futures/{settle}/index_constituents/{index} | |
| getLiquidationHistory() | GET | /futures/{settle}/liq_orders | |
| getRiskLimitTiers() | GET | /futures/{settle}/risk_limit_tiers | |
| getFuturesAccount() | 🔐 | GET | /futures/{settle}/accounts |
| getFuturesAccountBook() | 🔐 | GET | /futures/{settle}/account_book |
| getFuturesPositions() | 🔐 | GET | /futures/{settle}/positions |
| getFuturesPosition() | 🔐 | GET | /futures/{settle}/positions/{contract} |
| updateFuturesMargin() | 🔐 | POST | /futures/{settle}/positions/{contract}/margin |
| updateFuturesLeverage() | 🔐 | POST | /futures/{settle}/positions/{contract}/leverage |
| getFuturesContractLeverage() | 🔐 | GET | /futures/{settle}/get_leverage/{contract} |
| updateFuturesPositionMode() | 🔐 | POST | /futures/{settle}/positions/cross_mode |
| updatePositionRiskLimit() | 🔐 | POST | /futures/{settle}/positions/{contract}/risk_limit |
| updateFuturesDualMode() | 🔐 | POST | /futures/{settle}/dual_mode |
| getDualModePosition() | 🔐 | GET | /futures/{settle}/dual_comp/positions/{contract} |
| updateDualModePositionMargin() | 🔐 | POST | /futures/{settle}/dual_comp/positions/{contract}/margin |
| updateDualModePositionLeverage() | 🔐 | POST | /futures/{settle}/dual_comp/positions/{contract}/leverage |
| updateDualModePositionRiskLimit() | 🔐 | POST | /futures/{settle}/dual_comp/positions/{contract}/risk_limit |
| submitFuturesOrder() | 🔐 | POST | /futures/{settle}/orders |
| getFuturesOrders() | 🔐 | GET | /futures/{settle}/orders |
| cancelAllFuturesOrders() | 🔐 | DELETE | /futures/{settle}/orders |
| getFuturesOrdersByTimeRange() | 🔐 | GET | /futures/{settle}/orders_timerange |
| submitFuturesBatchOrders() | 🔐 | POST | /futures/{settle}/batch_orders |
| getFuturesOrder() | 🔐 | GET | /futures/{settle}/orders/{order_id} |
| cancelFuturesOrder() | 🔐 | DELETE | /futures/{settle}/orders/{order_id} |
| updateFuturesOrder() | 🔐 | PUT | /futures/{settle}/orders/{order_id} |
| getFuturesTradingHistory() | 🔐 | GET | /futures/{settle}/my_trades |
| getFuturesTradingHistoryByTimeRange() | 🔐 | GET | /futures/{settle}/my_trades_timerange |
| getFuturesPositionHistory() | 🔐 | GET | /futures/{settle}/position_close |
| getFuturesLiquidationHistory() | 🔐 | GET | /futures/{settle}/liquidates |
| getFuturesAutoDeleveragingHistory() | 🔐 | GET | /futures/{settle}/auto_deleverages |
| setFuturesOrderCancelCountdown() | 🔐 | POST | /futures/{settle}/countdown_cancel_all |
| getFuturesUserTradingFees() | 🔐 | GET | /futures/{settle}/fee |
| batchCancelFuturesOrders() | 🔐 | POST | /futures/{settle}/batch_cancel_orders |
| batchUpdateFuturesOrders() | 🔐 | POST | /futures/{settle}/batch_amend_orders |
| getRiskLimitTable() | GET | /futures/{settle}/risk_limit_table | |
| submitFuturesPriceTriggeredOrder() | 🔐 | POST | /futures/{settle}/price_orders |
| getFuturesAutoOrders() | 🔐 | GET | /futures/{settle}/price_orders |
| cancelAllOpenFuturesOrders() | 🔐 | DELETE | /futures/{settle}/price_orders |
| getFuturesPriceTriggeredOrder() | 🔐 | GET | /futures/{settle}/price_orders/{order_id} |
| cancelFuturesPriceTriggeredOrder() | 🔐 | DELETE | /futures/{settle}/price_orders/{order_id} |
| updateFuturesPriceTriggeredOrder() | 🔐 | PUT | /futures/{settle}/price_orders/amend |
| createTrailOrder() | 🔐 | POST | /futures/{settle}/autoorder/v1/trail/create |
| terminateTrailOrder() | 🔐 | POST | /futures/{settle}/autoorder/v1/trail/stop |
| batchTerminateTrailOrders() | 🔐 | POST | /futures/{settle}/autoorder/v1/trail/stop_all |
| getTrailOrderList() | 🔐 | GET | /futures/{settle}/autoorder/v1/trail/list |
| getTrailOrderDetail() | 🔐 | GET | /futures/{settle}/autoorder/v1/trail/detail |
| updateTrailOrder() | 🔐 | POST | /futures/{settle}/autoorder/v1/trail/update |
| getTrailOrderChangeLog() | 🔐 | GET | /futures/{settle}/autoorder/v1/trail/change_log |
| createChaseOrder() | 🔐 | POST | /futures/{settle}/autoorder/v1/chase/create |
| stopChaseOrder() | 🔐 | POST | /futures/{settle}/autoorder/v1/chase/stop |
| stopAllChaseOrders() | 🔐 | POST | /futures/{settle}/autoorder/v1/chase/stop_all |
| getChaseOrders() | 🔐 | GET | /futures/{settle}/autoorder/v1/chase/list |
| getChaseOrderDetail() | 🔐 | GET | /futures/{settle}/autoorder/v1/chase/detail |
| getFuturesPositionCloseHistory() | 🔐 | GET | /futures/{settle}/position_close_history |
| getFuturesInsuranceHistory() | 🔐 | GET | /futures/{settle}/insurance |
| getAllDeliveryContracts() | GET | /delivery/{settle}/contracts | |
| getDeliveryContract() | GET | /delivery/{settle}/contracts/{contract} | |
| getDeliveryOrderBook() | GET | /delivery/{settle}/order_book | |
| getDeliveryTrades() | GET | /delivery/{settle}/trades | |
| getDeliveryCandles() | GET | /delivery/{settle}/candlesticks | |
| getDeliveryTickers() | GET | /delivery/{settle}/tickers | |
| getDeliveryInsuranceBalanceHistory() | GET | /delivery/{settle}/insurance | |
| getDeliveryAccount() | 🔐 | GET | /delivery/{settle}/accounts |
| getDeliveryBook() | 🔐 | GET | /delivery/{settle}/account_book |
| getDeliveryPositions() | 🔐 | GET | /delivery/{settle}/positions |
| getDeliveryPosition() | 🔐 | GET | /delivery/{settle}/positions/{contract} |
| updateDeliveryMargin() | 🔐 | POST | /delivery/{settle}/positions/{contract}/margin |
| updateDeliveryLeverage() | 🔐 | POST | /delivery/{settle}/positions/{contract}/leverage |
| updateDeliveryRiskLimit() | 🔐 | POST | /delivery/{settle}/positions/{contract}/risk_limit |
| submitDeliveryOrder() | 🔐 | POST | /delivery/{settle}/orders |
| getDeliveryOrders() | 🔐 | GET | /delivery/{settle}/orders |
| cancelAllDeliveryOrders() | 🔐 | DELETE | /delivery/{settle}/orders |
| getDeliveryOrder() | 🔐 | GET | /delivery/{settle}/orders/{order_id} |
| cancelDeliveryOrder() | 🔐 | DELETE | /delivery/{settle}/orders/{order_id} |
| getDeliveryTradingHistory() | 🔐 | GET | /delivery/{settle}/my_trades |
| getDeliveryClosedPositions() | 🔐 | GET | /delivery/{settle}/position_close |
| getDeliveryLiquidationHistory() | 🔐 | GET | /delivery/{settle}/liquidates |
| getDeliverySettlementHistory() | 🔐 | GET | /delivery/{settle}/settlements |
| submitDeliveryTriggeredOrder() | 🔐 | POST | /delivery/{settle}/price_orders |
| getDeliveryAutoOrders() | 🔐 | GET | /delivery/{settle}/price_orders |
| cancelAllOpenDeliveryOrders() | 🔐 | DELETE | /delivery/{settle}/price_orders |
| getDeliveryTriggeredOrder() | 🔐 | GET | /delivery/{settle}/price_orders/{order_id} |
| cancelTriggeredDeliveryOrder() | 🔐 | DELETE | /delivery/{settle}/price_orders/{order_id} |
| getOptionsUnderlyings() | GET | /options/underlyings | |
| getOptionsExpirationTimes() | GET | /options/expirations | |
| getOptionsContracts() | GET | /options/contracts | |
| getOptionsContract() | GET | /options/contracts/{contract} | |
| getOptionsSettlementHistory() | GET | /options/settlements | |
| getOptionsContractSettlement() | GET | /options/settlements/{contract} | |
| getOptionsMySettlements() | 🔐 | GET | /options/my_settlements |
| getOptionsOrderBook() | GET | /options/order_book | |
| getOptionsTickers() | GET | /options/tickers | |
| getOptionsUnderlyingTicker() | GET | /options/underlying/tickers/{underlying} | |
| getOptionsCandles() | GET | /options/candlesticks | |
| getOptionsUnderlyingCandles() | GET | /options/underlying/candlesticks | |
| getOptionsTrades() | GET | /options/trades | |
| getOptionsAccount() | 🔐 | GET | /options/accounts |
| getOptionsAccountChange() | 🔐 | GET | /options/account_book |
| getOptionsPositionsUnderlying() | 🔐 | GET | /options/positions |
| getOptionsPositionContract() | 🔐 | GET | /options/positions/{contract} |
| getOptionsLiquidation() | 🔐 | GET | /options/position_close |
| submitOptionsOrder() | 🔐 | POST | /options/orders |
| getOptionsOrders() | 🔐 | GET | /options/orders |
| cancelAllOpenOptionsOrders() | 🔐 | DELETE | /options/orders |
| getOptionsOrder() | 🔐 | GET | /options/orders/{order_id} |
| amendOptionsOrder() | 🔐 | PUT | /options/orders/{order_id} |
| cancelOptionsOrder() | 🔐 | DELETE | /options/orders/{order_id} |
| submitOptionsCountdownCancel() | 🔐 | POST | /options/countdown_cancel_all |
| getOptionsPersonalHistory() | 🔐 | GET | /options/my_trades |
| setOptionsMMPSettings() | 🔐 | POST | /options/mmp |
| getOptionsMMPSettings() | 🔐 | GET | /options/mmp |
| resetOptionsMMPSettings() | 🔐 | POST | /options/mmp/reset |
| getLendingCurrencies() | GET | /earn/uni/currencies | |
| getLendingCurrency() | GET | /earn/uni/currencies/{currency} | |
| submitLendOrRedeemOrder() | 🔐 | POST | /earn/uni/lends |
| getLendingOrders() | 🔐 | GET | /earn/uni/lends |
| updateLendingOrder() | 🔐 | PATCH | /earn/uni/lends |
| getLendingRecords() | 🔐 | GET | /earn/uni/lend_records |
| getLendingTotalInterest() | 🔐 | GET | /earn/uni/interests/{currency} |
| getLendingInterestRecords() | 🔐 | GET | /earn/uni/interest_records |
| updateInterestReinvestment() | 🔐 | PUT | /earn/uni/interest_reinvest |
| getLendingInterestStatus() | 🔐 | GET | /earn/uni/interest_status/{currency} |
| getLendingAnnualizedTrendChart() | 🔐 | GET | /earn/uni/chart |
| getLendingEstimatedRates() | 🔐 | GET | /earn/uni/rate |
| submitMultiLoanOrder() | 🔐 | POST | /loan/multi_collateral/orders |
| getMultiLoanOrders() | 🔐 | GET | /loan/multi_collateral/orders |
| getMultiLoanOrder() | 🔐 | GET | /loan/multi_collateral/orders/{order_id} |
| repayMultiLoan() | 🔐 | POST | /loan/multi_collateral/repay |
| getMultiLoanRepayRecords() | 🔐 | GET | /loan/multi_collateral/repay |
| updateMultiLoan() | 🔐 | POST | /loan/multi_collateral/mortgage |
| getMultiLoanAdjustmentRecords() | 🔐 | GET | /loan/multi_collateral/mortgage |
| getMultiLoanCurrencyQuota() | 🔐 | GET | /loan/multi_collateral/currency_quota |
| getMultiLoanSupportedCurrencies() | GET | /loan/multi_collateral/currencies | |
| getMultiLoanRatio() | GET | /loan/multi_collateral/ltv | |
| getMultiLoanFixedRates() | GET | /loan/multi_collateral/fixed_rate | |
| getMultiLoanCurrentRates() | GET | /loan/multi_collateral/current_rate | |
| getDualInvestmentProducts() | GET | /earn/dual/investment_plan | |
| getDualInvestmentOrders() | 🔐 | GET | /earn/dual/orders |
| submitDualInvestmentOrder() | 🔐 | POST | /earn/dual/orders |
| getDualOrderRefundPreview() | 🔐 | GET | /earn/dual/order-refund-preview |
| submitDualOrderRefund() | 🔐 | POST | /earn/dual/order-refund |
| updateDualOrderReinvest() | 🔐 | POST | /earn/dual/modify-order-reinvest |
| getDualProjectRecommend() | 🔐 | GET | /earn/dual/project-recommend |
| getEarnFixedTermProducts() | GET | /earn/fixed-term/product | |
| getEarnFixedTermProductsByAsset() | GET | /earn/fixed-term/product/{asset}/list | |
| createEarnFixedTermLend() | 🔐 | POST | /earn/fixed-term/user/lend |
| getEarnFixedTermLends() | 🔐 | GET | /earn/fixed-term/user/lend |
| createEarnFixedTermPreRedeem() | 🔐 | POST | /earn/fixed-term/user/pre-redeem |
| getEarnFixedTermHistory() | 🔐 | GET | /earn/fixed-term/user/history |
| createAutoInvestPlan() | 🔐 | POST | /earn/autoinvest/plans/create |
| updateAutoInvestPlan() | 🔐 | POST | /earn/autoinvest/plans/update |
| stopAutoInvestPlan() | 🔐 | POST | /earn/autoinvest/plans/stop |
| addAutoInvestPlanPosition() | 🔐 | POST | /earn/autoinvest/plans/add_position |
| getAutoInvestCoins() | 🔐 | GET | /earn/autoinvest/coins |
| getAutoInvestMinAmount() | 🔐 | POST | /earn/autoinvest/min_invest_amount |
| getAutoInvestPlanRecords() | 🔐 | GET | /earn/autoinvest/plans/records |
| getAutoInvestOrders() | 🔐 | GET | /earn/autoinvest/orders |
| getAutoInvestConfig() | 🔐 | GET | /earn/autoinvest/config |
| getAutoInvestPlanDetail() | 🔐 | GET | /earn/autoinvest/plans/detail |
| getAutoInvestPlans() | 🔐 | GET | /earn/autoinvest/plans/list_info |
| getStakingCoins() | 🔐 | GET | /earn/staking/coins |
| submitStakingSwap() | 🔐 | POST | /earn/staking/swap |
| getAccountDetail() | 🔐 | GET | /account/detail |
| getAccountRateLimit() | 🔐 | GET | /account/rate_limit |
| createStpGroup() | 🔐 | POST | /account/stp_groups |
| getStpGroups() | 🔐 | GET | /account/stp_groups |
| getStpGroupUsers() | 🔐 | GET | /account/stp_groups/{stp_id}/users |
| addUsersToStpGroup() | 🔐 | POST | /account/stp_groups/{stp_id}/users |
| deleteUserFromStpGroup() | 🔐 | DELETE | /account/stp_groups/{stp_id}/users |
| setGTDeduction() | 🔐 | POST | /account/debit_fee |
| getGTDeduction() | 🔐 | GET | /account/debit_fee |
| getAccountMainKeys() | 🔐 | GET | /account/main_keys |
| getAgencyTransactionHistory() | 🔐 | GET | /rebate/agency/transaction_history |
| getAgencyCommissionHistory() | 🔐 | GET | /rebate/agency/commission_history |
| getPartnerTransactionHistory() | 🔐 | GET | /rebate/partner/transaction_history |
| getPartnerCommissionHistory() | 🔐 | GET | /rebate/partner/commission_history |
| getPartnerSubordinateList() | 🔐 | GET | /rebate/partner/sub_list |
| getPartnerAgentDataAggregated() | 🔐 | GET | /rebate/partner/data/aggregated |
| getBrokerCommissionHistory() | 🔐 | GET | /rebate/broker/commission_history |
| getBrokerTransactionHistory() | 🔐 | GET | /rebate/broker/transaction_history |
| getUserRebateInfo() | 🔐 | GET | /rebate/user/info |
| createOTCQuote() | 🔐 | POST | /otc/quote |
| createOTCFiatOrder() | 🔐 | POST | /otc/order/create |
| createOTCStablecoinOrder() | 🔐 | POST | /otc/stable_coin/order/create |
| getOTCBankList() | 🔐 | GET | /otc/bank/list |
| getOTCBankListLegacy() | 🔐 | GET | /otc/bank_list |
| createOTCUploadPreUpload() | 🔐 | POST | /otc/upload/pre_upload |
| createOTCBank() | 🔐 | POST | /otc/bank/create |
| deleteOTCBank() | 🔐 | POST | /otc/bank/delete |
| setDefaultOTCBank() | 🔐 | POST | /otc/bank/set_default |
| getOTCBankSupplementChecklist() | 🔐 | GET | /otc/bank/bank_supplement_checklist |
| submitOTCBankPersonalSupplement() | 🔐 | POST | /otc/order/paid |
| submitOTCBankEnterpriseSupplement() | 🔐 | POST | /otc/order/paid |
| markOTCOrderAsPaid() | 🔐 | POST | /otc/order/paid |
| cancelOTCOrder() | 🔐 | POST | /otc/order/cancel |
| getOTCFiatOrderList() | 🔐 | GET | /otc/order/list |
| getOTCStablecoinOrderList() | 🔐 | GET | /otc/stable_coin/order/list |
| getOTCFiatOrderDetail() | 🔐 | GET | /otc/order/detail |
| getP2PMerchantUserInfo() | 🔐 | POST | /p2p/merchant/account/get_user_info |
| getP2PMerchantCounterpartyUserInfo() | 🔐 | POST | /p2p/merchant/account/get_counterparty_user_info |
| getP2PMerchantMyselfPayment() | 🔐 | POST | /p2p/merchant/account/get_myself_payment |
| getP2PMerchantSpotBalance() | 🔐 | POST | /p2p/merchant/account/set_merchant_work_hours |
| setP2PMerchantWorkHours() | 🔐 | POST | /p2p/merchant/account/set_merchant_work_hours |
| getP2PMerchantPendingTransactionList() | 🔐 | POST | /p2p/merchant/transaction/get_pending_transaction_list |
| getP2PMerchantCompletedTransactionList() | 🔐 | POST | /p2p/merchant/transaction/get_completed_transaction_list |
| getP2PMerchantTransactionDetails() | 🔐 | POST | /p2p/merchant/transaction/get_transaction_details |
| confirmP2PMerchantPayment() | 🔐 | POST | /p2p/merchant/transaction/confirm-payment |
| confirmP2PMerchantReceipt() | 🔐 | POST | /p2p/merchant/transaction/confirm-receipt |
| cancelP2PMerchantTransaction() | 🔐 | POST | /p2p/merchant/transaction/cancel |
| placeP2PMerchantBizPushOrder() | 🔐 | POST | /p2p/merchant/books/place_biz_push_order |
| updateP2PMerchantAdsStatus() | 🔐 | POST | /p2p/merchant/books/ads_update_status |
| getP2PMerchantAdsDetail() | 🔐 | POST | /p2p/merchant/books/ads_detail |
| getP2PMerchantMyAdsList() | 🔐 | POST | /p2p/merchant/books/my_ads_list |
| getP2PMerchantAdsList() | 🔐 | POST | /p2p/merchant/books/ads_list |
| getP2PMerchantChatsList() | 🔐 | POST | /p2p/merchant/chat/get_chats_list |
| sendP2PMerchantChatMessage() | 🔐 | POST | /p2p/merchant/chat/send_chat_message |
| uploadP2PMerchantChatFile() | 🔐 | POST | /p2p/merchant/chat/upload_chat_file |
| getCrossExSymbols() | GET | /crossex/rule/symbols | |
| getCrossExRiskLimits() | GET | /crossex/rule/risk_limits | |
| getCrossExTransferCoins() | GET | /crossex/transfers/coin | |
| createCrossExTransfer() | 🔐 | POST | /crossex/transfers |
| getCrossExTransferHistory() | 🔐 | GET | /crossex/transfers |
| createCrossExOrder() | 🔐 | POST | /crossex/orders |
| cancelBatchCrossExOrders() | 🔐 | POST | /crossex/batch_cancel_orders |
| cancelCrossExOrder() | 🔐 | DELETE | /crossex/orders/{order_id} |
| modifyCrossExOrder() | 🔐 | PUT | /crossex/orders/{order_id} |
| getCrossExOrder() | 🔐 | GET | /crossex/orders/{order_id} |
| createCrossExConvertQuote() | 🔐 | POST | /crossex/convert/quote |
| createCrossExConvertOrder() | 🔐 | POST | /crossex/convert/orders |
| updateCrossExAccount() | 🔐 | PUT | /crossex/accounts |
| getCrossExAccounts() | 🔐 | GET | /crossex/accounts |
| setCrossExPositionLeverage() | 🔐 | POST | /crossex/positions/leverage |
| getCrossExPositionLeverage() | 🔐 | GET | /crossex/positions/leverage |
| setCrossExMarginPositionLeverage() | 🔐 | POST | /crossex/margin_positions/leverage |
| getCrossExMarginPositionLeverage() | 🔐 | GET | /crossex/margin_positions/leverage |
| closeCrossExPosition() | 🔐 | POST | /crossex/position |
| updateCrossExPositionsMargin() | 🔐 | POST | /crossex/positions/margin |
| getCrossExInterestRate() | 🔐 | GET | /crossex/interest_rate |
| getCrossExFeeRate() | 🔐 | GET | /crossex/fee |
| getCrossExPositions() | 🔐 | GET | /crossex/positions |
| getCrossExMarginPositions() | 🔐 | GET | /crossex/margin_positions |
| getCrossExAdlRank() | 🔐 | GET | /crossex/adl_rank |
| getCrossExOpenOrders() | 🔐 | GET | /crossex/open_orders |
| getCrossExHistoryOrders() | 🔐 | GET | /crossex/history_orders |
| getCrossExHistoryPositions() | 🔐 | GET | /crossex/history_positions |
| getCrossExHistoryMarginPositions() | 🔐 | GET | /crossex/history_margin_positions |
| getCrossExHistoryMarginInterests() | 🔐 | GET | /crossex/history_margin_interests |
| getCrossExHistoryTrades() | 🔐 | GET | /crossex/history_trades |
| getCrossExAccountBook() | 🔐 | GET | /crossex/account_book |
| getCrossExCoinDiscountRate() | 🔐 | GET | /crossex/coin_discount_rate |
| getCrossExMarketTickers() | GET | /crossex/market/tickers | |
| getCrossExMarketFundingInfo() | GET | /crossex/market/funding_info | |
| getAlphaAccounts() | 🔐 | GET | /alpha/accounts |
| getAlphaAccountBook() | 🔐 | GET | /alpha/account_book |
| createAlphaQuote() | 🔐 | POST | /alpha/quote |
| createAlphaOrder() | 🔐 | POST | /alpha/orders |
| getAlphaOrders() | 🔐 | GET | /alpha/orders |
| getAlphaOrder() | 🔐 | GET | /alpha/order |
| getAlphaCurrencies() | GET | /alpha/currencies | |
| getAlphaTickers() | GET | /alpha/tickers | |
| getTradFiMT5Account() | 🔐 | GET | /tradfi/users/mt5-account |
| getTradFiSymbolCategories() | GET | /tradfi/symbols/categories | |
| getTradFiSymbols() | GET | /tradfi/symbols | |
| getTradFiSymbolCommissions() | 🔐 | GET | /tradfi/symbols/commissions |
| getTradFiSymbolDetail() | 🔐 | GET | /tradfi/symbols/detail |
| getTradFiKlines() | GET | /tradfi/symbols/{symbol}/klines | |
| getTradFiTicker() | GET | /tradfi/symbols/{symbol}/tickers | |
| createTradFiUser() | 🔐 | POST | /tradfi/users |
| getTradFiAssets() | 🔐 | GET | /tradfi/users/assets |
| createTradFiTransaction() | 🔐 | POST | /tradfi/transactions |
| getTradFiTransactions() | 🔐 | GET | /tradfi/transactions |
| createTradFiOrder() | 🔐 | POST | /tradfi/orders |
| getTradFiOrders() | 🔐 | GET | /tradfi/orders |
| modifyTradFiOrder() | 🔐 | PUT | /tradfi/orders/{orderId} |
| cancelTradFiOrder() | 🔐 | DELETE | /tradfi/orders/{orderId} |
| getTradFiOrderHistory() | 🔐 | GET | /tradfi/orders/history |
| getTradFiPositions() | 🔐 | GET | /tradfi/positions |
| modifyTradFiPosition() | 🔐 | PUT | /tradfi/positions/{positionId} |
| closeTradFiPosition() | 🔐 | POST | /tradfi/positions/{positionId}/close |
| getTradFiPositionHistory() | 🔐 | GET | /tradfi/positions/history |
| getTradFiOrderLog() | 🔐 | GET | /tradfi/orders/log/{log_id} |
| getStockUserAssets() | 🔐 | GET | /stock/users/assets |
| getStockSymbols() | GET | /stock/symbols | |
| getStockSymbolDetail() | 🔐 | GET | /stock/symbols/detail |
| getStockOrderBook() | GET | /stock/market/{symbol}/orderbook | |
| getStockOrders() | 🔐 | GET | /stock/orders |
| createStockOrder() | 🔐 | POST | /stock/orders |
| cancelAllStockOrders() | 🔐 | DELETE | /stock/orders |
| getStockOrderHistory() | 🔐 | GET | /stock/orders/history |
| updateStockOrder() | 🔐 | PUT | /stock/orders/{orderId} |
| cancelStockOrder() | 🔐 | DELETE | /stock/orders/{orderId} |
| getStockPositions() | 🔐 | GET | /stock/positions |
| closeStockPosition() | 🔐 | POST | /stock/positions/close |
| getStockTransactions() | 🔐 | GET | /stock/transactions |
| createStockTransaction() | 🔐 | POST | /stock/transactions |
| getStockExchanges() | GET | /stock/exchanges | |
| getStockFeeRate() | GET | /stock/fee-rate |
WebsocketAPIClient.ts
This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in WebsocketAPIClient.ts.
This client provides WebSocket API endpoints which allow for faster interactions with the Gate.io API via a WebSocket connection.
| Function | AUTH | HTTP Method | Endpoint |
|---|---|---|---|
| submitNewSpotOrder() | 🔐 | WS | spot.order_place |
| cancelSpotOrder() | 🔐 | WS | spot.order_cancel |
| cancelSpotOrderById() | 🔐 | WS | spot.order_cancel_ids |
| cancelSpotOrderForSymbol() | 🔐 | WS | spot.order_cancel_cp |
| updateSpotOrder() | 🔐 | WS | spot.order_amend |
| getSpotOrderStatus() | 🔐 | WS | spot.order_status |
| getSpotOrders() | 🔐 | WS | spot.order_list |
| submitNewFuturesOrder() | 🔐 | WS | futures.order_place |
| submitNewFuturesBatchOrder() | 🔐 | WS | futures.order_batch_place |
| cancelFuturesOrder() | 🔐 | WS | futures.order_cancel |
| cancelFuturesOrderById() | 🔐 | WS | futures.order_cancel_ids |
| cancelFuturesAllOpenOrders() | 🔐 | WS | futures.order_cancel_cp |
| updateFuturesOrder() | 🔐 | WS | futures.order_amend |
| getFuturesOrders() | 🔐 | WS | futures.order_list |
| getFuturesOrderStatus() | 🔐 | WS | futures.order_status |
Gate JavaScript FAQ
What does the Gate JavaScript SDK cover?
Gate supports Spot, Futures, Margin, Options, WebSockets, and WebSocket API workflows. The JavaScript guide covers the main REST and WebSocket integration patterns.
How do I authenticate private Gate API calls in JavaScript?
The public REST example above needs no credentials. For private calls, follow the authentication setup for gateio-api in the full tutorial, including the credentials or signer required by your exchange.
Gate authentication and setupDoes the Gate 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 Gate 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.