gate-exchange-bot

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Gate Exchange Bot

Gate Exchange Bot

General Rules

通用规则

⚠️ STOP — You MUST read and strictly follow the shared runtime rules before proceeding. Do NOT select or call any tool until all rules are read. These rules have the highest priority. → Read gate-runtime-rules.md
  • Only call MCP tools explicitly listed in this skill. Tools not documented here must NOT be called, even if they exist in the MCP server.
  • Only use the
    gate-cli
    subcommands explicitly listed in this skill and its references.
    Commands not documented here must NOT be run for these workflows, even if other interfaces expose them.
⚠️ 停止操作——在继续之前,您必须阅读并严格遵守共享的运行时规则。 在未阅读所有规则之前,请勿选择或调用任何工具。这些规则具有最高优先级。 → 阅读 gate-runtime-rules.md
  • 仅调用本技能中明确列出的MCP工具。 即使MCP服务器中存在未在此处记录的工具,也不得调用。
  • 仅使用本技能及其参考文档中明确列出的
    gate-cli
    子命令。
    即使其他接口提供了未在此处记录的命令,也不得在这些工作流中运行。

Authoring Language

编写语言

This skill is authored in English. End-user replies should still follow normal language adaptation.
本技能以英文编写。最终用户回复仍需遵循常规语言适配规则。

Skill Dependencies

技能依赖

gate-cli commands used

使用的gate-cli命令

Query Operations (Read-only)
  • gate-cli cex bot strategy recommend
  • gate-cli cex bot portfolio running
  • gate-cli cex bot portfolio detail
Execution Operations (Write)
  • gate-cli cex bot spot-grid create
  • gate-cli cex bot margin-grid create
  • gate-cli cex bot infinite-grid create
  • gate-cli cex bot futures-grid create
  • gate-cli cex bot spot-martingale create
  • gate-cli cex bot contract-martingale create
  • gate-cli cex bot portfolio stop
查询操作(只读)
  • gate-cli cex bot strategy recommend
  • gate-cli cex bot portfolio running
  • gate-cli cex bot portfolio detail
执行操作(写入)
  • gate-cli cex bot spot-grid create
  • gate-cli cex bot margin-grid create
  • gate-cli cex bot infinite-grid create
  • gate-cli cex bot futures-grid create
  • gate-cli cex bot spot-martingale create
  • gate-cli cex bot contract-martingale create
  • gate-cli cex bot portfolio stop

MCP-backed command mapping

基于MCP的命令映射

gate-cli
command
Backing bot capability
gate-cli cex bot strategy recommend
cex_bot_get_ai_hub_strategy_recommend
gate-cli cex bot portfolio running
cex_bot_get_ai_hub_portfolio_running
gate-cli cex bot portfolio detail
cex_bot_get_ai_hub_portfolio_detail
gate-cli cex bot spot-grid create
cex_bot_post_ai_hub_spot_grid_create
gate-cli cex bot margin-grid create
cex_bot_post_ai_hub_margin_grid_create
gate-cli cex bot infinite-grid create
cex_bot_post_ai_hub_infinite_grid_create
gate-cli cex bot futures-grid create
cex_bot_post_ai_hub_futures_grid_create
gate-cli cex bot spot-martingale create
cex_bot_post_ai_hub_spot_martingale_create
gate-cli cex bot contract-martingale create
cex_bot_post_ai_hub_contract_martingale_create
gate-cli cex bot portfolio stop
cex_bot_post_ai_hub_portfolio_stop
gate-cli
命令
对应的机器人能力
gate-cli cex bot strategy recommend
cex_bot_get_ai_hub_strategy_recommend
gate-cli cex bot portfolio running
cex_bot_get_ai_hub_portfolio_running
gate-cli cex bot portfolio detail
cex_bot_get_ai_hub_portfolio_detail
gate-cli cex bot spot-grid create
cex_bot_post_ai_hub_spot_grid_create
gate-cli cex bot margin-grid create
cex_bot_post_ai_hub_margin_grid_create
gate-cli cex bot infinite-grid create
cex_bot_post_ai_hub_infinite_grid_create
gate-cli cex bot futures-grid create
cex_bot_post_ai_hub_futures_grid_create
gate-cli cex bot spot-martingale create
cex_bot_post_ai_hub_spot_martingale_create
gate-cli cex bot contract-martingale create
cex_bot_post_ai_hub_contract_martingale_create
gate-cli cex bot portfolio stop
cex_bot_post_ai_hub_portfolio_stop

