SDK guide
JavaScript
REST API + WebSocket

HTX JavaScript SDK

Build with the HTX 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 HTX SDK:

  • Spot
  • USDT-M Futures
  • Coin-M Futures
  • 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 HTX SDK

# Via your favourite package manager, e.g. npm:
npm install @siebly/htx-api
# or pnpm:
pnpm install @siebly/htx-api
# or yarn:
yarn add @siebly/htx-api

Quickstart Examples with the HTX 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.

/* eslint-disable @typescript-eslint/no-unused-vars */import { SpotClient } from '../../../src/index.js'; // This example shows how to call HTX Spot API endpoints for ORDER MANAGEMENT. /** * import { SpotClient } from '@siebly/htx-api'; */const client = new SpotClient({  apiKey: process.env.API_SPOT_KEY || 'insertApiKeyHere',  apiSecret: process.env.API_SPOT_SECRET || 'insertApiSecretHere',}); async function getOpenOrders() {  try {    const openOrders = await client.getOpenOrders({ symbol: 'btcusdt' });    console.log('Open Orders: ', JSON.stringify(openOrders, null, 2));  } catch (e) {    console.error('Get open orders error: ', e);  }} async function getOpenOrdersByClientId() {  try {    const order = await client.getOrderByClientId({      clientOrderId: 'your-client-order-id-here',    });    console.log('Order by Client ID: ', JSON.stringify(order, null, 2));  } catch (e) {    console.error('Get order by client id error: ', e);  }} async function getOrderHistory() {  try {    const orderHistory = await client.getOrderHistory({      symbol: 'btcusdt',      states: 'filled,canceled,partial-canceled',      size: 50,    });    console.log('Order History: ', JSON.stringify(orderHistory, null, 2));  } catch (e) {    console.error('Get order history error: ', e);  }} async function getOrderHistory48h() {  try {    const orderHistory = await client.getOrderHistory48h({      symbol: 'btcusdt',      size: 50,    });    console.log('Order History (48h): ', JSON.stringify(orderHistory, null, 2));  } catch (e) {    console.error('Get order history 48h error: ', e);  }} async function getMatchResults() {  try {    const matchResults = await client.getMatchResults({      symbol: 'btcusdt',      size: 50,    });    console.log('Match Results: ', JSON.stringify(matchResults, null, 2));  } catch (e) {    console.error('Get match results error: ', e);  }} async function cancelOrderById() {  try {    const cancelResult = await client.cancelOrderById({      orderId: '1620028655831163',      symbol: 'btcusdt',    });    console.log('Cancel Order Result: ', JSON.stringify(cancelResult, null, 2));  } catch (e) {    console.error('Cancel order by id error: ', e);  }} async function cancelOrderByClientId() {  try {    const cancelResult = await client.cancelOrderByClientId({      'client-order-id': 'your-client-order-id-here',    });    console.log(      'Cancel by Client ID Result: ',      JSON.stringify(cancelResult, null, 2),    );  } catch (e) {    console.error('Cancel order by client id error: ', e);  }} async function cancelAllOrders() {  try {    const cancelAllResult = await client.cancelAllOrders({ symbol: 'btcusdt' });    console.log(      'Cancel All Orders Result: ',      JSON.stringify(cancelAllResult, null, 2),    );  } catch (e) {    console.error('Cancel all orders error: ', e);  }} async function setCancelAllAfter() {  try {    const cancelAfterResult = await client.setCancelAllAfter({ timeout: 120 });    console.log(      'Cancel All After Result: ',      JSON.stringify(cancelAfterResult, null, 2),    );  } catch (e) {    console.error('Set cancel all after error: ', e);  }} // Uncomment the function you want to test: // getOpenOrders();// getOpenOrdersByClientId();// getOrderHistory();// getOrderHistory48h();// etMatchResults();// cancelOrderById();// cancelOrderByClientId();// cancelAllOrders();// setCancelAllAfter();
Full HTX course

HTX API JavaScript Tutorial

A practical JavaScript guide to using @siebly/htx-api across HTX Spot and Futures REST API calls, public and private streams, production order workflows, WebSocket API commands, API hosts, proxies, and reconnect recovery.

Spot and V5 Futures REST API calls
Public and private WebSocket streams
Spot and USDT-M Futures order workflows
REST API and WebSocket proxy examples
REST API
WebSocket Streams
WebSocket API
Examples

Your app / service

bot, dashboard, worker

@siebly/htx-api

SpotClient, FuturesClient, WebsocketClient, WebsocketAPIClient

HTX APIs

Spot, USDT-M Futures, Coin-M Futures, WebSocket streams, and WebSocket API commands

Common HTX implementation tasks

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.

SpotClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in SpotClient.ts.

