← Back to Skills Marketplace
qiumr

Gate.io 期货交易 CLI 工具

by QiuMr · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ⚠ suspicious
443
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install futures-trader
Description
当用户需要查询Gate.io期货行情、管理账户、下单交易时使用此Skill。它提供完整的CLI命令行工具。
README (SKILL.md)

Gate.io 期货交易 CLI 工具

此 Skill 允许你通过命令行工具与 Gate.io 期货交易平台进行交互。支持行情查询、账户管理、订单创建、持仓查询等功能。

平台支持

  • Windows: futures-trader.txt (实际为可执行文件,重命名为.txt,已压缩)
  • Linux: futures-trader-linux-amd64.txt (实际为可执行文件,重命名为.txt,已压缩)

重要说明

  • Windows: 必须在 CMD 中运行(不是 PowerShell),使用以下命令:
    powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt \x3C命令>' -Wait -NoNewWindow"
    
  • Linux: 直接运行:
    ./futures-trader-linux-amd64.txt \x3C命令>
    

文件大小

  • Windows: 约 2.7MB (UPX 压缩后)
  • Linux: 约 2.6MB (UPX 压缩后)

前置条件

  • 需要先使用 save-key 命令保存 Gate.io API 密钥
  • API 密钥需要在 Gate.io 后台申请,并确保已启用期货交易权限
  • 密钥将安全存储在 ~/.futures_trader/config.json

可用命令

1. 密钥管理

  • save-key - 保存 Gate.io API 密钥
  • clear-key - 清除已保存的 API 密钥

2. 账户查询

  • account - 查询期货账户信息(USDT/ BTC 结算账户)
  • positions - 查询当前持仓信息

3. 订单管理

  • create-order - 创建市价/限价订单(开仓/平仓)
  • cancel-price-orders - 批量取消自动订单
  • get-price-orders - 查询自动订单列表

4. 行情查询

  • market kline - 查询K线数据(期货)
  • market ticker - 查询行情快照(期货)
  • market funding - 查询资金费率(期货)

5. 合约查询

  • contract - 查询单个合约详细信息(最新价、持仓量、杠杆、手续费等)

使用流程

第一步:保存API密钥

Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt save-key --api-key YOUR_API_KEY --api-secret YOUR_API_SECRET' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt save-key --api-key YOUR_API_KEY --api-secret YOUR_API_SECRET

第二步:查询行情

Windows (CMD):

# 查询K线数据
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt market kline --contract BTC_USDT --interval 1h --limit 24' -Wait -NoNewWindow"

# 查询行情快照
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt market ticker --contract BTC_USDT' -Wait -NoNewWindow"

# 查询资金费率
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt market funding --contract BTC_USDT' -Wait -NoNewWindow"

Linux:

# 查询K线数据
./futures-trader-linux-amd64.txt market kline --contract BTC_USDT --interval 1h --limit 24

# 查询行情快照
./futures-trader-linux-amd64.txt market ticker --contract BTC_USDT

# 查询资金费率
./futures-trader-linux-amd64.txt market funding --contract BTC_USDT

第三步:查询账户和持仓

Windows (CMD):

# 查询账户信息
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt account --settle usdt' -Wait -NoNewWindow"

# 查询持仓信息
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt positions --settle usdt' -Wait -NoNewWindow"

Linux:

# 查询账户信息
./futures-trader-linux-amd64.txt account --settle usdt

# 查询持仓信息
./futures-trader-linux-amd64.txt positions --settle usdt

第三步:查询合约信息

注意: 用于查询合约详细信息,包括每张合约价值、杠杆、手续费等

Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt contract --settle usdt --contract BTC_USDT' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt contract --settle usdt --contract BTC_USDT

第四步:创建订单

注意: 创建订单会实际进行交易,请谨慎操作!

Windows (CMD):

# 开多仓(买入)
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt create-order --contract BTC_USDT --size 100 --price 70000' -Wait -NoNewWindow"

# 开空仓(卖出)
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt create-order --contract BTC_USDT --size -100 --price 70000' -Wait -NoNewWindow"

