usdt-m-futures

Original🇺🇸 English
Translated

HTX USDT-M Futures trading using the HTX API. Authentication requires API key and secret key for certain endpoints. Supports mainnet.

2installs
Added on

NPX Install

npx skill4agent add htx-exchange/htx-skills-hub usdt-m-futures

HTX USDT-M Futures Skill

USDT-M Futures trading on HTX using authenticated and public API endpoints. Return the result in JSON format.

Base URLs

Quick Reference

Complete API endpoints for HTX USDT-M Futures. All endpoints use base URL
https://api.hbdm.com
(or
https://api.hbdm.vn
for AWS).

Reference Data

EndpointDescriptionRequiredOptionalAuthentication
GET
/linear-swap-api/v3/swap_unified_account_type
Account type queryNoneNoneYes
POST
/linear-swap-api/v3/swap_switch_account_type
Account Type Changeaccount_typeNoneYes
GET
/linear-swap-api/v1/swap_funding_rate
Query funding ratecontract_codeNoneNo
GET
/linear-swap-api/v1/swap_batch_funding_rate
Query a Batch of Funding Ratecontract_codeNoneNo
GET
/linear-swap-api/v1/swap_historical_funding_rate
Query historical funding ratecontract_codepage_index, page_sizeNo
GET
/linear-swap-api/v1/swap_liquidation_orders
Query Liquidation Orderscontract_codetrade_type, create_date, page_index, page_sizeNo
GET
/linear-swap-api/v1/swap_settlement_records
Query historical settlement recordscontract_codepage_index, page_sizeNo
GET
/linear-swap-api/v1/swap_elite_account_ratio
Query Top Trader Sentiment Index (Account)contract_codeperiodNo
GET
/linear-swap-api/v1/swap_elite_position_ratio
Query Top Trader Sentiment Index (Position)contract_codeperiodNo
GET
/linear-swap-api/v1/swap_system_status
Query information on system status (Isolated)contract_codeNoneNo
POST
/linear-swap-api/v1/swap_cross_tiered_margin_info
Query information on Tiered Margin (Cross)NoneNoneYes
POST
/linear-swap-api/v1/swap_tiered_margin_info
Query information on Tiered Margin (Isolated)contract_codeNoneYes
GET
/linear-swap-api/v1/swap_estimated_settlement_price
Get the estimated settlement pricecontract_codeNoneNo
POST
/linear-swap-api/v1/swap_adjustment_factor
Query Tiered Adjustment Factor (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_adjustment_factor
Query Tiered Adjustment Factor (Cross)NoneNoneYes
GET
/v1/insurance_fund_info
Query risk reserve balance informationcontract_codeNoneNo
GET
/v1/insurance_fund_history
Query historical risk reservescontract_codepage_index, page_sizeNo
GET
/linear-swap-api/v1/swap_price_limit
Query Swap Price Limitationcontract_codeNoneNo
GET
/linear-swap-api/v1/swap_open_interest
Get Swap Open Interest Informationcontract_codeNoneNo
GET
/linear-swap-api/v1/swap_contract_info
Query Contract Infocontract_codeNoneNo
GET
/linear-swap-api/v1/swap_index
Query Swap Index Price Informationcontract_codeNoneNo
GET
/linear-swap-api/market/swap_contract_constituents
Get index componentsindex_codeNoneNo
GET
/linear-swap-api/v1/swap_query_elements
Contract Elementscontract_codeNoneNo
GET
/linear-swap-api/v1/swap_timestamp
Get current system timestampNoneNoneNo
GET
https://api.hbdm.com/heartbeat/
Query whether the system is availableNoneNoneNo

Market Data

EndpointDescriptionRequiredOptionalAuthentication
GET
/linear-swap-ex/market/depth
Get Market Depthcontract_codetypeNo
GET
/linear-swap-ex/market/bbo
Get Market BBO Datacontract_codeNoneNo
GET
/linear-swap-ex/market/kline
Get KLine Datacontract_code, periodsize, from, toNo
GET
/linear-swap-ex/market/mark_price_kline
Get Kline Data of Mark Pricecontract_code, periodsize, from, toNo
GET
/linear-swap-ex/market/overview
Get Market Data Overviewcontract_codeNoneNo
GET
/linear-swap-ex/market/batch_overview
Get a Batch of Market Data Overviewcontract_codeNoneNo
GET
/linear-swap-ex/market/trade
Query The Last Trade of a Contractcontract_codeNoneNo
GET
/linear-swap-ex/market/trades
Query a Batch of Trade Recordscontract_codesizeNo
GET
/linear-swap-ex/market/open_interest
Query information on open interestcontract_codeNoneNo
GET
/linear-swap-ex/market/premium_index_kline
Query Premium Index Kline Datacontract_code, periodsize, from, toNo
GET
/linear-swap-ex/market/estimated_funding_rate_kline
Query Estimated Funding Rate Klinecontract_code, periodsize, from, toNo
GET
/linear-swap-ex/market/basis
Query Basis Datacontract_code, periodsize, from, to, basis_price_typeNo

Account Interface

EndpointDescriptionRequiredOptionalAuthentication
POST
/linear-swap-api/v1/swap_account_info
Query Asset ValuationNonevaluation_assetYes
POST
/linear-swap-api/v1/swap_account_info
Query Account Information (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_account_info
Query Account Information (Cross)Nonevaluation_assetYes
POST
/linear-swap-api/v1/swap_position_info
Query Position Information (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_position_info
Query Position Information (Cross)Nonecontract_codeYes
POST
/linear-swap-api/v1/swap_account_position_info
Query Assets And Positions (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_account_position_info
Query Assets And Positions (Cross)Nonevaluation_assetYes
POST
/linear-swap-api/v1/swap_sub_account_list
Set Sub-Account Trading Permissionssub_uidtradesYes
POST
/linear-swap-api/v1/swap_sub_account_trading_permission
Query sub-account permissionssub_uidNoneYes
POST
/linear-swap-api/v1/swap_account_info_list
Query all sub-accounts (Isolated)NoneNoneYes
POST
/linear-swap-api/v1/swap_cross_account_info_list
Query all sub-accounts (Cross)Nonevaluation_assetYes
POST
/linear-swap-api/v1/swap_account_info_batch
Query batch sub-accounts (Isolated)sub_uidNoneYes
POST
/linear-swap-api/v1/swap_cross_account_info_batch
Query batch sub-accounts (Cross)sub_uidvaluation_assetYes
POST
/linear-swap-api/v1/swap_account_info_sub
Query single sub-account (Isolated)contract_code, sub_uidNoneYes
POST
/linear-swap-api/v1/swap_cross_account_info_sub
Query sub-account (Cross)sub_uidvaluation_assetYes
POST
/linear-swap-api/v1/swap_position_info_sub
Query sub-account position (Isolated)contract_code, sub_uidNoneYes
POST
/linear-swap-api/v1/swap_cross_position_info_sub
Query sub-account position (Cross)sub_uidcontract_codeYes
POST
/linear-swap-api/v3/swap_financial_record
Query account financial recordsNonecontract_code, type, start_time, end_time, page_index, page_size, directYes
POST
/linear-swap-api/v3/swap_financial_record_exact
Query financial records via fieldsNonecontract_code, type, start_time, end_time, page_index, page_size, directYes
POST
/linear-swap-api/v1/swap_available_level_rate
Query available leverage (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_available_level_rate
Query available leverage (Cross)NoneNoneYes
POST
/linear-swap-api/v1/swap_order_limit
Query order limitNonecontract_code, order_price_typeYes
POST
/linear-swap-api/v1/swap_fee
Query swap trading feeNonecontract_codeYes
POST
/linear-swap-api/v1/swap_transfer_limit
Query transfer limit (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_transfer_limit
Query transfer limit (Cross)NoneNoneYes
POST
/linear-swap-api/v1/swap_position_limit
Query position limit (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_position_limit
Query position limit (Cross)NoneNoneYes
POST
/linear-swap-api/v1/swap_lever_position_limit
Query position limit all leverages (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_lever_position_limit
Query position limit all leverages (Cross)NoneNoneYes
POST
/linear-swap-api/v1/swap_master_sub_transfer
Transfer between master and subsub_uid, asset, amount, typeclient_order_idYes
POST
/linear-swap-api/v1/swap_master_sub_transfer_record
Query transfer recordsNonesub_uid, transfer_type, page_index, page_size, direct, sort_byYes
POST
/linear-swap-api/v1/swap_transfer_inner
Transfer between margin accountsasset, amount, from_margin_account, to_margin_accountclient_order_idYes
GET
/linear-swap-api/v1/swap_api_trading_status
Query API indicator disable infoNoneNoneYes
POST
/linear-swap-api/v1/linear-cancel-after
Automatic Order Cancellationtimeoutcontract_codeYes

Trade Interface

EndpointDescriptionRequiredOptionalAuthentication
POST
/linear-swap-api/v1/swap_cross_query_trade_state
Query Trade State (Cross)NoneNoneYes
POST
/linear-swap-api/v1/swap_switch_position_mode
Switch Position Mode (Isolated)contract_code, modeNoneYes
POST
/linear-swap-api/v1/swap_cross_switch_position_mode
Switch Position Mode (Cross)modecontract_codeYes
POST
/linear-swap-api/v1/swap_order
Place an Order (Isolated)contract_code, client_order_id, price, volume, direction, offset, lever_rate, order_price_typetp_trigger_price, tp_order_price, tp_order_price_type, sl_trigger_price, sl_order_price, sl_order_price_type, reduce_only, hf_order_typeYes
POST
/linear-swap-api/v1/swap_cross_order
Place An Order (Cross)contract_code, client_order_id, price, volume, direction, offset, lever_rate, order_price_typetp_trigger_price, tp_order_price, tp_order_price_type, sl_trigger_price, sl_order_price, sl_order_price_type, reduce_only, hf_order_typeYes
POST
/linear-swap-api/v1/swap_batch_orders
Place a Batch of Orders (Isolated)orders_dataNoneYes
POST
/linear-swap-api/v1/swap_cross_batch_orders
Place A Batch Of Orders (Cross)orders_dataNoneYes
POST
/linear-swap-api/v1/swap_cancel
Cancel an Order (Isolated)contract_code, order_idclient_order_idYes
POST
/linear-swap-api/v1/swap_cross_cancel
Cancel An Order (Cross)order_idcontract_code, client_order_idYes
POST
/linear-swap-api/v1/swap_cancelall
Cancel All Orders (Isolated)contract_codedirection, offsetYes
POST
/linear-swap-api/v1/swap_cross_cancelall
Cancel All Orders (Cross)Nonecontract_code, direction, offsetYes
POST
/linear-swap-api/v1/swap_switch_lever_rate
Switch Leverage (Isolated)contract_code, lever_rateNoneYes
POST
/linear-swap-api/v1/swap_cross_switch_lever_rate
Switch Leverage (Cross)lever_ratecontract_codeYes
POST
/linear-swap-api/v1/swap_order_info
Get Information of an Order (Isolated)contract_code, order_idclient_order_idYes
POST
/linear-swap-api/v1/swap_cross_order_info
Get Information of order (Cross)order_idcontract_code, client_order_idYes
POST
/linear-swap-api/v1/swap_order_detail
Order details acquisition (Isolated)contract_code, order_idcreated_at, page_index, page_size, client_order_idYes
POST
/linear-swap-api/v1/swap_cross_order_detail
Get Detail Information (Cross)order_idcontract_code, created_at, page_index, page_size, client_order_idYes
POST
/linear-swap-api/v1/swap_openorders
Current unfilled orders (Isolated)contract_codepage_index, page_sizeYes
POST
/linear-swap-api/v1/swap_cross_openorders
Current unfilled orders (Cross)Nonecontract_code, page_index, page_sizeYes
POST
/linear-swap-api/v3/swap_hisorders
Get History Orders (Isolated)contract_code, trade_typetype, start_time, end_time, direct, page_index, page_size, sort_byYes
POST
/linear-swap-api/v3/swap_cross_hisorders
Get History Orders (Cross)trade_typecontract_code, type, start_time, end_time, direct, page_index, page_size, sort_byYes
POST
/linear-swap-api/v3/swap_hisorders_exact
History Orders via Fields (Isolated)contract_code, trade_typetype, start_time, end_time, direct, page_index, page_size, sort_byYes
POST
/linear-swap-api/v3/swap_cross_hisorders_exact
History Orders via Fields (Cross)trade_typecontract_code, type, start_time, end_time, direct, page_index, page_size, sort_byYes
POST
/linear-swap-api/v3/swap_matchresults
History Match Results (Isolated)contract_code, trade_typestart_time, end_time, page_index, page_size, directYes
POST
/linear-swap-api/v3/swap_cross_matchresults
History Match Results (Cross)trade_typecontract_code, start_time, end_time, page_index, page_size, directYes
POST
/linear-swap-api/v3/swap_matchresults_exact
Match Results via Fields (Isolated)contract_code, trade_typestart_time, end_time, page_index, page_size, directYes
POST
/linear-swap-api/v3/swap_cross_matchresults_exact
Match Results via Fields (Cross)trade_typecontract_code, start_time, end_time, page_index, page_size, directYes
POST
/linear-swap-api/v1/swap_lightning_close_position
Lightning Close Order (Isolated)contract_code, volume, directionclient_order_id, order_price_typeYes
POST
/linear-swap-api/v1/swap_cross_lightning_close_position
Lightning Close Position (Cross)contract_code, volume, directionclient_order_id, order_price_typeYes
GET
/linear-swap-api/v1/swap_position_side
Query position mode (Isolated)contract_codeNoneYes
GET
/linear-swap-api/v1/swap_cross_position_side
Query position mode (Cross)Nonecontract_codeYes

Strategy Order Interface

EndpointDescriptionRequiredOptionalAuthentication
POST
/linear-swap-api/v1/swap_trigger_order
Place Trigger Order (Isolated)contract_code, trigger_type, trigger_price, order_price, volume, direction, offset, lever_rate, order_price_typeclient_order_idYes
POST
/linear-swap-api/v1/swap_cross_trigger_order
Place Trigger Order (Cross)contract_code, trigger_type, trigger_price, order_price, volume, direction, offset, lever_rate, order_price_typeclient_order_idYes
POST
/linear-swap-api/v1/swap_trigger_cancel
Cancel Trigger Order (Isolated)contract_code, order_idclient_order_idYes
POST
/linear-swap-api/v1/swap_cross_trigger_cancel
Cancel Trigger Order (Cross)order_idcontract_code, client_order_idYes
POST
/linear-swap-api/v1/swap_trigger_cancelall
Cancel All Trigger Orders (Isolated)contract_codedirection, offsetYes
POST
/linear-swap-api/v1/swap_cross_trigger_cancelall
Cancel All Trigger Orders (Cross)Nonecontract_code, direction, offsetYes
POST
/linear-swap-api/v1/swap_trigger_openorders
Query Trigger Order Open Orders (Isolated)contract_codepage_index, page_sizeYes
POST
/linear-swap-api/v1/swap_cross_trigger_openorders
Query Trigger Order Open Orders (Cross)Nonecontract_code, page_index, page_sizeYes
POST
/linear-swap-api/v1/swap_trigger_hisorders
Query Trigger Order History (Isolated)contract_codetrigger_type, status, page_index, page_size, sort_by, directYes
POST
/linear-swap-api/v1/swap_cross_trigger_hisorders
Query Trigger Order History (Cross)Nonecontract_code, trigger_type, status, page_index, page_size, sort_by, directYes
POST
/linear-swap-api/v1/swap_tpsl_order
Set TP/SL Order (Isolated)contract_code, volume, tp_trigger_price, tp_order_price, sl_trigger_price, sl_order_price, directiontp_order_price_type, sl_order_price_type, client_order_idYes
POST
/linear-swap-api/v1/swap_cross_tpsl_order
Set TP/SL Order (Cross)contract_code, volume, tp_trigger_price, tp_order_price, sl_trigger_price, sl_order_price, directiontp_order_price_type, sl_order_price_type, client_order_idYes
POST
/linear-swap-api/v1/swap_tpsl_cancel
Cancel TP/SL Order (Isolated)contract_code, order_idclient_order_idYes
POST
/linear-swap-api/v1/swap_cross_tpsl_cancel
Cancel TP/SL Order (Cross)order_idcontract_code, client_order_idYes
POST
/linear-swap-api/v1/swap_tpsl_cancelall
Cancel all TP/SL Orders (Isolated)contract_codeNoneYes
POST
/linear-swap-api/v1/swap_cross_tpsl_cancelall
Cancel all TP/SL Orders (Cross)Nonecontract_codeYes
POST
/linear-swap-api/v1/swap_tpsl_openorders
Query Open TP/SL Orders (Isolated)contract_codepage_index, page_sizeYes
POST
/linear-swap-api/v1/swap_cross_tpsl_openorders
Query Open TP/SL Orders (Cross)Nonecontract_code, page_index, page_sizeYes
POST
/linear-swap-api/v1/swap_tpsl_hisorders
Query TP/SL History Orders (Isolated)contract_codestatus, page_index, page_size, sort_by, directYes
POST
/linear-swap-api/v1/swap_cross_tpsl_hisorders
Query TP/SL History Orders (Cross)Nonecontract_code, status, page_index, page_size, sort_by, directYes
POST
/linear-swap-api/v1/swap_tpsl_relation_order_info
Query TP/SL Order Info (Isolated)contract_code, order_idclient_order_idYes
POST
/linear-swap-api/v1/swap_cross_tpsl_relation_order_info
Query TP/SL Order Info (Cross)order_idcontract_code, client_order_idYes
POST
/linear-swap-api/v1/swap_trailing_order
Place Trailing Order (Isolated)contract_code, volume, direction, offset, lever_rate, trailing_amount, trailing_percent, order_price_typeclient_order_idYes
POST
/linear-swap-api/v1/swap_cross_trailing_order
Place Trailing Order (Cross)contract_code, volume, direction, offset, lever_rate, trailing_amount, trailing_percent, order_price_typeclient_order_idYes
POST
/linear-swap-api/v1/swap_trailing_cancel
Cancel Trailing Order (Isolated)contract_code, order_idclient_order_idYes
POST
/linear-swap-api/v1/swap_cross_trailing_cancel
Cancel Trailing Order (Cross)order_idcontract_code, client_order_idYes
POST
/linear-swap-api/v1/swap_trailing_cancelall
Cancel All Trailing Orders (Isolated)contract_codedirection, offsetYes
POST
/linear-swap-api/v1/swap_cross_trailing_cancelall
Cancel All Trailing Orders (Cross)Nonecontract_code, direction, offsetYes
POST
/linear-swap-api/v1/swap_trailing_openorders
Unfilled trailing orders (Isolated)contract_codepage_index, page_sizeYes
POST
/linear-swap-api/v1/swap_cross_trailing_openorders
Unfilled trailing orders (Cross)Nonecontract_code, page_index, page_sizeYes
POST
/linear-swap-api/v1/swap_trailing_hisorders
History Trailing Orders (Isolated)contract_codestatus, page_index, page_size, sort_by, directYes
POST
/linear-swap-api/v1/swap_cross_trailing_hisorders
History Trailing Orders (Cross)Nonecontract_code, status, page_index, page_size, sort_by, directYes

Transferring Interface

EndpointDescriptionRequiredOptionalAuthentication
POST
/linear-swap-api/v1/swap_cross_transfer_state
Query Transfer State (Cross)NoneNoneYes
POST
/linear-swap-api/v1/swap_transfer
Transfer between Spot and Futuresasset, amount, typeclient_order_idYes

Parameters

Common Parameters

Contract & Symbol

  • contract_code: Contract code (e.g., BTC-USDT, ETH-USDT)
  • symbol: Symbol name
  • pair: Trading pair (e.g., BTC-USDT)
  • contract_type: Contract type (swap, this_week, next_week, quarter, next_quarter)
  • business_type: Business type (futures, swap, all)

Account & Margin

  • margin_account: Margin account identifier
  • margin_mode: Margin mode (cross, isolated)
  • margin_asset: Margin asset (e.g., USDT)
  • account_type: Account type

Order Parameters

  • order_id: Order ID (can be comma-separated for multiple orders)
  • client_order_id: Client-defined order ID
  • order_source: Order source
  • order_type: Order type
  • order_price_type: Order price type (limit, optimal_5, optimal_10, optimal_20, post_only, fok, ioc, etc.)
  • direction: Transaction direction (buy, sell)
  • offset: Offset direction (open, close, both)
  • volume: Order volume (quantity in contracts)
  • price: Order price
  • lever_rate: Leverage rate
  • reduce_only: Reduce only flag (0: no, 1: yes)

Trigger Order Parameters

  • trigger_type: Trigger type (ge: greater than or equal, le: less than or equal)
  • trigger_price: Trigger price
  • triggered_price: The price when trigger order was executed

Take-Profit & Stop-Loss Parameters

  • tp_trigger_price: Trigger price of take-profit order
  • tp_order_price: Order price of take-profit order
  • tp_order_price_type: Order type of take-profit order
  • sl_trigger_price: Trigger price of stop-loss order
  • sl_order_price: Order price of stop-loss order
  • sl_order_price_type: Order type of stop-loss order
  • price_protect: Price protection (boolean)

Trailing Order Parameters

  • callback_rate: Callback rate for trailing orders
  • active_price: Active price for trailing orders
  • is_active: Whether the active price is activated

Query Parameters

  • page_index: Page number (default: 1)
  • page_size: Page size (default: 20, max: 50)
  • start_time: Start time (Unix timestamp in milliseconds)
  • end_time: End time (Unix timestamp in milliseconds)
  • create_date: Number of days
  • direct: Search direction (NEXT: ascending, PREV: descending)
  • from_id: Starting ID for pagination
  • sort_by: Sort field (descending order)

Sub-account Parameters

  • sub_uid: Sub-account UID
  • sub_auth: Sub-account authorization (0: disable, 1: enable)

Transfer Parameters

  • from: Source account (e.g., spot, linear-swap)
  • to: Destination account (e.g., spot, linear-swap)
  • currency: Currency to transfer
  • amount: Transfer amount
  • from_margin_account: Source margin account
  • to_margin_account: Destination margin account

Market Data Parameters

  • period: K-line period (1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1mon, 1week, 1year)
  • type: Depth type (step0-step19)
  • size: Number of records to return

Other Parameters

  • trade_type: Trade type (0: all, 1: open long, 2: open short, 3: close short, 4: close long)
  • status: Order status (multiple statuses can be comma-separated)
  • self_match_prevent: Self-match prevention flag
  • self_match_prevent_new: Prevent self-trading

Enums

Order Types

  • order_price_type: limit, optimal_5, optimal_10, optimal_20, post_only, fok, ioc, opponent, lightning, optimal_5_fok, optimal_5_ioc, optimal_10_fok, optimal_10_ioc, optimal_20_fok, optimal_20_ioc, opponent_ioc, opponent_fok

Order States

  • status: submitted (3), partial-filled (4), partial-canceled (5), filled (6), canceled (7), ready to submit (1), accepted (2)

Direction & Offset

  • direction: buy, sell
  • offset: open, close, both

Margin Mode

  • margin_mode: isolated, cross

Contract Type

  • contract_type: swap (perpetual), this_week, next_week, quarter (current quarter), next_quarter

Position Mode

  • position_mode: dual_side (hedge mode), single_side (one-way mode)

Authentication

For endpoints that require authentication, you will need to provide HTX API credentials.
Required credentials:
  • apiKey: Your HTX API key
  • secretKey: Your HTX API secret (for signing)
All authenticated endpoints require HMAC SHA256 signature:
  1. Create the pre-sign string in the following order:
    • HTTP method (GET/POST) + "\n"
    • API host (e.g., api.hbdm.com) + "\n"
    • API path (e.g., /linear-swap-api/v1/swap_order) + "\n"
    • Sorted query string parameters
  2. Append required parameters to all authenticated requests:
    • AccessKeyId: Your API key
    • SignatureMethod: HmacSHA256
    • SignatureVersion: 2
    • Timestamp: UTC timestamp in format yyyy-MM-ddTHH:mm:ss
  3. Sign the pre-sign string with secretKey using HMAC SHA256
  4. Append signature to query string as Signature parameter
  5. For POST requests, also include signature in the URL query string
Example pre-sign string:
POST\\n
api.hbdm.com\\n
/linear-swap-api/v1/swap_order\\n
AccessKeyId=xxx&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2017-05-11T15:19:30

Security

Share Credentials

Users can provide HTX API credentials by sending a file where the content is in the following format:
bash
fe45419a...xyz
secretabc...key

Never Display Full Secrets

When showing credentials to users:
  • API Key: Show first 5 + last 4 characters:
    fe45419a...xyz
  • Secret Key: Always mask, show only last 5:
    ***...key1
Example response when asked for credentials:
Account: main
API Key: fe45419a...xyz
Secret: ***...key1
Environment: Mainnet

Listing Accounts

When listing accounts, show names and environment only — never keys:
HTX Accounts:
* main (Mainnet)
* trading (Mainnet - AWS)

Transactions in Mainnet

When performing transactions in mainnet, always confirm with the user before proceeding by asking them to write "CONFIRM" to proceed.

HTX Accounts

main

  • API Key: your_mainnet_api_key
  • Secret: your_mainnet_secret
  • Environment: https://api.hbdm.com
  • Description: Primary USDT-M Futures trading account

trading

  • API Key: your_aws_api_key
  • Secret: your_aws_secret
  • Environment: https://api.hbdm.vn
  • Description: AWS optimized USDT-M Futures trading

TOOLS.md Structure

bash
## HTX Accounts

### main
- API Key: fe45419a...xyz
- Secret: secretabc...key
- Environment: https://api.hbdm.com
- Description: Primary USDT-M Futures trading account

### trading
- API Key: test456...abc
- Secret: testsecret...xyz
- Environment: https://api.hbdm.vn
- Description: AWS optimized USDT-M Futures trading

Agent Behavior

  1. Credentials requested: Mask secrets (show last 5 chars only)
  2. Listing accounts: Show names and environment, never keys
  3. Account selection: Ask if ambiguous, default to main
  4. When doing a transaction in mainnet, confirm with user before by asking to write "CONFIRM" to proceed
  5. New credentials: Prompt for name, environment

Adding New Accounts

When user provides new credentials:
  • Ask for account name
  • Ask: Which environment (Mainnet or Mainnet-AWS)
  • Store in
    TOOLS.md
    with masked display confirmation

User Agent Header

Include
User-Agent
header with the following string:
htx-usdt-m-futures/1.0.0 (Skill)

Important Notes

  • All timestamps are in Unix milliseconds unless specified otherwise
  • Contract codes should use uppercase (e.g., BTC-USDT, not btc-usdt)
  • For market buy orders, the
    volume
    parameter represents the number of contracts
  • Account ID must be obtained from appropriate endpoints before trading
  • Rate limits apply - see HTX API documentation for details
  • Signature must be calculated for every authenticated request
  • Timestamp in signature must be within 1 minute of server time
  • Both isolated margin and cross margin modes are supported
  • Position modes: single_side (one-way) and dual_side (hedge)
  • Always use the correct margin mode and margin account for operations
  • For cross margin operations, use endpoints with "cross" in their path
  • For isolated margin operations, use endpoints without "cross" in their path
  • All request endpoints must match the endpoints specified in the documentation.