FunctionAUTHHTTP MethodEndpoint
getMarketStatus()GET/v2/market-status
getTimestamp()GET/v1/common/timestamp
getTradingSymbols()GET/v2/settings/common/symbols
getCurrencies()GET/v2/settings/common/currencies
getCurrencysSettings()GET/v1/settings/common/currencys
getSymbolsSettings()GET/v1/settings/common/symbols
getMarketSymbolsSettings()GET/v1/settings/common/market-symbols
getChainsInfo()GET/v1/settings/common/chains
getReferenceCurrencies()GET/v2/reference/currencies
getKlines()GET/market/history/kline
getTicker()GET/market/detail/merged
getTickers()GET/market/tickers
getMarketDepth()GET/market/depth
getLastTrade()GET/market/trade
getHistoryTrades()GET/market/history/trade
get24hMarketSummary()GET/market/detail
getFullOrderBook()GET/market/fullMbp
getAccounts()🔐GET/v1/account/accounts
getAccountBalance()🔐GET/v1/account/accounts/{accountId}/balance
getAccountValuation()🔐GET/v2/account/valuation
getAssetValuation()🔐GET/v2/account/asset-valuation
submitTransfer()🔐POST/v1/account/transfer
getAccountHistory()🔐GET/v1/account/history
getAccountLedger()🔐GET/v2/account/ledger
submitV2AccountTransfer()🔐POST/v2/account/transfer
submitFuturesTransfer()🔐POST/v1/futures/transfer
getPointBalance()🔐GET/v2/point/account
submitPointTransfer()🔐POST/v2/point/transfer
getAccountSwitchUserInfo()🔐GET/v1/account/switch/user/info
getAccountOverviewInfo()🔐GET/v1/account/overview/info
updateFeeDeductionMethod()🔐POST/v1/account/fee/switch
submitOrder()🔐POST/v1/order/orders/place
submitBatchOrders()🔐POST/v1/order/batch-orders
submitMarginOrder()🔐POST/v1/order/auto/place
cancelOrderById()🔐POST/v1/order/orders/{orderId}/submitcancel
cancelOrderByClientId()🔐POST/v1/order/orders/submitCancelClientOrder
cancelAllOrders()🔐GET/v1/order/cancelAllOrders
getOpenOrders()🔐GET/v1/order/openOrders
batchCancelOpenOrders()🔐POST/v1/order/orders/batchCancelOpenOrders
batchCancelOrders()🔐POST/v1/order/orders/batchcancel
setCancelAllAfter()🔐POST/v2/algo-orders/cancel-all-after
getOrder()🔐GET/v1/order/orders/{orderId}
getOrderByClientId()🔐GET/v1/order/orders/getClientOrder
getOrderMatch()🔐GET/v1/order/orders/{orderId}/matchresults
getOrderHistory()🔐GET/v1/order/orders
getOrderHistory48h()🔐GET/v1/order/history
getMatchResults()🔐GET/v1/order/matchresults
getFeeRate()🔐GET/v2/reference/transact-fee-rate
placeConditionalOrder()🔐POST/v2/algo-orders
cancelConditionalOrders()🔐POST/v2/algo-orders/cancellation
getOpenConditionalOrders()🔐GET/v2/algo-orders/opening
getConditionalOrderHistory()🔐GET/v2/algo-orders/history
getConditionalOrder()🔐GET/v2/algo-orders/specific
getRepaymentRecords()🔐GET/v2/account/repayment
repayMarginLoan()🔐POST/v2/account/repayment
transferSpotToIsolatedMargin()🔐POST/v1/dw/transfer-in/margin
transferIsolatedMarginToSpot()🔐POST/v1/dw/transfer-out/margin
getMarginLoanInfo()🔐GET/v1/margin/loan-info
requestMarginLoan()🔐POST/v1/margin/orders
repayMarginLoanIsolated()🔐POST/v1/margin/orders/{orderId}/repay
getMarginLoanOrders()🔐GET/v1/margin/loan-orders
getMarginAccountBalance()🔐GET/v1/margin/accounts/balance
transferSpotToCrossMargin()🔐POST/v1/cross-margin/transfer-in
transferCrossMarginToSpot()🔐POST/v1/cross-margin/transfer-out
getCrossMarginLoanInfo()🔐GET/v1/cross-margin/loan-info
requestCrossMarginLoan()🔐POST/v1/cross-margin/orders
repayCrossMarginLoan()🔐POST/v1/cross-margin/orders/{orderId}/repay
getCrossMarginLoanOrders()🔐GET/v1/cross-margin/loan-orders
getCrossMarginBalance()🔐GET/v1/cross-margin/accounts/balance
getCrossMarginLimit()🔐GET/v2/margin/limit
getDepositAddress()🔐GET/v2/account/deposit/address
getWithdrawQuota()🔐GET/v2/account/withdraw/quota
getWithdrawAddress()🔐GET/v2/account/withdraw/address
submitWithdraw()🔐POST/v1/dw/withdraw/api/create
getWithdrawByClientId()🔐GET/v1/query/withdraw/client-order-id
cancelWithdraw()🔐POST/v1/dw/withdraw-virtual/{withdrawId}/cancel
getDepositWithdrawHistory()🔐GET/v1/query/deposit-withdraw
getVaspList()GET/v1/query/vasp-list
getBrokerUserRebateStatus()🔐GET/broker/v1/user_rebate_status
setBrokerSubUserFeeRate()🔐POST/broker/v1/sub-user/fee_rate/add
getBrokerAccountCapitalSnapshot()🔐POST/broker/v1/account_capital_snapshot_everyday
updateSubUserDeductMode()🔐POST/v2/sub-user/deduct-mode
getSubUserApiKey()🔐GET/v2/user/api-key
getUserUid()🔐GET/v2/user/uid
getSubUserList()🔐GET/v2/sub-user/user-list
updateSubUserLockStatus()🔐POST/v2/sub-user/management
getSubUserStatus()🔐GET/v2/sub-user/user-state
setSubUserTradableMarket()🔐POST/v2/sub-user/tradable-market
setSubUserTransferPermissions()🔐POST/v2/sub-user/transferability
getSubUserAccounts()🔐GET/v2/sub-user/account-list
createSubUserApiKey()🔐POST/v2/sub-user/api-key-generation
updateSubUserApiKey()🔐POST/v2/sub-user/api-key-modification
deleteSubUserApiKey()🔐POST/v2/sub-user/api-key-deletion
submitSubUserTransfer()🔐POST/v1/subuser/transfer
getSubUserDepositAddress()🔐GET/v2/sub-user/deposit-address
getSubUserDepositHistory()🔐GET/v2/sub-user/query-deposit
getSubUsersAggregatedBalance()🔐GET/v1/subuser/aggregate-balance
getSubUserBalance()🔐GET/v1/account/accounts/{subUid}
getSubUserEntrustUserList()🔐GET/v2/sub-user/entrust-user-list
getSubUserManagedTransferHistory()🔐GET/v2/sub-user/managed-transfer-history
getReferralRebateDetail()🔐GET/v2/invitee/rebate/detail
getReferralRebateHistory()🔐GET/v2/invitee/rebate/history
getReferralAllRebateDetail()🔐GET/v2/invitee/rebate/all_rebate/detail
getReferralMultipleRebateDetail()🔐GET/v2/invitee/rebate/batcher_rebate/detail
getReferralInvitedUserList()🔐GET/v2/invitee/rebate/referrals
getP2POrderHistory()GET/v1/api/c2c/order/history
getEarnProjectList()🔐GET/v1/earn/project/queryEarnProjectList
earnSubscribe()🔐POST/v1/earn/order/demand/add
earnRedeem()🔐POST/v1/earn/order/demand/redeem-order
getEarnUserAssets()🔐GET/v1/earn/order/user/assets/list