# 平多仓(卖出)
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt create-order --contract BTC_USDT --size 100 --close' -Wait -NoNewWindow"

# 平空仓(买入)
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt create-order --contract BTC_USDT --size -100 --close' -Wait -NoNewWindow"

Linux:

# 开多仓(买入)
./futures-trader-linux-amd64.txt create-order --contract BTC_USDT --size 100 --price 70000

# 开空仓(卖出)
./futures-trader-linux-amd64.txt create-order --contract BTC_USDT --size -100 --price 70000

# 平多仓(卖出)
./futures-trader-linux-amd64.txt create-order --contract BTC_USDT --size 100 --close

# 平空仓(买入)
./futures-trader-linux-amd64.txt create-order --contract BTC_USDT --size -100 --close

参数说明

合约标识

格式:基础货币_结算货币,例如:

  • BTC_USDT - 比特币/USDT合约
  • ETH_USDT - 以太坊/USDT合约
  • SOL_USDT - Solana/USDT合约

K线时间间隔

支持的间隔:1m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 12h, 1d, 3d, 7d

订单参数

size(交易张数) - 必填

  • 正数:开多仓或平空仓
  • 负数:开空仓或平多仓
  • 示例:--size 100 开多100张,--size -100 开空100张

price(委托价格) - 可选

  • 限价单:指定价格,如 --price 70000
  • 市价单:设为 0 或不填,如 --price 0

tif(订单有效时间) - 可选,默认 gtc

  • gtc - 挂单取消(默认)
  • ioc - 立即成交或取消
  • fok - 全部成交或取消
  • poc - 部分成交取消

settle(结算货币) - 可选,默认 usdt

  • usdt - USDT结算账户
  • btc - BTC结算账户

text(自定义订单ID) - 可选

  • 必须以 t- 开头
  • 总长度不超过 28 字节
  • 示例:--text t-order123

reduce-only(只减仓) - 可选,默认 false

  • 仅用于平仓,防止意外开仓

close(平仓模式) - 可选,默认 false

  • 单仓模式平仓时使用

auto-size(双仓模式平仓方向) - 可选

  • close_long - 平多仓
  • close_short - 平空仓

订单方向说明

开仓操作

  • 开多仓--size 正数,如 --size 100
  • 开空仓--size 负数,如 --size -100

平仓操作

  • 平多仓--size 正数 + --close,如 --size 100 --close
  • 平空仓--size 负数 + --close,如 --size -100 --close

双仓模式

  • 使用 --auto-size 参数指定平仓方向
  • 示例:--size 100 --auto-size close_long

示例场景

1. 用户问:"帮我查询一下BTC最近24小时的K线数据" Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt market kline --contract BTC_USDT --interval 1h --limit 24' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt market kline --contract BTC_USDT --interval 1h --limit 24

2. 用户问:"查看一下ETH的行情快照" Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt market ticker --contract ETH_USDT' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt market ticker --contract ETH_USDT

3. 用户问:"查询一下USDT账户的余额" Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt account --settle usdt' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt account --settle usdt

4. 用户问:"我当前有多少BTC多仓" Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt positions --settle usdt' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt positions --settle usdt

5. 用户问:"帮我开100个BTC的多仓,价格70000" Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt create-order --contract BTC_USDT --size 100 --price 70000' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt create-order --contract BTC_USDT --size 100 --price 70000

6. 用户问:"帮我开100个BTC的空仓,市价" Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt create-order --contract BTC_USDT --size -100 --price 0' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt create-order --contract BTC_USDT --size -100 --price 0

7. 用户问:"帮我平掉所有ETH空仓" Windows (CMD):

# 先查看持仓
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt positions --settle usdt' -Wait -NoNewWindow"

# 假设持仓为-50张,执行平空仓
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt create-order --contract ETH_USDT --size 50 --close' -Wait -NoNewWindow"

Linux:

# 先查看持仓
./futures-trader-linux-amd64.txt positions --settle usdt

# 假设持仓为-50张,执行平空仓
./futures-trader-linux-amd64.txt create-order --contract ETH_USDT --size 50 --close

