htx-spot-account

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

HTX Spot Account

HTX现货账户

Spot account and asset management for HTX. Requires API key with read permission. Transfer endpoints (4 of 9) are writes but funds stay inside HTX — low risk.
适用于HTX平台的现货账户与资产管理工具。需要具备读取权限的API密钥。划转接口(9个接口中的4个)为写入操作,但资金仅在HTX内部流转——风险较低。

When to use this skill

何时使用该技能

  • "How much USDT do I have?"
  • "What's my total asset valuation in USD?"
  • "Show my account history / flow records"
  • "Transfer 1000 USDT from spot to futures"
  • "Check my HTX points balance"
  • "我有多少USDT?"
  • "我的总资产估值是多少美元?"
  • "展示我的账户历史/流水记录"
  • "划转1000 USDT从现货账户到期货账户"
  • "查询我的HTX积分余额"

Underlying tool

底层工具

Drives
htx-cli
. Binary must be on
$PATH
or at
$HTX_CLI_BIN
. Always use
--json
.
基于
htx-cli
驱动。二进制文件必须位于
$PATH
路径下或
$HTX_CLI_BIN
指定位置。请始终使用
--json
参数。

Configure credentials (one-time)

配置凭证(一次性操作)

bash
htx-cli config set-key   <AccessKeyId>
htx-cli config set-secret <SecretKey>
htx-cli config show
See
references/authentication.md
for signing details.
bash
htx-cli config set-key   <AccessKeyId>
htx-cli config set-secret <SecretKey>
htx-cli config show
签名细节请查看
references/authentication.md

Endpoint catalog (10)

接口目录(共10个)

Account queries — read (5)

账户查询——读取操作(5个)

#MethodEndpointCLI invocationDescription
1GET
/v1/account/accounts
htx-cli spot account list --json
All accounts for the user
2GET
/v1/account/accounts/{id}/balance
htx-cli spot account balance <account-id> --json
Balance detail
3GET
/v2/account/valuation
htx-cli spot account valuation --json
Total valuation of all accounts
4GET
/v2/account/asset-valuation
htx-cli spot call /v2/account/asset-valuation -p accountType=spot -p valuationCurrency=USD --auth --json
Per-account asset valuation
5GET
/v1/account/history
htx-cli spot call /v1/account/history -p account-id=<id> --auth --json
Account flow / ledger
#请求方法接口地址CLI调用命令描述
1GET
/v1/account/accounts
htx-cli spot account list --json
用户名下所有账户
2GET
/v1/account/accounts/{id}/balance
htx-cli spot account balance <account-id> --json
余额详情
3GET
/v2/account/valuation
htx-cli spot account valuation --json
所有账户的总估值
4GET
/v2/account/asset-valuation
htx-cli spot call /v2/account/asset-valuation -p accountType=spot -p valuationCurrency=USD --auth --json
单账户资产估值
5GET
/v1/account/history
htx-cli spot call /v1/account/history -p account-id=<id> --auth --json
账户流水/账本

Fund transfers — write (5)

资金划转——写入操作(5个)