FuturesClient.ts

This table includes all endpoints from the official Exchange API docs and corresponding SDK functions for each endpoint that are found in FuturesClient.ts.

FunctionAUTHHTTP MethodEndpoint
getTimestamp()GET/api/v1/timestamp
getHeartbeat()GET/heartbeat/
getLinearSwapAccountType()🔐GET/linear-swap-api/v3/swap_unified_account_type
updateLinearSwapAccountType()🔐POST/linear-swap-api/v3/swap_switch_account_type
getLinearSwapFundingRate()GET/linear-swap-api/v1/swap_funding_rate
getLinearSwapFundingRates()GET/linear-swap-api/v1/swap_batch_funding_rate
getLinearSwapHistoricalFundingRate()GET/linear-swap-api/v1/swap_historical_funding_rate
getLinearSwapLiquidationOrders()GET/linear-swap-api/v3/swap_liquidation_orders
getLinearSwapSettlementRecords()GET/linear-swap-api/v1/swap_settlement_records
getLinearSwapNetAccountRatio()GET/linear-swap-api/v1/swap_elite_account_ratio
getLinearSwapNetPositionRatio()GET/linear-swap-api/v1/swap_elite_position_ratio
getLinearSwapIsolatedSystemStatus()GET/linear-swap-api/v1/swap_api_state
getLinearSwapCrossTieredMargin()GET/linear-swap-api/v1/swap_cross_ladder_margin
getLinearSwapIsolatedTieredMargin()GET/linear-swap-api/v1/swap_ladder_margin
getLinearSwapEstimatedSettlementPrice()GET/linear-swap-api/v1/swap_estimated_settlement_price
getLinearSwapIsolatedAdjustFactor()GET/linear-swap-api/v1/swap_adjustfactor
getLinearSwapCrossAdjustFactor()GET/linear-swap-api/v1/swap_cross_adjustfactor
getLinearSwapRiskReserveBalance()GET/v1/insurance_fund_info
getLinearSwapRiskReserveHistory()GET/v1/insurance_fund_history
getLinearSwapContractPriceLimit()GET/linear-swap-api/v1/swap_price_limit
getLinearSwapOpenInterest()GET/linear-swap-api/v1/swap_open_interest
getLinearSwapContractInfo()GET/linear-swap-api/v1/swap_contract_info
getLinearSwapIndexPrice()GET/linear-swap-api/v1/swap_index
getLinearSwapIndexConstituents()GET/linear-swap-api/market/swap_contract_constituents
getLinearSwapContractElements()GET/linear-swap-api/v1/swap_query_elements
getLinearSwapMarketDepth()GET/linear-swap-ex/market/depth
getLinearSwapMarketBbo()GET/linear-swap-ex/market/bbo
getLinearSwapKlines()GET/linear-swap-ex/market/history/kline
getLinearSwapMarkKlines()GET/index/market/history/linear_swap_mark_price_kline
getLinearSwapTicker()GET/linear-swap-ex/market/detail/merged
getLinearSwapTickers()GET/v2/linear-swap-ex/market/detail/batch_merged
getLinearSwapLastTrade()GET/linear-swap-ex/market/trade
getLinearSwapTradeHistory()GET/linear-swap-ex/market/history/trade
getLinearSwapHistoricalOpenInterest()GET/linear-swap-api/v1/swap_his_open_interest
getLinearSwapPremiumIndexKlines()GET/index/market/history/linear_swap_premium_index_kline
getLinearSwapFundingRateKlines()GET/index/market/history/linear_swap_estimated_rate_kline
getLinearSwapBasisData()GET/index/market/history/linear_swap_basis
getLinearSwapAssetValuation()🔐POST/linear-swap-api/v1/swap_balance_valuation
getLinearSwapIsolatedAccountInfo()🔐POST/linear-swap-api/v1/swap_account_info
getLinearSwapCrossAccountInfo()🔐POST/linear-swap-api/v1/swap_cross_account_info
getLinearSwapIsolatedPositions()🔐POST/linear-swap-api/v1/swap_position_info
getLinearSwapCrossPositions()🔐POST/linear-swap-api/v1/swap_cross_position_info
getLinearSwapIsolatedAccountFull()🔐POST/linear-swap-api/v1/swap_account_position_info
getLinearSwapCrossAccountFull()🔐POST/linear-swap-api/v1/swap_cross_account_position_info
updateLinearSwapSubPermissions()🔐POST/linear-swap-api/v1/swap_sub_auth
getLinearSwapSubPermissions()🔐GET/linear-swap-api/v1/swap_sub_auth_list
getLinearSwapIsolatedSubAccounts()🔐POST/linear-swap-api/v1/swap_sub_account_list
getLinearSwapCrossSubAccounts()🔐POST/linear-swap-api/v1/swap_cross_sub_account_list
getLinearSwapIsolatedSubAccountsAssets()🔐POST/linear-swap-api/v1/swap_sub_account_info_list
getLinearSwapCrossSubAccountsAssets()🔐POST/linear-swap-api/v1/swap_cross_sub_account_info_list
getLinearSwapIsolatedSubAccountAssets()🔐POST/linear-swap-api/v1/swap_sub_account_info
getLinearSwapCrossSubAccountAssets()🔐POST/linear-swap-api/v1/swap_cross_sub_account_info
getLinearSwapIsolatedSubPositions()🔐POST/linear-swap-api/v1/swap_sub_position_info
getLinearSwapCrossSubPositions()🔐POST/linear-swap-api/v1/swap_cross_sub_position_info
getLinearSwapFinancialRecords()🔐POST/linear-swap-api/v3/swap_financial_record
getLinearSwapFinancialRecordsExact()🔐POST/linear-swap-api/v3/swap_financial_record_exact
getLinearSwapIsolatedAvailableLeverage()🔐POST/linear-swap-api/v1/swap_available_level_rate
getLinearSwapCrossAvailableLeverage()🔐POST/linear-swap-api/v1/swap_cross_available_level_rate
getLinearSwapOrderLimit()🔐POST/linear-swap-api/v1/swap_order_limit
getLinearSwapFee()🔐POST/linear-swap-api/v1/swap_fee
getLinearSwapIsolatedTransferLimit()🔐POST/linear-swap-api/v1/swap_transfer_limit
getLinearSwapCrossTransferLimit()🔐POST/linear-swap-api/v1/swap_cross_transfer_limit
getLinearSwapIsolatedPositionLimit()🔐POST/linear-swap-api/v1/swap_position_limit
getLinearSwapCrossPositionLimit()🔐POST/linear-swap-api/v1/swap_cross_position_limit
getLinearSwapIsolatedLeverageLimits()🔐POST/linear-swap-api/v1/swap_lever_position_limit
getLinearSwapCrossLeverageLimits()🔐POST/linear-swap-api/v1/swap_cross_lever_position_limit
transferLinearSwapMasterSub()🔐POST/linear-swap-api/v1/swap_master_sub_transfer
getLinearSwapMasterSubTransfers()🔐POST/linear-swap-api/v1/swap_master_sub_transfer_record
transferLinearSwapInner()🔐POST/linear-swap-api/v1/swap_transfer_inner
setLinearSwapCancelAfter()🔐POST/linear-swap-api/v1/linear-cancel-after
getLinearSwapCrossTradeState()🔐GET/linear-swap-api/v1/swap_cross_trade_state
getLinearSwapCrossTransferState()🔐GET/linear-swap-api/v1/swap_cross_transfer_state
updateLinearSwapIsolatedPositionMode()🔐POST/linear-swap-api/v1/swap_switch_position_mode
updateLinearSwapCrossPositionMode()🔐POST/linear-swap-api/v1/swap_cross_switch_position_mode
submitLinearSwapIsolatedOrder()🔐POST/linear-swap-api/v1/swap_order
submitLinearSwapCrossOrder()🔐POST/linear-swap-api/v1/swap_cross_order
submitLinearSwapIsolatedBatchOrders()🔐POST/linear-swap-api/v1/swap_batchorder
submitLinearSwapCrossBatchOrders()🔐POST/linear-swap-api/v1/swap_cross_batchorder
cancelLinearSwapIsolatedOrder()🔐POST/linear-swap-api/v1/swap_cancel
cancelLinearSwapCrossOrder()🔐POST/linear-swap-api/v1/swap_cross_cancel
cancelLinearSwapIsolatedAllOrders()🔐POST/linear-swap-api/v1/swap_cancelall
cancelLinearSwapCrossAllOrders()🔐POST/linear-swap-api/v1/swap_cross_cancelall
updateLinearSwapIsolatedLeverage()🔐POST/linear-swap-api/v1/swap_switch_lever_rate
updateLinearSwapCrossLeverage()🔐POST/linear-swap-api/v1/swap_cross_switch_lever_rate
getLinearSwapIsolatedOrderInfo()🔐POST/linear-swap-api/v1/swap_order_info
getLinearSwapCrossOrderInfo()🔐POST/linear-swap-api/v1/swap_cross_order_info
getLinearSwapIsolatedOrderDetail()🔐POST/linear-swap-api/v1/swap_order_detail
getLinearSwapCrossOrderDetail()🔐POST/linear-swap-api/v1/swap_cross_order_detail
getLinearSwapIsolatedOpenOrders()🔐POST/linear-swap-api/v1/swap_openorders
getLinearSwapCrossOpenOrders()🔐POST/linear-swap-api/v1/swap_cross_openorders
getLinearSwapIsolatedHistoryOrders()🔐POST/linear-swap-api/v3/swap_hisorders
getLinearSwapCrossHistoryOrders()🔐POST/linear-swap-api/v3/swap_cross_hisorders
getLinearSwapIsolatedHistoryOrdersExact()🔐POST/linear-swap-api/v3/swap_hisorders_exact
getLinearSwapCrossHistoryOrdersExact()🔐POST/linear-swap-api/v3/swap_cross_hisorders_exact
getLinearSwapIsolatedFills()🔐POST/linear-swap-api/v3/swap_matchresults
getLinearSwapCrossFills()🔐POST/linear-swap-api/v3/swap_cross_matchresults
getLinearSwapIsolatedFillsExact()🔐POST/linear-swap-api/v3/swap_matchresults_exact
getLinearSwapCrossFillsExact()🔐POST/linear-swap-api/v3/swap_cross_matchresults_exact
submitLinearSwapIsolatedLightningCloseOrder()🔐POST/linear-swap-api/v1/swap_lightning_close_position
submitLinearSwapCrossLightningCloseOrder()🔐POST/linear-swap-api/v1/swap_cross_lightning_close_position
getLinearSwapIsolatedPositionMode()🔐GET/linear-swap-api/v1/swap_position_side
getLinearSwapCrossPositionMode()🔐GET/linear-swap-api/v1/swap_cross_position_side
submitLinearSwapIsolatedTriggerOrder()🔐POST/linear-swap-api/v1/swap_trigger_order
submitLinearSwapCrossTriggerOrder()🔐POST/linear-swap-api/v1/swap_cross_trigger_order
cancelLinearSwapIsolatedTriggerOrder()🔐POST/linear-swap-api/v1/swap_trigger_cancel
cancelLinearSwapCrossTriggerOrder()🔐POST/linear-swap-api/v1/swap_cross_trigger_cancel
cancelLinearSwapIsolatedAllTriggerOrders()🔐POST/linear-swap-api/v1/swap_trigger_cancelall
cancelLinearSwapCrossAllTriggerOrders()🔐POST/linear-swap-api/v1/swap_cross_trigger_cancelall
getLinearSwapIsolatedTriggerOpenOrders()🔐POST/linear-swap-api/v1/swap_trigger_openorders
getLinearSwapCrossTriggerOpenOrders()🔐POST/linear-swap-api/v1/swap_cross_trigger_openorders
getLinearSwapIsolatedTriggerHistoryOrders()🔐POST/linear-swap-api/v1/swap_trigger_hisorders
getLinearSwapCrossTriggerHistoryOrders()🔐POST/linear-swap-api/v1/swap_cross_trigger_hisorders
submitLinearSwapIsolatedTpslOrder()🔐POST/linear-swap-api/v1/swap_tpsl_order
submitLinearSwapCrossTpslOrder()🔐POST/linear-swap-api/v1/swap_cross_tpsl_order
cancelLinearSwapIsolatedTpslOrder()🔐POST/linear-swap-api/v1/swap_tpsl_cancel
cancelLinearSwapCrossTpslOrder()🔐POST/linear-swap-api/v1/swap_cross_tpsl_cancel
cancelLinearSwapIsolatedAllTpslOrders()🔐POST/linear-swap-api/v1/swap_tpsl_cancelall
cancelLinearSwapCrossAllTpslOrders()🔐POST/linear-swap-api/v1/swap_cross_tpsl_cancelall
getLinearSwapIsolatedTpslOpenOrders()🔐POST/linear-swap-api/v1/swap_tpsl_openorders
getLinearSwapCrossTpslOpenOrders()🔐POST/linear-swap-api/v1/swap_cross_tpsl_openorders
getLinearSwapIsolatedTpslHistoryOrders()🔐POST/linear-swap-api/v1/swap_tpsl_hisorders
getLinearSwapCrossTpslHistoryOrders()🔐POST/linear-swap-api/v1/swap_cross_tpsl_hisorders
getLinearSwapIsolatedRelationTpslOrder()🔐POST/linear-swap-api/v1/swap_relation_tpsl_order
getLinearSwapCrossRelationTpslOrder()🔐POST/linear-swap-api/v1/swap_cross_relation_tpsl_order
submitLinearSwapIsolatedTrailingOrder()🔐POST/linear-swap-api/v1/swap_track_order
submitLinearSwapCrossTrailingOrder()🔐POST/linear-swap-api/v1/swap_cross_track_order
cancelLinearSwapIsolatedTrailingOrder()🔐POST/linear-swap-api/v1/swap_track_cancel
cancelLinearSwapCrossTrailingOrder()🔐POST/linear-swap-api/v1/swap_cross_track_cancel
cancelLinearSwapIsolatedAllTrailingOrders()🔐POST/linear-swap-api/v1/swap_track_cancelall
cancelLinearSwapCrossAllTrailingOrders()🔐POST/linear-swap-api/v1/swap_cross_track_cancelall
getLinearSwapIsolatedTrailingOpenOrders()🔐POST/linear-swap-api/v1/swap_track_openorders
getLinearSwapCrossTrailingOpenOrders()🔐POST/linear-swap-api/v1/swap_cross_track_openorders
getLinearSwapIsolatedTrailingHistoryOrders()🔐POST/linear-swap-api/v1/swap_track_hisorders
getLinearSwapCrossTrailingHistoryOrders()🔐POST/linear-swap-api/v1/swap_cross_track_hisorders
getLinearSwapUnifiedAccountInfo()🔐GET/linear-swap-api/v3/unified_account_info
getLinearSwapUnifiedAssets()🔐GET/linear-swap-api/v3/linear_swap_overview_account_info
updateLinearSwapUnifiedFeeMethod()🔐POST/linear-swap-api/v3/linear_swap_fee_switch
getLinearSwapUnifiedMarginAdjustments()🔐GET/linear-swap-api/v3/fix_position_margin_change_record
updateLinearSwapUnifiedMargin()🔐POST/linear-swap-api/v3/fix_position_margin_change
getMultiAssetAccountBalance()🔐GET/v5/account/balance
getMultiAssetMode()🔐GET/v5/account/asset_mode
updateMultiAssetMode()🔐POST/v5/account/asset_mode
updateMultiAssetFeeCurrency()🔐POST/v5/account/fee_deduction_currency
getMultiAssetFeeCurrency()🔐GET/v5/account/fee_deduction_currency
getMultiAssetBills()🔐GET/v5/account/bills
submitMultiAssetOrder()🔐POST/v5/trade/order
submitMultiAssetBatchOrders()🔐POST/v5/trade/batch_orders
cancelMultiAssetOrder()🔐POST/v5/trade/cancel_order
cancelMultiAssetBatchOrders()🔐POST/v5/trade/cancel_batch_orders
cancelMultiAssetAllOrders()🔐POST/v5/trade/cancel_all_orders
closeMultiAssetPosition()🔐POST/v5/trade/position
closeMultiAssetAllPositions()🔐POST/v5/trade/position_all
getMultiAssetOpenOrders()🔐GET/v5/trade/order/opens
getMultiAssetFills()🔐GET/v5/trade/order/details
getMultiAssetOrderHistory()🔐GET/v5/trade/order/history
getMultiAssetOrderInfo()🔐GET/v5/trade/order
setMultiAssetCancelAfter()🔐POST/v5/trade/cancel-after
getMultiAssetPositions()🔐GET/v5/trade/position/opens
getMultiAssetLeverage()🔐GET/v5/position/lever
updateMultiAssetLeverage()🔐POST/v5/position/lever
getMultiAssetPositionMode()🔐GET/v5/position/mode
updateMultiAssetPositionMode()🔐POST/v5/position/mode
getMultiAssetRiskLimit()🔐GET/v5/position/risk/limit
getMultiAssetRiskLimitTiers()🔐GET/v5/position/risk/limit_tier
adjustMultiAssetMargin()🔐POST/v5/position/margin
getMultiAssetMarketRiskLimit()🔐GET/v5/market/risk/limit
getMultiAssetFeeCurrencies()🔐GET/v5/market/assets_deduction_currency
getMultiAssetCollateralAssets()🔐GET/v5/market/multi_assets_margin
getCoinMDeliveryAdjustFactor()GET/api/v1/contract_adjustfactor
getCoinMDeliveryHistoricalOpenInterest()GET/api/v1/contract_his_open_interest
getCoinMDeliveryTieredMargin()GET/api/v1/contract_ladder_margin
getCoinMDeliveryAccountRatio()GET/api/v1/contract_elite_account_ratio
getCoinMDeliveryPositionRatio()GET/api/v1/contract_elite_position_ratio
getCoinMDeliveryLiquidationOrders()GET/api/v3/contract_liquidation_orders
getCoinMDeliverySettlementRecords()GET/api/v1/contract_settlement_records
getCoinMDeliveryRiskReserveBalance()GET/v1/insurance_fund_info
getCoinMDeliveryRiskReserveHistory()GET/v1/insurance_fund_history
getCoinMDeliveryContractLimit()GET/api/v1/contract_price_limit
getCoinMDeliveryOpenInterest()GET/api/v1/contract_open_interest
getCoinMDeliveryDeliveryPrice()GET/api/v1/contract_delivery_price
getCoinMDeliveryEstimatedSettlementPrice()GET/api/v1/contract_estimated_settlement_price
getCoinMDeliverySystemStatus()GET/api/v1/contract_api_state
getCoinMDeliveryContractInfo()GET/api/v1/contract_contract_info
getCoinMDeliveryIndexPrice()GET/api/v1/contract_index
getCoinMDeliveryIndexConstituents()GET/api/market/contract_constituents
getCoinMDeliveryContractElements()GET/api/v1/contract_query_elements
getCoinMDeliveryMarketDepth()GET/market/depth
getCoinMDeliveryMarketBbo()GET/market/bbo
getCoinMDeliveryKlines()GET/market/history/kline
getCoinMDeliveryMarkKlines()GET/index/market/history/mark_price_kline
getCoinMDeliveryTicker()GET/market/detail/merged
getCoinMDeliveryTickers()GET/v2/market/detail/batch_merged
getCoinMDeliveryLastTrade()GET/market/trade
getCoinMDeliveryTradeHistory()GET/market/history/trade
getCoinMDeliveryIndexKlines()GET/index/market/history/index
getCoinMDeliveryBasisData()GET/index/market/history/basis
getCoinMDeliveryAssetValuation()🔐POST/api/v1/contract_balance_valuation
getCoinMDeliveryAccountInfo()🔐POST/api/v1/contract_account_info
getCoinMDeliveryPositionInfo()🔐POST/api/v1/contract_position_info
updateCoinMDeliverySubPermissions()🔐POST/api/v1/contract_sub_auth
getCoinMDeliverySubPermissions()🔐GET/api/v1/contract_sub_auth_list
getCoinMDeliverySubAccounts()🔐POST/api/v1/contract_sub_account_list
getCoinMDeliverySubAccountsAssets()🔐POST/api/v1/contract_sub_account_info_list
getCoinMDeliverySubAccountAssets()🔐POST/api/v1/contract_sub_account_info
getCoinMDeliverySubPositionInfo()🔐POST/api/v1/contract_sub_position_info
getCoinMDeliveryFinancialRecords()🔐POST/api/v3/contract_financial_record
getCoinMDeliveryFinancialRecordsExact()🔐POST/api/v3/contract_financial_record_exact
getCoinMDeliveryUserSettlementRecords()🔐POST/api/v1/contract_user_settlement_records
getCoinMDeliveryOrderLimit()🔐POST/api/v1/contract_order_limit
getCoinMDeliveryFee()🔐POST/api/v1/contract_fee
getCoinMDeliveryTransferLimit()🔐POST/api/v1/contract_transfer_limit
getCoinMDeliveryPositionLimit()🔐POST/api/v1/contract_position_limit
getCoinMDeliveryAccountFull()🔐POST/api/v1/contract_account_position_info
transferCoinMDeliveryMasterSub()🔐POST/api/v1/contract_master_sub_transfer
getCoinMDeliveryMasterSubTransfers()🔐POST/api/v1/contract_master_sub_transfer_record
getCoinMDeliveryApiStatus()🔐GET/api/v1/contract_api_trading_status
getCoinMDeliveryAvailableLeverage()🔐POST/api/v1/contract_available_level_rate
setCoinMDeliveryCancelAfter()🔐POST/api/v1/contract-cancel-after
submitCoinMDeliveryOrder()🔐POST/api/v1/contract_order
submitCoinMDeliveryBatchOrders()🔐POST/api/v1/contract_batchorder
cancelCoinMDeliveryOrder()🔐POST/api/v1/contract_cancel
cancelCoinMDeliveryAllOrders()🔐POST/api/v1/contract_cancelall
updateCoinMDeliveryLeverage()🔐POST/api/v1/contract_switch_lever_rate
getCoinMDeliveryOrderInfo()🔐POST/api/v1/contract_order_info
getCoinMDeliveryOrderDetail()🔐POST/api/v1/contract_order_detail
getCoinMDeliveryOpenOrders()🔐POST/api/v1/contract_openorders
getCoinMDeliveryHistoryOrders()🔐POST/api/v3/contract_hisorders
getCoinMDeliveryHistoryOrdersExact()🔐POST/api/v3/contract_hisorders_exact
getCoinMDeliveryFills()🔐POST/api/v3/contract_matchresults
getCoinMDeliveryFillsExact()🔐POST/api/v3/contract_matchresults_exact
submitCoinMDeliveryLightningCloseOrder()🔐POST/api/v1/lightning_close_position
submitCoinMDeliveryTriggerOrder()🔐POST/api/v1/contract_trigger_order
cancelCoinMDeliveryTriggerOrder()🔐POST/api/v1/contract_trigger_cancel
cancelCoinMDeliveryAllTriggerOrders()🔐POST/api/v1/contract_trigger_cancelall
getCoinMDeliveryTriggerOpenOrders()🔐POST/api/v1/contract_trigger_openorders
getCoinMDeliveryTriggerHistoryOrders()🔐POST/api/v1/contract_trigger_hisorders
submitCoinMDeliveryTpslOrder()🔐POST/api/v1/contract_tpsl_order
cancelCoinMDeliveryTpslOrder()🔐POST/api/v1/contract_tpsl_cancel
cancelCoinMDeliveryAllTpslOrders()🔐POST/api/v1/contract_tpsl_cancelall
getCoinMDeliveryTpslOpenOrders()🔐POST/api/v1/contract_tpsl_openorders
getCoinMDeliveryTpslHistoryOrders()🔐POST/api/v1/contract_tpsl_hisorders
getCoinMDeliveryRelationTpslOrder()🔐POST/api/v1/contract_relation_tpsl_order
submitCoinMDeliveryTrailingOrder()🔐POST/api/v1/contract_track_order
cancelCoinMDeliveryTrailingOrder()🔐POST/api/v1/contract_track_cancel
cancelCoinMDeliveryAllTrailingOrders()🔐POST/api/v1/contract_track_cancelall
getCoinMDeliveryTrailingOpenOrders()🔐POST/api/v1/contract_track_openorders
getCoinMDeliveryTrailingHistoryOrders()🔐POST/api/v1/contract_track_hisorders
getCoinMPerpAdjustFactor()GET/swap-api/v1/swap_adjustfactor
getCoinMPerpHistoricalOpenInterest()GET/swap-api/v1/swap_his_open_interest
getCoinMPerpTieredMargin()GET/swap-api/v1/swap_ladder_margin
getCoinMPerpAccountRatio()GET/swap-api/v1/swap_elite_account_ratio
getCoinMPerpPositionRatio()GET/swap-api/v1/swap_elite_position_ratio
getCoinMPerpEstimatedSettlementPrice()GET/swap-api/v1/swap_estimated_settlement_price
getCoinMPerpSystemStatus()GET/swap-api/v1/swap_api_state
getCoinMPerpFundingRate()GET/swap-api/v1/swap_funding_rate
getCoinMPerpFundingRates()GET/swap-api/v1/swap_batch_funding_rate
getCoinMPerpHistoricalFundingRate()GET/swap-api/v1/swap_historical_funding_rate
getCoinMPerpLiquidationOrders()GET/swap-api/v3/swap_liquidation_orders
getCoinMPerpSettlementRecords()GET/swap-api/v1/swap_settlement_records
getCoinMPerpContractInfo()GET/swap-api/v1/swap_contract_info
getCoinMPerpIndexPrice()GET/swap-api/v1/swap_index
getCoinMPerpContractElements()GET/swap-api/v1/swap_query_elements
getCoinMPerpIndexConstituents()GET/swap-api/market/swap_constituents
getCoinMPerpRiskReserveBalance()GET/v1/insurance_fund_info
getCoinMPerpRiskReserveHistory()GET/v1/insurance_fund_history
getCoinMPerpPriceLimit()GET/swap-api/v1/swap_price_limit
getCoinMPerpOpenInterest()GET/swap-api/v1/swap_open_interest
getCoinMPerpMarketDepth()GET/swap-ex/market/depth
getCoinMPerpMarketBbo()GET/swap-ex/market/bbo
getCoinMPerpKlines()GET/swap-ex/market/history/kline
getCoinMPerpMarkKlines()GET/index/market/history/swap_mark_price_kline
getCoinMPerpTicker()GET/swap-ex/market/detail/merged
getCoinMPerpTickers()GET/v2/swap-ex/market/detail/batch_merged
getCoinMPerpLastTrade()GET/swap-ex/market/trade
getCoinMPerpTradeHistory()GET/swap-ex/market/history/trade
getCoinMPerpPremiumIndexKlines()GET/index/market/history/swap_premium_index_kline
getCoinMPerpFundingRateKlines()GET/index/market/history/swap_estimated_rate_kline
getCoinMPerpBasisData()GET/index/market/history/swap_basis
getCoinMPerpAssetValuation()🔐POST/swap-api/v1/swap_balance_valuation
getCoinMPerpAccountInfo()🔐POST/swap-api/v1/swap_account_info
getCoinMPerpPositionInfo()🔐POST/swap-api/v1/swap_position_info
getCoinMPerpAccountFull()🔐POST/swap-api/v1/swap_account_position_info
getCoinMPerpSubPermissions()🔐GET/swap-api/v1/swap_sub_auth_list
updateCoinMPerpSubPermissions()🔐POST/swap-api/v1/swap_sub_auth
getCoinMPerpSubAccounts()🔐POST/swap-api/v1/swap_sub_account_list
getCoinMPerpSubAccountsAssets()🔐POST/swap-api/v1/swap_sub_account_info_list
getCoinMPerpSubAccountAssets()🔐POST/swap-api/v1/swap_sub_account_info
getCoinMPerpSubPositions()🔐POST/swap-api/v1/swap_sub_position_info
getCoinMPerpFinancialRecords()🔐POST/swap-api/v3/swap_financial_record
getCoinMPerpFinancialRecordsExact()🔐POST/swap-api/v3/swap_financial_record_exact
getCoinMPerpAvailableLeverage()🔐POST/swap-api/v1/swap_available_level_rate
getCoinMPerpOrderLimit()🔐POST/swap-api/v1/swap_order_limit
getCoinMPerpFee()🔐POST/swap-api/v1/swap_fee
getCoinMPerpTransferLimit()🔐POST/swap-api/v1/swap_transfer_limit
getCoinMPerpPositionLimit()🔐POST/swap-api/v1/swap_position_limit
transferCoinMPerpMasterSub()🔐POST/swap-api/v1/swap_master_sub_transfer
getCoinMPerpMasterSubTransfers()🔐POST/swap-api/v1/swap_master_sub_transfer_record
getCoinMPerpApiStatus()🔐GET/swap-api/v1/swap_api_trading_status
setCoinMPerpCancelAfter()🔐POST/swap-api/v1/swap-cancel-after
submitCoinMPerpOrder()🔐POST/swap-api/v1/swap_order
submitCoinMPerpBatchOrders()🔐POST/swap-api/v1/swap_batchorder
cancelCoinMPerpOrder()🔐POST/swap-api/v1/swap_cancel
cancelCoinMPerpAllOrders()🔐POST/swap-api/v1/swap_cancelall
updateCoinMPerpLeverage()🔐POST/swap-api/v1/swap_switch_lever_rate
getCoinMPerpOrderInfo()🔐POST/swap-api/v1/swap_order_info
getCoinMPerpOrderDetail()🔐POST/swap-api/v1/swap_order_detail
getCoinMPerpOpenOrders()🔐POST/swap-api/v1/swap_openorders
getCoinMPerpHistoryOrders()🔐POST/swap-api/v3/swap_hisorders
getCoinMPerpHistoryOrdersExact()🔐POST/swap-api/v3/swap_hisorders_exact
getCoinMPerpFills()🔐POST/swap-api/v3/swap_matchresults
getCoinMPerpFillsExact()🔐POST/swap-api/v3/swap_matchresults_exact
submitCoinMPerpLightningCloseOrder()🔐POST/swap-api/v1/swap_lightning_close_position
submitCoinMPerpTriggerOrder()🔐POST/swap-api/v1/swap_trigger_order
cancelCoinMPerpTriggerOrder()🔐POST/swap-api/v1/swap_trigger_cancel
cancelCoinMPerpAllTriggerOrders()🔐POST/swap-api/v1/swap_trigger_cancelall
getCoinMPerpTriggerOpenOrders()🔐POST/swap-api/v1/swap_trigger_openorders
getCoinMPerpTriggerHistoryOrders()🔐POST/swap-api/v1/swap_trigger_hisorders
submitCoinMPerpTpslOrder()🔐POST/swap-api/v1/swap_tpsl_order
cancelCoinMPerpTpslOrder()🔐POST/swap-api/v1/swap_tpsl_cancel
cancelCoinMPerpAllTpslOrders()🔐POST/swap-api/v1/swap_tpsl_cancelall
getCoinMPerpTpslOpenOrders()🔐POST/swap-api/v1/swap_tpsl_openorders
getCoinMPerpTpslHistoryOrders()🔐POST/swap-api/v1/swap_tpsl_hisorders
getCoinMPerpRelationTpslOrder()🔐POST/swap-api/v1/swap_relation_tpsl_order
submitCoinMPerpTrailingOrder()🔐POST/swap-api/v1/swap_track_order
cancelCoinMPerpTrailingOrder()🔐POST/swap-api/v1/swap_track_cancel
cancelCoinMPerpAllTrailingOrders()🔐POST/swap-api/v1/swap_track_cancelall
getCoinMPerpTrailingOpenOrders()🔐POST/swap-api/v1/swap_track_openorders
getCoinMPerpTrailingHistoryOrders()🔐POST/swap-api/v1/swap_track_hisorders
getCopyTraderInstruments()🔐GET/api/v6/copyTrading/trader/instruments
getCopyTraderStatistics()🔐GET/api/v6/copyTrading/trader/statistics
getCopyTraderProfitSharingHistory()🔐GET/api/v6/copyTrading/trader/profit-sharing-history
getCopyTraderProfitSharingHistorySummary()🔐GET/api/v6/copyTrading/trader/profit-sharing-history-summary
getCopyTraderUPNLSharingSummary()🔐GET/api/v6/copyTrading/trader/unrealized-profit-sharing-summary
getCopyTraderFollowers()🔐GET/api/v6/copyTrading/trader/followers
removeCopyTraderFollower()🔐POST/api/v6/copyTrading/trader/follower
submitCopyTraderTransfer()🔐POST/api/v6/copyTrading/trader/transfer
updateCopyTraderFollowerSettings()🔐POST/api/v6/copyTrading/trader/follower-settings
getCopyTraderConfig()🔐POST/api/v6/copyTrading/trader/config
createCopyTraderApikey()🔐POST/api/v6/copyTrading/trader/apikey

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 HTX API via a WebSocket connection.