8. 用户问:"帮我查询资金费率" Windows (CMD):

powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt market funding --contract BTC_USDT' -Wait -NoNewWindow"

Linux:

./futures-trader-linux-amd64.txt market funding --contract BTC_USDT

数字参数规则

价格参数

  • 必须是有效数字
  • 不能为负数
  • 示例:70000, 2100.50, 0 (市价)

数量参数

  • 必须是整数
  • 正数表示买入/开多/平空
  • 负数表示卖出/开空/平多
  • 示例:100, -50, 1

有效时间参数

  • 必须是以下之一:gtc, ioc, fok, poc
  • 示例:--tif ioc

结算货币参数

  • 必须是以下之一:usdt, btc
  • 示例:--settle usdt

错误处理

1. 密钥未保存

错误:配置文件不存在,请先使用 save-key 命令保存密钥

解决:运行 futures-trader save-key 保存密钥

2. API认证失败

错误:401 Unauthorized

原因:API密钥无效或签名错误 解决:重新保存正确的API密钥

3. 订单创建失败

错误:订单数量不足

原因:可用余额不足或数量不符合最小单位要求 解决:检查账户余额和最小下单数量

4. 合约不存在

错误:contract格式应为'基础货币_结算货币'

原因:合约标识格式错误 解决:使用正确的格式,如 BTC_USDT

5. 参数验证失败

错误:size必须是整数
错误:price必须是有效数字
错误:tif必须是: [gtc ioc fok poc]

原因:参数格式不正确 解决:检查参数格式和取值范围

帮助文档

Windows (CMD):

# 查看主命令帮助
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt --help' -Wait -NoNewWindow"

# 查看具体命令的详细说明
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt [command] --help' -Wait -NoNewWindow"

# 查看订单命令参数说明
powershell -Command "Start-Process -FilePath 'cmd.exe' -ArgumentList '/c', 'cd \x3C目录> && futures-trader.txt create-order --help' -Wait -NoNewWindow"

Linux:

# 查看主命令帮助
./futures-trader-linux-amd64.txt --help

# 查看具体命令的详细说明
./futures-trader-linux-amd64.txt [command] --help