Authentication

身份验证

  • Interactive file setup: when
    GATE_API_KEY
    and
    GATE_API_SECRET
    are not both set on the host, run
    gate-cli config init
    to complete the wizard for API key, secret, profiles, and defaults (see gate-cli).
  • Env / flags:
    gate-cli config init
    is not required when credentials are already supplied — for example when both
    GATE_API_KEY
    and
    GATE_API_SECRET
    are set on the host, or when
    --api-key
    /
    --api-secret
    are supported. Never ask the user to paste secrets into chat.
  • API Key Required: Yes
  • Permissions: Bot:Read, Bot:Write
  • Portal: create or rotate keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage
  • 交互式文件设置: 当主机上未同时设置
    GATE_API_KEY
    GATE_API_SECRET
    时,运行
    gate-cli config init
    完成API密钥、密钥、配置文件和默认设置的向导(参见gate-cli)。
  • 环境变量/标志: 当已提供凭据时,无需运行
    gate-cli config init
    ——例如主机上已同时设置
    GATE_API_KEY
    GATE_API_SECRET
    ,或支持
    --api-key
    /
    --api-secret
    参数时。切勿要求用户在聊天中粘贴密钥。
  • 需要API密钥:是
  • 权限: Bot:Read, Bot:Write
  • 门户: 在聊天外创建或轮换密钥:https://www.gate.com/myaccount/profile/api-key/manage

Installation Check

安装检查

  • Required:
    gate-cli
    . Run
    sh setup.sh
    from this skill directory if it is missing. Optional:
    GATE_CLI_SETUP_MODE=release
    .
  • Add
    $HOME/.openclaw/skills/bin
    to
    PATH
    if you invoke
    gate-cli
    by name.
  • Host dependencies for
    setup.sh
    :
    curl
    ,
    tar
    , and either
    shasum
    or
    sha256sum
    . If user-local installation fails,
    setup.sh
    may fall back to
    sudo install
    into
    /usr/local/bin
    .
  • Credentials: When
    GATE_API_KEY
    and
    GATE_API_SECRET
    are both set (non-empty) for the host, do not require
    gate-cli config init
    . When both are unset or empty, remind the operator to run
    gate-cli config init
    or configure matching environment variables outside chat.
  • Sanity check: Before any mutating call, confirm the CLI behaves as expected with a read-only probe such as
    gate-cli --version
    or
    gate-cli cex bot strategy recommend --help
    .
  • 必需:
    gate-cli
    。如果缺失,请从本技能目录运行
    sh setup.sh
    。可选:
    GATE_CLI_SETUP_MODE=release
  • 如果直接通过名称调用
    gate-cli
    ,请将
    $HOME/.openclaw/skills/bin
    添加到**
    PATH
    **中。
  • setup.sh
    的主机依赖:
    curl
    tar
    以及
    shasum
    sha256sum
    。如果用户本地安装失败,
    setup.sh
    可能会回退到使用
    sudo install
    安装到
    /usr/local/bin
  • 凭据: 当主机上
    GATE_API_KEY
    GATE_API_SECRET
    均已设置(非空)时,无需要求运行
    gate-cli config init
    。当两者均未设置或为空时,提醒操作员运行
    gate-cli config init
    或在聊天外配置匹配的环境变量。
  • 完整性检查: 在执行任何变更操作之前,通过只读探测确认CLI运行正常,例如
    gate-cli --version
    gate-cli cex bot strategy recommend --help

Resolving
gate-cli
(binary path)

解析
gate-cli
(二进制路径)

Resolve
gate-cli
in order: (1)
command -v gate-cli
and
gate-cli --version
succeeds; (2)
${HOME}/.local/bin/gate-cli
if executable; (3)
${HOME}/.openclaw/skills/bin/gate-cli
if executable. Canonical rules:
exchange-runtime-rules.md
§4 (or
gate-runtime-rules.md
§4).
按以下顺序解析**
gate-cli
(1)**
command -v gate-cli
gate-cli --version
执行成功;
(2)
如果
${HOME}/.local/bin/gate-cli
可执行;(3) 如果
${HOME}/.openclaw/skills/bin/gate-cli
可执行。标准规则:
exchange-runtime-rules.md
§4(或
gate-runtime-rules.md
§4)。