#MethodEndpointCLI invocationDescription
1POST
/v1/account/transfer
htx-cli spot call /v1/account/transfer --method POST --auth --body '{"from-account-id":...,"to-account-id":...,"currency":"usdt","amount":"..."}' --json
Transfer between user's own spot/margin/otc accounts
2POST
/v1/futures/transfer
htx-cli spot call /v1/futures/transfer --method POST --auth --body '{"currency":"btc","amount":"...","type":"pro-to-futures"}' --json
Spot ↔ COIN-M (币本位交割) futures transfer ONLY. Does NOT work for USDT-M.
3POST
/v2/account/transfer
htx-cli spot call /v2/account/transfer --method POST --auth --body '{"from":"spot","to":"linear-swap","currency":"usdt","amount":"5","margin-account":"USDT"}' --json
Spot ↔ USDT-M linear swap / cross-margin / super-margin, etc. Use for any USDT-M futures transfer.
4GET
/v1/point/account
htx-cli spot call /v1/point/account --auth --json
HTX points balance
5POST
/v1/point/transfer
htx-cli spot call /v1/point/transfer --method POST --auth --body '{"fromUid":"...","toUid":"...","amount":"..."}' --json
Transfer points
Important: For USDT-M perpetual swap (线性永续), you MUST use
/v2/account/transfer
with
from
/
to
=
spot
linear-swap
and
margin-account
=
USDT
(cross) or
USDT-<symbol>
(isolated, e.g.
USDT-BTC
). The
/v1/futures/transfer
endpoint is reserved for COIN-M delivery contracts and will return
Transfer service is temporarily suspended for USDT account
if misused.
#请求方法接口地址CLI调用命令描述
1POST
/v1/account/transfer
htx-cli spot call /v1/account/transfer --method POST --auth --body '{"from-account-id":...,"to-account-id":...,"currency":"usdt","amount":"..."}' --json
用户自有现货/杠杆/OTC账户间划转
2POST
/v1/futures/transfer
htx-cli spot call /v1/futures/transfer --method POST --auth --body '{"currency":"btc","amount":"...","type":"pro-to-futures"}' --json
仅支持现货与**COIN-M(币本位交割)**期货账户间划转,不适用于USDT-M合约。
3POST
/v2/account/transfer
htx-cli spot call /v2/account/transfer --method POST --auth --body '{"from":"spot","to":"linear-swap","currency":"usdt","amount":"5","margin-account":"USDT"}' --json
现货与USDT-M线性永续合约/全仓杠杆/超级杠杆等账户间划转,适用于所有USDT-M期货划转场景。
4GET
/v1/point/account
htx-cli spot call /v1/point/account --auth --json
HTX积分余额
5POST
/v1/point/transfer
htx-cli spot call /v1/point/transfer --method POST --auth --body '{"fromUid":"...","toUid":"...","amount":"..."}' --json
划转积分
重要提示:对于USDT-M永续合约(线性永续),必须使用
/v2/account/transfer
接口,其中
from
/
to
参数设置为
spot
linear-swap
margin-account
参数设置为
USDT
(全仓)或
USDT-<交易对>
(逐仓,例如
USDT-BTC
)。
/v1/futures/transfer
接口仅适用于COIN-M交割合约,若误用会返回
Transfer service is temporarily suspended for USDT account
错误。

Workflow patterns

工作流示例

Show total balance

查询总余额

bash
htx-cli spot account list --json               # find account id with type=spot
htx-cli spot account balance <id> --json       # detailed per-currency balance
htx-cli spot account valuation --json          # single USD total
bash
htx-cli spot account list --json               # 找到类型为spot的账户ID
htx-cli spot account balance <id> --json       # 查看各币种的详细余额
htx-cli spot account valuation --json          # 查看以美元计价的总估值

Spot → USDT-M futures transfer (most common)

现货账户转USDT-M期货账户(最常用场景)

Use
/v2/account/transfer
:
bash
htx-cli spot call /v2/account/transfer --method POST --auth \
  --body '{"from":"spot","to":"linear-swap","currency":"usdt","amount":"5","margin-account":"USDT"}' --json
  • from
    /
    to
    :
    spot
    ,
    linear-swap
    ,
    margin
    ,
    super-margin
    , etc. Reverse them to transfer back.
  • margin-account
    :
    USDT
    for cross-margin,
    USDT-BTC
    (etc.) for isolated margin.
使用
/v2/account/transfer
接口:
bash
htx-cli spot call /v2/account/transfer --method POST --auth \
  --body '{"from":"spot","to":"linear-swap","currency":"usdt","amount":"5","margin-account":"USDT"}' --json
  • from
    /
    to
    :可选值包括
    spot
    linear-swap
    margin
    super-margin
    等。反向设置即可实现资金转回。
  • margin-account
    USDT
    代表全仓杠杆,
    USDT-BTC
    (等)代表逐仓杠杆。

Spot → COIN-M (币本位) futures transfer

现货账户转COIN-M(币本位)期货账户

Use
/v1/futures/transfer
with
type
=
pro-to-futures
or
futures-to-pro
(currency is the coin symbol, e.g.
btc
,
eth
).
Before calling any transfer endpoint, display to the user source, destination, currency, amount, direction. Only proceed after explicit user confirmation.
使用
/v1/futures/transfer
接口,设置
type
参数为
pro-to-futures
(现货转期货)或
futures-to-pro
(期货转现货),币种参数为对应代币符号,例如
btc
eth
调用任何划转接口前,必须向用户展示资金来源、目标账户、币种、金额及划转方向。仅在用户明确确认后才可执行操作。

Safety

安全注意事项

  • Read endpoints: safe to call without confirmation.
  • Transfer endpoints: must confirm with the user first — show source, destination, currency, amount.
  • Never log the secret key. Never pass it as a CLI argument; use
    htx-cli config set-secret
    so it's stored once.
  • 读取接口:无需确认即可安全调用。
  • 划转接口:必须先获得用户确认——展示来源、目标、币种、金额。
  • 切勿记录密钥。切勿将密钥作为CLI参数传递;请使用
    htx-cli config set-secret
    命令一次性存储密钥。

References

参考资料

  • references/authentication.md
    — HMAC-SHA256 signing and key management
  • references/authentication.md
    — HMAC-SHA256签名与密钥管理