# 查看订单命令参数说明
./futures-trader-linux-amd64.txt create-order --help
Usage Guidance
Do not run these bundled executables or store production Gate.io API keys until you can verify their provenance. Red flags: (1) the package includes UPX-compressed executables renamed to .txt (obfuscation), (2) registry metadata lists no credentials while the instructions ask you to provide API key/secret, and (3) there is a prompt-injection indicator in SKILL.md. If you consider using this skill: 1) ask the publisher for source code, a public repository, and signed release binaries (checksums/signatures); 2) verify hashes/signatures before running and scan binaries with AV/IDS; 3) prefer building from source or using an official/known Gate.io client; 4) if you must test, run in an isolated VM or sandbox with minimal funds and use API keys limited to the minimum permissions (or create a sub-account with minimal balance and IP restrictions); 5) inspect ~/.futures_trader/config.json handling and ensure it’s stored encrypted, or avoid storing keys there; 6) request the publisher to update registry metadata to declare required credentials transparently. Additional authoritative information (source code, reproducible build instructions, signed releases) would change the assessment toward benign.
Capability Analysis
Type: OpenClaw Skill Name: futures-trader Version: 1.0.2 The skill bundle provides opaque, UPX-compressed binaries for Windows and Linux that are misleadingly renamed with .txt extensions (e.g., futures-trader.txt), which is a common technique to evade file-type filters. The tool requires users to provide sensitive Gate.io API keys, which are stored in a local configuration file (~/.futures_trader/config.json) and accessed by these unverified binaries. While the SKILL.md instructions describe legitimate trading functionality, the combination of opaque executables, evasion tactics, and the handling of high-value financial credentials presents a significant risk of credential theft.
Capability Assessment
Purpose & Capability
The SKILL.md describes a CLI that needs Gate.io API keys and will save them locally, which is consistent with a trading CLI; however the registry metadata declares no required credentials or primary credential. The manifest includes two large executable files (renamed with .txt) which are necessary for a CLI, but the origin is unknown. The mismatch between declared requirements (none) and the actual instructions (explicitly require API keys) is an incoherence.
Instruction Scope
Runtime instructions tell the agent/user to run the included binaries and to save Gate.io API keys via a provided 'save-key' command that stores secrets at ~/.futures_trader/config.json. The SKILL.md also instructs using executables renamed to .txt and compressed — an attempt to obfuscate distribution. There is no instruction to verify binary integrity or origin, and a prompt-injection signal (unicode-control-chars) was detected in SKILL.md, which increases concern about manipulation or hidden payloads.
Install Mechanism
Although the skill has no formal install spec, the bundle contains two large packed executables (UPX mentioned in the files) renamed as .txt. Bundling opaque, compressed binaries with no source, signature, checksum, or provenance is high risk. Renaming executables to .txt is a red flag intended to evade simple filters.
Credentials
The SKILL.md requires a Gate.io API key and secret (with futures permissions) and instructs storing them locally, which is expected for a trading CLI; however the skill metadata lists no required environment variables or primary credential, creating a transparency gap. Requesting full API credentials without declared requirement in the registry is disproportionate and makes auditing harder.
Persistence & Privilege
The skill will create a config file (~/.futures_trader/config.json) to persist API keys; this is normal for a CLI but means secrets are stored on disk. The skill is not always-enabled and does not request elevated platform privileges in metadata, but the bundled executables will remain on disk and could be executed repeatedly — verify before running.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install futures-trader
  3. After installation, invoke the skill by name or use /futures-trader
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.2
全能交易终端:一站式集成 Gate.io 期货行情查询、账户管理及核心交易功能。 跨平台深度适配:完美支持 Windows (CMD) 与 Linux 双系统,提供原生命令行交互体验。 极致交易掌控:支持市价/限价单、开平仓及双仓模式切换,助你毫秒级响应市场波动。 安全合规基石:采用本地化加密存储方案(~/.futures_trader/),确保 API 密钥物理隔离,安全无忧。 开箱即用:内置详尽的命令指南与保姆级示例,新手也能快速上手专业交易。
v1.0.1
全能交易终端:一站式集成 Gate.io 期货行情查询、账户管理及核心交易功能。 跨平台深度适配:完美支持 Windows (CMD) 与 Linux 双系统,提供原生命令行交互体验。 极致交易掌控:支持市价/限价单、开平仓及双仓模式切换,助你毫秒级响应市场波动。 安全合规基石:采用本地化加密存储方案(~/.futures_trader/),确保 API 密钥物理隔离,安全无忧。 开箱即用:内置详尽的命令指南与保姆级示例,新手也能快速上手专业交易。
v1.0.0
全能交易终端:一站式集成 Gate.io 期货行情查询、账户管理及核心交易功能。 跨平台深度适配:完美支持 Windows (CMD) 与 Linux 双系统,提供原生命令行交互体验。 极致交易掌控:支持市价/限价单、开平仓及双仓模式切换,助你毫秒级响应市场波动。 安全合规基石:采用本地化加密存储方案(~/.futures_trader/),确保 API 密钥物理隔离,安全无忧。 开箱即用:内置详尽的命令指南与保姆级示例,新手也能快速上手专业交易。
Metadata
Slug futures-trader
Version 1.0.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is Gate.io 期货交易 CLI 工具?

当用户需要查询Gate.io期货行情、管理账户、下单交易时使用此Skill。它提供完整的CLI命令行工具。 It is an AI Agent Skill for Claude Code / OpenClaw, with 443 downloads so far.

How do I install Gate.io 期货交易 CLI 工具?

Run "/install futures-trader" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Gate.io 期货交易 CLI 工具 free?

Yes, Gate.io 期货交易 CLI 工具 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Gate.io 期货交易 CLI 工具 support?

Gate.io 期货交易 CLI 工具 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Gate.io 期货交易 CLI 工具?

It is built and maintained by QiuMr (@qiumr); the current version is v1.0.2.

💬 Comments