htx-spot-trading
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHTX Spot Trading
HTX 现货交易
Spot order placement / cancellation and margin borrow-lend. HIGH RISK. Every write operation changes real fund balances and must be confirmed by the user before execution (Human-in-the-Loop).
现货订单挂单/撤单及保证金借贷。高风险。所有写入操作都会改变真实资金余额,执行前必须经过用户确认(人机协作)。
When to use this skill
何时使用该技能
- "Market-buy 0.1 BTC"
- "Place a limit buy on ETH at 3500"
- "Cancel all my BTC/USDT open orders"
- "Borrow USDT and long ETH on margin"
- "Repay my margin loan"
- "Show my order history / fills"
- "市价买入0.1 BTC"
- "以3500的价格挂限价单买入ETH"
- "取消我所有BTC/USDT的未成交订单"
- "借入USDT并进行ETH保证金做多"
- "偿还我的保证金贷款"
- "查看我的订单历史/成交记录"
Underlying tool
底层工具
Drives . Binary on or . Always .
htx-cli$PATH$HTX_CLI_BIN--jsonConfigure credentials once:
bash
htx-cli config set-key <AccessKeyId>
htx-cli config set-secret <SecretKey>Key must have trade permission enabled (and margin if using margin endpoints).
基于驱动。二进制文件需在或路径下。始终使用参数。
htx-cli$PATH$HTX_CLI_BIN--json只需配置一次凭证:
bash
htx-cli config set-key <AccessKeyId>
htx-cli config set-secret <SecretKey>密钥必须启用交易权限(若使用保证金端点,还需启用保证金权限)。
Mandatory confirmation flow
强制确认流程
Before any write operation, present to the user:
| Field | Shown value |
|---|---|
| Action | place / cancel / batch-cancel / margin-borrow / margin-repay |
| Symbol | e.g. |
| Side | buy / sell |
| Type | |
| Amount | quantity (and whether base or quote) |
| Price | limit price (omit for market) |
| Account | spot / margin / super-margin account id |
| Estimated cost | price × amount |
Proceed only after an explicit affirmative ("yes", "confirm", "go"). For batch cancels, list the IDs first.
在执行任何写入操作前,需向用户展示以下信息:
| 字段 | 展示值 |
|---|---|
| 操作 | 挂单 / 撤单 / 批量撤单 / 保证金借入 / 保证金偿还 |
| 交易对 | 例如 |
| 方向 | 买入 / 卖出 |
| 类型 | |
| 数量 | 交易量(注明是基础货币还是计价货币) |
| 价格 | 限价(市价单可省略) |
| 账户 | 现货 / 保证金 / 超级保证金账户ID |
| 预估成本 | 价格 × 数量 |
仅在用户明确确认(如“是”“确认”“执行”)后才可继续操作。批量撤单时,需先列出待撤单的ID。
Endpoint catalog (11)
端点目录(11个)
Order operations (7)
订单操作(7个)
| # | Method | Endpoint | CLI invocation | RW |
|---|---|---|---|---|
| 1 | POST | | | W |
| 2 | POST | | | W |
| 3 | POST | | | W |
| 4 | GET | | | R |
| 5 | GET | | | R |
| 6 | GET | | | R |
| 7 | GET | | | R |
| 序号 | 请求方法 | 端点 | CLI调用命令 | 读写类型 |
|---|---|---|---|---|
| 1 | POST | | | 写 |
| 2 | POST | | | 写 |
| 3 | POST | | | 写 |
| 4 | GET | | | 读 |
| 5 | GET | | | 读 |
| 6 | GET | | | 读 |
| 7 | GET | | | 读 |
Margin loan (4)
保证金借贷(4个)
| # | Method | Endpoint | CLI invocation | RW |
|---|---|---|---|---|
| 1 | POST | | | W |
| 2 | POST | | | W |
| 3 | GET | | | R |
| 4 | GET | | | R |
| 序号 | 请求方法 | 端点 | CLI调用命令 | 读写类型 |
|---|---|---|---|---|
| 1 | POST | | | 写 |
| 2 | POST | | | 写 |
| 3 | GET | | | 读 |
| 4 | GET | | | 读 |
Order types
订单类型
See . Common values for :
references/order-types.md--type- ,
buy-limit— limit ordersell-limit - ,
buy-market— market order (forsell-market,buy-marketis quote currency)amount - ,
buy-ioc— immediate-or-cancelsell-ioc - ,
buy-limit-maker— post-onlysell-limit-maker - ,
buy-stop-limit— stop-limitsell-stop-limit - ,
buy-limit-fok— fill-or-killsell-limit-fok
详见。参数的常见取值:
references/order-types.md--type- ,
buy-limit— 限价单sell-limit - ,
buy-market— 市价单(sell-market的buy-market为计价货币)amount - ,
buy-ioc— 立即成交或取消sell-ioc - ,
buy-limit-maker— 只做市sell-limit-maker - ,
buy-stop-limit— 止损限价单sell-stop-limit - ,
buy-limit-fok— 全部成交或取消sell-limit-fok
Safety checklist
安全检查清单
Before any write:
- Fetch current price via and show the distance from the user's price
htx-cli spot market ticker <symbol> --json - Show quantity, price, and estimated total cost
- For margin borrow: show borrow rate and the liquidation price implied by the position
- For batch cancel: list the order IDs that will be cancelled
- Wait for explicit confirmation ("yes" / "confirm")
- Emit the CLI command, capture its JSON response, report success/failure
执行任何写入操作前:
- 通过获取当前价格,并展示与用户指定价格的差值
htx-cli spot market ticker <symbol> --json - 展示交易量、价格及预估总成本
- 保证金借入:展示借款利率及仓位对应的清算价格
- 批量撤单:列出待取消的订单ID
- 等待用户明确确认(“是” / “确认”)
- 执行CLI命令,捕获JSON响应,报告操作成功/失败
Typical session
典型会话
bash
undefinedbash
undefined1. Check price
1. 查询价格
htx-cli spot market ticker btcusdt --json
htx-cli spot market ticker btcusdt --json
2. Find account id
2. 查询账户ID
htx-cli spot account list --json # type=spot
htx-cli spot account list --json # type=spot
3. Confirm with user, then place order
3. 用户确认后,挂单
htx-cli spot order place --account-id 123 --symbol btcusdt
--type buy-limit --amount 0.01 --price 82000 --json
--type buy-limit --amount 0.01 --price 82000 --json
htx-cli spot order place --account-id 123 --symbol btcusdt
--type buy-limit --amount 0.01 --price 82000 --json
--type buy-limit --amount 0.01 --price 82000 --json
4. Monitor
4. 监控订单
htx-cli spot order query <order-id> --json
undefinedhtx-cli spot order query <order-id> --json
undefinedReferences
参考资料
references/authentication.mdreferences/order-types.md
references/authentication.mdreferences/order-types.md