Execution

执行流程

Read and strictly follow
references/gate-cli.md
, then execute the matched route in this
SKILL.md
.
  • SKILL.md
    keeps intent routing, safety policy, and product boundaries.
  • references/gate-cli.md
    is the authoritative execution contract for command probing,
    body
    payload handling, confirmation gates, and verification.
  • references/scenarios.md
    provides scenario-style examples for review, testing, and publication completeness.
阅读并严格遵循
references/gate-cli.md
,然后执行本
SKILL.md
中匹配的流程。
  • SKILL.md
    用于意图路由、安全策略和产品边界定义。
  • references/gate-cli.md
    是命令探测、
    body
    负载处理、确认机制和验证的权威执行契约。
  • references/scenarios.md
    提供场景式示例,供评审、测试和确保发布完整性。

Domain Knowledge

领域知识

  • Strategy recommendation is read-only and must stay separate from creation.
  • Grid and martingale flows require different payload schemas and must not share fields across products.
  • Running-strategy stop is always a single-strategy action; bulk stop is out of scope.
  • Percentage-style business inputs must be normalized into decimal ratio strings before any write command.
  • Portfolio detail and stop flows depend on an exact
    strategy_id
    plus the correct
    strategy_type
    .
  • 策略推荐是只读操作,必须与创建操作分开。
  • 网格和马丁格尔流程需要不同的负载模式,产品之间不得共享字段。
  • 运行中策略的停止始终是单策略操作;批量停止不在范围内。
  • 在执行任何写入命令之前,必须将百分比形式的业务输入标准化为小数比率字符串。
  • 组合详情和停止流程依赖于精确的
    strategy_id
    和正确的
    strategy_type

Module Overview

模块概述

ModuleDescriptionTrigger keywords
DiscoverRecommend AIHub bot strategies by market, strategy type, filter, or refresh context
recommend strategy
,
bundle
,
top1
,
refresh recommendation
,
filter strategy
Spot GridManual spot grid creation
spot grid
,
manual grid
Margin GridManual margin grid creation
margin grid
Infinite GridManual infinite grid creation
infinite grid
Futures GridManual futures grid creation
futures grid
,
contract grid
Spot MartingaleManual spot martingale creation
spot martingale
Contract MartingaleManual contract martingale creation
contract martingale
,
futures martingale
Portfolio ListList running strategies
running strategies
,
bots I have running
,
portfolio running
Portfolio DetailQuery a single strategy detail
strategy detail
,
bot detail
,
P&L detail
Portfolio StopStop one running strategy
stop strategy
,
stop bot
模块描述触发关键词
Discover(发现)根据市场、策略类型、筛选条件或刷新上下文推荐AIHub机器人策略
recommend strategy
,
bundle
,
top1
,
refresh recommendation
,
filter strategy
Spot Grid(现货网格)手动创建现货网格
spot grid
,
manual grid
Margin Grid(杠杆网格)手动创建杠杆网格
margin grid
Infinite Grid(无限网格)手动创建无限网格
infinite grid
Futures Grid(合约网格)手动创建合约网格
futures grid
,
contract grid
Spot Martingale(现货马丁格尔)手动创建现货马丁格尔策略
spot martingale
Contract Martingale(合约马丁格尔)手动创建合约马丁格尔策略
contract martingale
,
futures martingale
Portfolio List(组合列表)列出运行中的策略
running strategies
,
bots I have running
,
portfolio running
Portfolio Detail(组合详情)查询单个策略详情
strategy detail
,
bot detail
,
P&L detail
Portfolio Stop(组合停止)停止一个运行中的策略
stop strategy
,
stop bot

Routing Rules

路由规则

