Gate Node.js SDK

Crawlable snapshot of the Gate Node.js SDK page with install and integration context.

What This SDK Covers

  • Gate REST API integrations for exchange-specific workflows.
  • Gate WebSocket support for market and account stream handling.
  • Node.js-friendly usage patterns for service and automation stacks.
  • Routable examples under /examples for implementation reference.

Install Package

npm install gateio-api
# or
pnpm add gateio-api
yarn add gateio-api

Quickstart REST Walkthrough

Easily start calling Gate's futures REST APIs in JavaScript.

- Install the Gate.com (previously Gate.io) JavaScript SDK via NPM: `npm install gateio-api`. - Import the RestClient class (REST API wrapper for Gate's APIs). - Create an authenticated RestClient instance with your API credentials. - Call REST API methods as functions and await the promise containing the response.

In this example, we:

- Create both a REST client and authenticated WebSocket client. - Subscribe to private futures balance and user trade topics. - Query futures account balance for `usdt` settlement. - Calculate 50% of available balance and submit a market futures order on `BTC_USDT`. - Log API and stream responses for visibility.

This setup demonstrates a practical flow where private WebSocket subscriptions provide live account updates while REST handles account queries and order submission.

For a full map of available REST API methods, check out the endpoint reference below.

Quickstart REST Example

/**
 * This example demonstrates a simple commented workflow of:
 * - initialising the RestClient and WebsocketClient for Gate.io exchange
 * - connecting to an accountโ€™s private websockets (to receive updates asynchronously)
 * - checking if connection is successful
 * - fetching available futures balance
 * - placing an order using 50% of the available balance
 **/
import { RestClient, WebsocketClient } from 'gateio-api';

// Define the account object with API key and secret
const account = {
  // Replace 'yourApiHere' with your actual API key or use environment variables
  key: process.env.API_KEY || 'yourApiHere',
  // Replace 'yourSecretHere' with your actual API secret or use environment variables
  secret: process.env.API_SECRET || 'yourSecretHere',
};

// Initialize the RestClient with the API credentials
const gateRestClient = new RestClient({
  apiKey: account.key,
  apiSecret: account.secret,
});

// initialise websocket client - if you want only public data, you can initialise the client without the apiKey and apiSecret, just WebsocketClient()
const gateWSClient = new WebsocketClient({
  apiKey: account.key,
  apiSecret: account.secret,
});

// Data received
gateWSClient.on('update', (data) => {
  console.info('data received: ', JSON.stringify(data));
});

async function subscribePrivateWs() {
  try {
    // Enter your user ID here
    const myUserID = '20011';

    //sub to balances updates
    const userBalances = {
      topic: 'futures.balances',
      payload: [myUserID],
    };

    //sub to trades updates
    const userTrades = {
      topic: 'futures.usertrades',
      payload: [myUserID, '!all'],
    };

    /**
     * Either send one topic (with params) at a time
     */
    // client.subscribe({
    //   topic: 'futures.usertrades',
    //   payload: [myUserID, '!all'],
    // }, 'perpFuturesUSDTV4');

    /**
     * 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:
     */
    gateWSClient.subscribe([userBalances, userTrades], 'perpFuturesUSDTV4');

    return true;
  } catch (e) {
    console.error('Req error: ', e);
    throw e;
  }
}

async function main() {
  try {
    await subscribePrivateWs();
    console.log('Subscribed to privateWs topics!');

    // Get futures account balance via REST
    const balances = await gateRestClient.getFuturesAccount({ settle: 'usdt' });

    // total usdt balance
    // const usdtBalance = Number(balances.total);

    // available usdt balance
    const availableBalance = Number(balances.available);

    // submit market order with 50% of the balance
    const orderAmount = availableBalance * 0.5;

    // Submit a market order with 50% of the balance
    const marketOrder = await gateRestClient.submitFuturesOrder({
      settle: 'usdt', // Specify the settlement currency
      contract: 'BTC_USDT', // Specify the contract
      size: orderAmount, // Order size: positive for long, negative for short, in USDT
      price: '0', // Market order, so price is set to '0'
      tif: 'ioc', // Time in force: 'ioc' (Immediate Or Cancel)
    });

    console.log('Order submitted:', marketOrder);
  } catch (e) {
    console.error(e);
    throw e;
  }
}

main();

// for more detailed ws connection, you can use a lot more listeners like below:

gateWSClient.on('open', (data) => {
  console.log('connected ', data?.wsKey);
});

// Something happened, attempting to reconnect
gateWSClient.on('reconnect', (data) => {
  console.log('reconnect: ', data);
});

// Reconnect successful
gateWSClient.on('reconnected', (data) => {
  console.log('reconnected: ', data);
});

// Connection closed. If unexpected, expect reconnect -> reconnected.
gateWSClient.on('close', (data) => {
  console.error('close: ', data);
});

// Reply to a request, e.g. "subscribe"/"unsubscribe"/"authenticate"
gateWSClient.on('response', (data) => {
  console.info('server reply: ', JSON.stringify(data), '\n');
});

gateWSClient.on('exception', (data) => {
  console.error('exception: ', data);
});

gateWSClient.on('authenticated', (data) => {
  console.error('authenticated: ', data);
});

Quickstart WebSocket Example

/* eslint-disable @typescript-eslint/no-unused-vars */
import { LogParams, WebsocketClient, WsTopicRequest } from 'gateio-api';

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const account = {
  key: process.env.API_KEY || 'apiKeyHere',
  secret: process.env.API_SECRET || 'apiSecretHere',
};

// Define a custom logger object to handle logging at different levels
const 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();

Quickstart WebSocket API Example

import { WebsocketAPIClient, WS_KEY_MAP } from 'gateio-api';

const account = {
  key: process.env.API_KEY || 'insert_key_here',
  secret: process.env.API_SECRET || 'insert_secret_here',
};

async function start() {
  const client = new WebsocketAPIClient({
    apiKey: account.key,
    apiSecret: account.secret,
    reauthWSAPIOnReconnect: true,
  });

  try {
    /**
     * Optional: authenticate in advance. This will prepare and authenticate a connection.
     * Useful to save time for the first request but completely optional. It will also happen automatically when you make your first request.
     */
    // console.log(new Date(), 'Authenticating in advance...');
    // await client.getWSClient().connectWSAPI('spotV4');
    // console.log(new Date(), 'Authenticating in advance...OK!');

    /* ============ SPOT TRADING EXAMPLES ============ */

    // SPOT ORDER PLACE - Submit a new spot order
    const newOrder = await client.submitNewSpotOrder({
      text: 't-my-custom-id',
      currency_pair: 'BTC_USDT',
      type: 'limit',
      account: 'spot',
      side: 'buy',
      amount: '1',
      price: '10000',
    });
    console.log(new Date(), 'Result of the order:', newOrder.data);

    // SPOT ORDER CANCEL - Cancel a specific spot order
    const cancelOrder = await client.cancelSpotOrder({
      order_id: '1700664330',
      currency_pair: 'BTC_USDT',
      account: 'spot',
    });
    console.log(new Date(), 'Cancel order result:', cancelOrder.data);

    // SPOT ORDER CANCEL BY IDS - Cancel orders by ID list
    const cancelOrdersByIds = await client.cancelSpotOrderById([
      {
        currency_pair: 'BTC_USDT',
        id: '1700664343',
        account: 'spot',
      },
    ]);
    console.log(
      new Date(),
      'Cancel orders by IDs result:',
      cancelOrdersByIds.data,
    );

    // SPOT ORDER CANCEL BY CURRENCY PAIR - Cancel all orders for a currency pair
    const cancelOrdersByCurrencyPair = await client.cancelSpotOrderForSymbol({
      currency_pair: 'BTC_USDT',
      side: 'buy',
      account: 'spot',
    });
    console.log(
      new Date(),
      'Cancel orders by currency pair result:',
      cancelOrdersByCurrencyPair.data,
    );

    // SPOT ORDER AMEND - Update an existing spot order
    const amendOrder = await client.updateSpotOrder({
      order_id: '1700664330',
      currency_pair: 'BTC_USDT',
      price: '12000',
      amount: '0.002',
      amend_text: 'price-update',
    });
    console.log(new Date(), 'Amend order result:', amendOrder.data);

    // SPOT ORDER STATUS - Get status of a specific spot order
    const orderStatus = await client.getSpotOrderStatus({
      order_id: '1700664330',
      currency_pair: 'BTC_USDT',
      account: 'spot',
    });
    console.log(new Date(), 'Order status result:', orderStatus.data);

    // SPOT ORDER LIST - Get list of spot orders
    const getOrders = await client.getSpotOrders({
      currency_pair: 'BTC_USDT',
      status: 'open',
      page: 1,
      limit: 10,
      account: 'spot',
      side: 'buy',
    });
    console.log(new Date(), 'Result of the orders:', getOrders.data);

    /* ============ FUTURES TRADING EXAMPLES ============ */

    /**
     * Gate has different websocket groups depending on the futures product.
     *
     * This affects which connection your command is sent to, so make sure to pass one matching your request. Look at WS_KEY_MAP (or the examples below) for details on the available product groups.
     */
    const FUTURES_CONNECTION_GROUP_WS_KEY = WS_KEY_MAP.perpFuturesUSDTV4;

    /**
     * Also optional, as for spot. Keep in mind the first parameter (wsKey) might vary depending on which WS URL is needed.
     */

    // console.log(new Date(), 'Authenticating in advance...');
    // await client.getWSClient().connectWSAPI(futuresConnectionGroup);
    // await client.getWSClient().connectWSAPI('perpFuturesUSDTV4');
    // await client.getWSClient().connectWSAPI('perpFuturesBTCV4');
    // await client.getWSClient().connectWSAPI('deliveryFuturesUSDTV4');
    // await client.getWSClient().connectWSAPI('perpFuturesBTCV4');
    // console.log(new Date(), 'Authenticating in advance...OK!');

    // FUTURES ORDER PLACE - Submit a new futures order
    const newFuturesOrder = await client.submitNewFuturesOrder(
      {
        contract: 'BTC_USDT',
        size: 10,
        price: '31503.28',
        tif: 'gtc',
        text: 't-my-custom-id',
        iceberg: 0,
        close: false,
        reduce_only: false,
        auto_size: undefined,
        stp_act: 'cn',
      },
      FUTURES_CONNECTION_GROUP_WS_KEY,
    );
    console.log(new Date(), 'New futures order result:', newFuturesOrder.data);

    // FUTURES ORDER BATCH PLACE - Submit multiple futures orders
    const batchFuturesOrders = await client.submitNewFuturesBatchOrder(
      [
        {
          contract: 'BTC_USDT',
          size: 10,
          price: '31403.18',
          tif: 'gtc',
          text: 't-my-custom-id-1',
        },
        {
          contract: 'ETH_USDT',
          size: 20,
          price: '2500.50',
          tif: 'gtc',
          text: 't-my-custom-id-2',
        },
      ],
      FUTURES_CONNECTION_GROUP_WS_KEY,
    );
    console.log(
      new Date(),
      'Batch futures orders result:',
      batchFuturesOrders.data,
    );

    // FUTURES ORDER CANCEL - Cancel a specific futures order
    const cancelFuturesOrder = await client.cancelFuturesOrder(
      {
        order_id: '74046514',
      },
      FUTURES_CONNECTION_GROUP_WS_KEY,
    );
    console.log(
      new Date(),
      'Cancel futures order result:',
      cancelFuturesOrder.data,
    );

    // FUTURES ORDER CANCEL BY IDS - Cancel futures orders by ID list
    const cancelFuturesOrdersByIds = await client.cancelFuturesOrderById(
      ['1694883366', '123'],
      FUTURES_CONNECTION_GROUP_WS_KEY,
    );
    console.log(
      new Date(),
      'Cancel futures orders by IDs result:',
      cancelFuturesOrdersByIds.data,
    );

    // FUTURES ORDER CANCEL ALL - Cancel all open futures orders
    const cancelAllFuturesOrders = await client.cancelFuturesAllOpenOrders(
      {
        contract: 'BTC_USDT',
        side: 'bid',
      },
      FUTURES_CONNECTION_GROUP_WS_KEY,
    );
    console.log(
      new Date(),
      'Cancel all futures orders result:',
      cancelAllFuturesOrders.data,
    );

    // FUTURES ORDER AMEND - Update an existing futures order
    const amendFuturesOrder = await client.updateFuturesOrder(
      {
        order_id: '74046543',
        price: '31303.18',
        size: 15,
        amend_text: 'price-and-size-update',
      },
      FUTURES_CONNECTION_GROUP_WS_KEY,
    );
    console.log(
      new Date(),
      'Amend futures order result:',
      amendFuturesOrder.data,
    );

    // FUTURES ORDER LIST - Get list of futures orders
    const getFuturesOrders = await client.getFuturesOrders(
      {
        contract: 'BTC_USDT',
        status: 'open',
        limit: 10,
        offset: 0,
        last_id: undefined,
        count_total: 0,
      },
      FUTURES_CONNECTION_GROUP_WS_KEY,
    );
    console.log(
      new Date(),
      'Futures orders list result:',
      getFuturesOrders.data,
    );

    // FUTURES ORDER STATUS - Get status of a specific futures order
    const futuresOrderStatus = await client.getFuturesOrderStatus(
      {
        order_id: '74046543',
      },
      FUTURES_CONNECTION_GROUP_WS_KEY,
    );
    console.log(
      new Date(),
      'Futures order status result:',
      futuresOrderStatus.data,
    );
  } catch (e) {
    console.error(new Date(), 'Error:', e);
  }
}

start();

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.

FunctionAUTHHTTP MethodEndpoint
getSystemMaintenanceStatus()GET/v1/public/system_info
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
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
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
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}
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}
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
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
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/{order_id}
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}
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
submitLoanOrder()๐Ÿ”POST/loan/collateral/orders
getLoanOrders()๐Ÿ”GET/loan/collateral/orders
getLoanOrder()๐Ÿ”GET/loan/collateral/orders/{order_id}
submitLoanRepay()๐Ÿ”POST/loan/collateral/repay
getLoanRepaymentHistory()๐Ÿ”GET/loan/collateral/repay_records
updateLoanCollateral()๐Ÿ”POST/loan/collateral/collaterals
getLoanCollateralRecords()๐Ÿ”GET/loan/collateral/collaterals
getLoanTotalAmount()๐Ÿ”GET/loan/collateral/total_amount
getLoanCollateralizationRatio()๐Ÿ”GET/loan/collateral/ltv
getLoanSupportedCurrencies()GET/loan/collateral/currencies
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
submitEth2Swap()๐Ÿ”POST/earn/staking/eth2/swap
getEth2RateHistory()๐Ÿ”GET/earn/staking/eth2/rate_records
getDualInvestmentProducts()GET/earn/dual/investment_plan
getDualInvestmentOrders()๐Ÿ”GET/earn/dual/orders
submitDualInvestmentOrder()๐Ÿ”POST/earn/dual/orders
getStructuredProducts()GET/earn/structured/products
getStructuredProductOrders()๐Ÿ”GET/earn/structured/orders
submitStructuredProductOrder()๐Ÿ”POST/earn/structured/orders
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
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
getOTCUserDefaultBank()๐Ÿ”GET/otc/get_user_def_bank
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
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
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()๐Ÿ”DELETE/crossex/position
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
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

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.