FunctionAUTHHTTP MethodEndpoint
submitSpotOrder()🔐WScreate-order
submitSpotBatchOrders()🔐WScreate-batchorder
submitSpotMarginOrder()🔐WScreate-margin-order
cancelSpotOrders()🔐WScancel
cancelAllSpotOrders()🔐WScancelall
submitLinearSwapOrder()🔐WScreate_order
submitLinearSwapCrossOrder()🔐WScreate_cross_order
submitLinearSwapBatchOrders()🔐WScreate_batchorder
submitLinearSwapCrossBatchOrders()🔐WScreate_cross_batchorder
cancelLinearSwapOrder()🔐WScancel
cancelLinearSwapCrossOrder()🔐WScross_cancel
cancelAllLinearSwapOrders()🔐WScancelall
cancelAllLinearSwapCrossOrders()🔐WScross_cancelall
placeLinearSwapOrder()🔐WSplace_order
placeLinearSwapBatchOrders()🔐WSplace_batch_orders
cancelLinearSwapV5Order()🔐WScancel_order
cancelLinearSwapV5BatchOrders()🔐WScancel_batch_orders
cancelAllLinearSwapV5Orders()🔐WScancel_all_orders
submitCoinDeliveryOrder()🔐WScreate_order
submitCoinDeliveryBatchOrders()🔐WScreate_batchorder
cancelCoinDeliveryOrder()🔐WScancel
cancelAllCoinDeliveryOrders()🔐WScancelall
submitCoinSwapOrder()🔐WScreate_order
submitCoinSwapBatchOrders()🔐WScreate_batchorder
cancelCoinSwapOrder()🔐WScancel
cancelAllCoinSwapOrders()🔐WScancelall
View endpoint map sourceShowing the available endpoint reference map.

HTX JavaScript FAQ

What does the HTX JavaScript SDK cover?

HTX supports Spot, USDT-M Futures, Coin-M Futures, WebSockets, and WebSocket API workflows. The JavaScript guide covers the main REST and WebSocket integration patterns.

How do I authenticate private HTX API calls in JavaScript?

Install @siebly/htx-api from npm & pass API credentials into the SDK client options, as shown in the HTX JavaScript examples above. The SDK handles the exchange-specific signing requirements for private requests.

Does the HTX 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 HTX 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.

Continue with implementation resources

Subscribe on Substack

Complete the Substack form below to join our newsletter. Substack handles all subscriber data directly.