IntentExample phrasesRoute to
Strategy recommendation"Recommend a BTC strategy", "Give me a spot grid recommendation", "Refresh that recommendation"Read
references/strategy-recommend.md
Spot grid create"Create a BTC spot grid from 60000 to 72000 with 50 grids and 1000 USDT"Read
references/create-spot-grid.md
Margin grid create"Create a margin grid with 3x leverage and 50 grids"Read
references/create-margin-grid.md
Infinite grid create"Create a BTC infinite grid with 1.5% profit per grid"Read
references/create-infinite-grid.md
Futures grid create"Create a BTC futures grid with 5x leverage and neutral direction"Read
references/create-futures-grid.md
Spot martingale create"Create a spot martingale that adds after a 2% drop"Read
references/create-spot-martingale.md
Contract martingale create"Create a contract martingale, 5x leverage, short bias"Read
references/create-contract-martingale.md
Running list"What bots do I have running?"Read
references/list-running.md
Strategy detail"Show me that bot's detailed P&L"Read
references/get-detail.md
Stop strategy"Stop that BTC grid bot"Read
references/stop-strategy.md
意图示例短语路由至
策略推荐"推荐一个BTC策略", "给我一个现货网格推荐", "刷新那个推荐"阅读
references/strategy-recommend.md
创建现货网格"创建一个BTC现货网格,区间60000到72000,50个网格,1000 USDT"阅读
references/create-spot-grid.md
创建杠杆网格"创建一个3倍杠杆、50个网格的杠杆网格"阅读
references/create-margin-grid.md
创建无限网格"创建一个每个网格盈利1.5%的BTC无限网格"阅读
references/create-infinite-grid.md
创建合约网格"创建一个5倍杠杆、中性方向的BTC合约网格"阅读
references/create-futures-grid.md
创建现货马丁格尔"创建一个下跌2%后加仓的现货马丁格尔策略"阅读
references/create-spot-martingale.md
创建合约马丁格尔"创建一个合约马丁格尔策略,5倍杠杆,空头偏向"阅读
references/create-contract-martingale.md
运行中列表"我有哪些机器人在运行?"阅读
references/list-running.md
策略详情"展示那个机器人的详细盈亏情况"阅读
references/get-detail.md
停止策略"停止那个BTC网格机器人"阅读
references/stop-strategy.md

gate-cli Command Index

gate-cli命令索引

#CommandPurpose
1
gate-cli cex bot strategy recommend
Discover recommendations for
top1
,
bundle
,
filter
, or
refresh
scenes
2
gate-cli cex bot spot-grid create
Create a manual spot grid
3
gate-cli cex bot margin-grid create
Create a manual margin grid
4
gate-cli cex bot infinite-grid create
Create a manual infinite grid
5
gate-cli cex bot futures-grid create
Create a manual futures grid
6
gate-cli cex bot spot-martingale create
Create a manual spot martingale
7
gate-cli cex bot contract-martingale create
Create a manual contract martingale
8
gate-cli cex bot portfolio running
List running strategies
9
gate-cli cex bot portfolio detail
Query a single strategy detail
10
gate-cli cex bot portfolio stop
Stop one strategy
序号命令用途
1
gate-cli cex bot strategy recommend
top1
bundle
filter
refresh
场景提供推荐
2
gate-cli cex bot spot-grid create
创建手动现货网格
3
gate-cli cex bot margin-grid create
创建手动杠杆网格
4
gate-cli cex bot infinite-grid create
创建手动无限网格
5
gate-cli cex bot futures-grid create
创建手动合约网格
6
gate-cli cex bot spot-martingale create
创建手动现货马丁格尔策略
7
gate-cli cex bot contract-martingale create
创建手动合约马丁格尔策略
8
gate-cli cex bot portfolio running
列出运行中的策略
9
gate-cli cex bot portfolio detail
查询单个策略详情
10
gate-cli cex bot portfolio stop
停止一个策略

Execution Workflow

执行工作流

1. Intent classification

1. 意图分类

  • Determine whether the request is discover, manual create, or portfolio.
  • For manual create, resolve the exact bot type before reading the reference file.
  • For portfolio, resolve whether the user wants list, detail, or stop.
  • 判断请求属于发现手动创建还是组合管理
  • 对于手动创建,在阅读参考文件前确定确切的机器人类型。
  • 对于组合管理,确定用户需要列表详情还是停止操作。

2. Parameter discipline

2. 参数规范

  • Recommendation flows use query-style parameters only.
  • Create and stop flows pass the final business payload through
    body
    as a JSON string.
  • Any percentage-style input must be normalized exactly as required by the matched reference document before a write command is executed.
  • 推荐流程仅使用查询式参数。
  • 创建和停止流程通过**
    body
    **以JSON字符串形式传递最终业务负载。
  • 在执行写入命令之前,必须按照匹配的参考文档要求将任何百分比形式的输入标准化。