FunctionAUTHHTTP MethodEndpoint
submitNewSpotOrder()๐Ÿ”WSspot.order_place
cancelSpotOrder()๐Ÿ”WSspot.order_cancel
cancelSpotOrderById()๐Ÿ”WSspot.order_cancel_ids
cancelSpotOrderForSymbol()๐Ÿ”WSspot.order_cancel_cp
updateSpotOrder()๐Ÿ”WSspot.order_amend
getSpotOrderStatus()๐Ÿ”WSspot.order_status
getSpotOrders()๐Ÿ”WSspot.order_list
submitNewFuturesOrder()๐Ÿ”WSfutures.order_place
submitNewFuturesBatchOrder()๐Ÿ”WSfutures.order_batch_place
cancelFuturesOrder()๐Ÿ”WSfutures.order_cancel
cancelFuturesOrderById()๐Ÿ”WSfutures.order_cancel_ids
cancelFuturesAllOpenOrders()๐Ÿ”WSfutures.order_cancel_cp
updateFuturesOrder()๐Ÿ”WSfutures.order_amend
getFuturesOrders()๐Ÿ”WSfutures.order_list
getFuturesOrderStatus()๐Ÿ”WSfutures.order_status

Source: View endpoint map source

Reference Links

This is a static, crawlable snapshot. The interactive app loads after JavaScript starts and can refresh live data.