3. Scenario coverage

3. 场景覆盖

  • Use
    references/scenarios.md
    as the publication-facing scenario index.
  • Use the module-specific reference files as the source of detailed parameter and guardrail rules.
  • 使用
    references/scenarios.md
    作为面向发布的场景索引。
  • 使用模块特定的参考文件作为详细参数和防护规则的来源。

Safety Rules

安全规则

Confirmation

确认机制

  • Recommendation and read-only portfolio queries do not require confirmation.
  • Every write path must first present an action draft or confirmation summary.
  • Each create or stop action must be confirmed separately by the user in the immediately following turn.
  • If the user does not explicitly confirm, do not execute the write command.
  • 推荐和只读组合查询无需确认。
  • 每个写入路径必须先呈现操作草稿或确认摘要。
  • 每个创建或停止操作必须由用户在紧接着的对话轮次中单独确认。
  • 如果用户未明确确认,请勿执行写入命令。

Verification

验证规则

  • Do not judge success from HTTP
    200
    alone.
  • Always inspect the returned payload
    code
    ,
    message
    , and key
    data
    fields.
  • If a write fails, return the backend
    message
    faithfully rather than inventing thresholds or hidden restrictions.
  • 不能仅通过HTTP
    200
    状态码判断操作成功。
  • 必须始终检查返回负载的
    code
    message
    和关键
    data
    字段。
  • 如果写入操作失败,如实返回后端的
    message
    ,而非自行设定阈值或隐藏限制。

Error Handling

错误处理

  • Authentication or permission failure: stop writes and direct the operator to
    gate-cli config init
    or host-side credential recovery.
  • Missing or ambiguous business inputs: ask only for the missing fields; do not guess them.
  • Invalid backend payload or business-rule rejection: surface the backend
    message
    and keep the flow blocked until corrected.
  • Ambiguous stop target: switch to running-list selection before attempting a stop.
  • 身份验证或权限失败:停止写入操作,引导操作员执行
    gate-cli config init
    或在主机端恢复凭据。
  • 缺失或模糊的业务输入:仅询问缺失的字段;请勿猜测。
  • 无效的后端负载或业务规则拒绝:显示后端的
    message
    ,并在问题解决前阻止流程继续。
  • 模糊的停止目标:在尝试停止前切换到运行中列表选择流程。

Data and Privacy

数据与隐私

  • User prompts, strategy parameters, and command payloads flow through the host runtime,
    gate-cli
    , and Gate APIs needed for the requested bot action.
  • This skill does not define any extra telemetry, analytics, or custom persistence mechanism of its own.
  • Local shell history, terminal logs, or host-side audit logs may still exist depending on the operator environment.
  • Never ask the user to paste API secrets into chat. Credentials should be configured via
    gate-cli config init
    or equivalent secure host-side environment management.
  • 用户提示、策略参数和命令负载会通过主机运行时、
    gate-cli
    和Gate API传递,以完成请求的机器人操作。
  • 本技能未定义任何额外的遥测、分析或自定义持久化机制。
  • 根据操作员环境的不同,可能仍存在本地shell历史、终端日志或主机端审计日志。
  • 切勿要求用户在聊天中粘贴API密钥。凭据应通过
    gate-cli config init
    或等效的安全主机端环境管理方式配置。

Important Boundaries

重要边界

  • Do not turn education-only or consultation-only questions into writes.
  • Do not guess core strategy parameters such as range, grid count, leverage, direction, martingale deviation, or stop-loss ratio.
  • Bulk stop is not supported. Ambiguous stop requests must go through running-list selection and then single-strategy confirmation.
  • Advanced running-strategy management beyond recommendation, create, list, detail, and single stop remains out of scope unless explicitly documented in a reference file.
  • 不得将仅用于教育或咨询的问题转换为写入操作。
  • 不得猜测核心策略参数,如区间、网格数量、杠杆、方向、马丁格尔偏差或止损比率。
  • 不支持批量停止。模糊的停止请求必须先经过运行中列表选择,再进行单策略确认。
  • 除推荐、创建、列表、详情和单策略停止之外的高级运行中策略管理,除非在参考文件中明确记录,否则均不在范围内。