gate-exchange-autoinvest

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

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节)。

gate-exchange-autoinvest

gate-exchange-autoinvest

The fast auto-invest (DCA) function of Gate Exchange Earn, supporting create, update, stop plans, and query related information.
Gate交易所Earn板块的快速自动投资(DCA)功能,支持创建、更新、停止计划及查询相关信息。

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
exchange-runtime-rules.md
first (mirror:
exchange-runtime-rules.md
on GitHub
).
  • Only use the
    gate-cli
    commands explicitly listed in this skill.
    Commands not documented here must NOT be run for these workflows, even if other interfaces expose them.
⚠️ 停止操作——在继续之前,你必须阅读并严格遵守共享运行时规则。在读完所有规则之前,不要选择或调用任何工具。这些规则具有最高优先级。 → 首先阅读
exchange-runtime-rules.md
(镜像:GitHub上的
exchange-runtime-rules.md
)。
  • 仅使用本技能中明确列出的
    gate-cli
    命令
    。即使其他接口提供了未在此处记录的命令,也不得在这些工作流中运行。

Skill Dependencies

技能依赖

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 — e.g. both
    GATE_API_KEY
    and
    GATE_API_SECRET
    set on the host, or
    --api-key
    /
    --api-secret
    where supported — never ask the user to paste secrets into chat.
  • Permissions: Earn (auto-invest) access as required by your API key and deployment.
  • 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密钥和部署需具备Earn(自动投资)访问权限。
  • 入口:在聊天外创建或轮换密钥:https://www.gate.com/myaccount/profile/api-key/manage

Installation Check

安装检查

  • Required:
    gate-cli
    (install from gate-cli releases or via your environment’s Gate MCP / skills installer).
  • Add the directory containing
    gate-cli
    to
    PATH
    when invoking by name.
  • 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 to configure
    GATE_API_KEY
    /
    GATE_API_SECRET
    in the matching skill from the skill library (never ask the user to paste secrets into chat).
  • Sanity check: Confirm the CLI works (e.g.
    gate-cli --version
    or a read-only earn/auto-invest query from this skill) before plan mutations.
  • 必需组件
    gate-cli
    (从gate-cli发布页安装,或通过环境中的Gate MCP/技能安装程序安装)。
  • 调用时,将包含**
    gate-cli
    的目录添加到
    PATH
    **环境变量中。
  • 凭证:当主机上**
    GATE_API_KEY
    GATE_API_SECRET
    均已设置(非空)时,无需要求运行
    gate-cli config init
    。当两者均未设置或为空时,提醒操作人员运行
    gate-cli config init
    ,或从技能库的匹配技能中配置
    GATE_API_KEY
    ** /
    GATE_API_SECRET
    ——切勿要求用户在聊天中粘贴密钥。
  • 完整性检查:在修改计划前,确认CLI可正常工作(例如运行**
    gate-cli --version
    **或本技能中的只读Earn/自动投资查询命令)。

Risk Disclaimer

风险声明

Digital Asset Trading Risk Statement: Digital asset trading carries significant risks. Prices are subject to high volatility and market manipulation. Past performance is not indicative of future results. This skill provides informational tools only and does not constitute investment advice. Users are solely responsible for their investment decisions. Only invest what you can afford to lose. For full risk disclosure, please visit Gate's official website.
数字资产交易风险提示: 数字资产交易存在重大风险。价格波动剧烈,且可能受到市场操纵。过往业绩不代表未来结果。本技能仅提供信息工具,不构成投资建议。用户需对自身投资决策负全部责任。仅投资可承受损失的金额。完整风险披露请访问Gate官方网站。

AI Interaction Data Flow

AI交互数据流

Data Handling Notice: When you use this skill, your queries and account data are processed through AI systems to provide trading assistance. This includes:
  • Your trading instructions and preferences
  • Account balance and position information (read-only access)
  • Historical trading records for context
Important:
  • All data transmission is encrypted and follows Gate's privacy policy
  • AI processes data in real-time; no long-term storage of your trading data by the AI
  • You retain full control; AI only executes trades after your explicit confirmation
  • For privacy details, see Gate's Privacy Policy
数据处理说明: 使用本技能时,你的查询和账户数据将通过AI系统处理以提供交易协助,包括:
  • 你的交易指令和偏好
  • 账户余额和持仓信息(只读访问)
  • 历史交易记录用于上下文分析
重要提示
  • 所有数据传输均已加密,并遵循Gate隐私政策
  • AI实时处理数据;AI不会长期存储你的交易数据
  • 你拥有完全控制权;AI仅在你明确确认后执行交易
  • 隐私详情请查看Gate隐私政策

Feature Modules

功能模块

ModuleDescriptionTrigger Keywords
Plan ManagementCreate, update, stop, and add position to auto-invest plans
create DCA
,
auto-invest
,
stop plan
,
add to my DCA
,
dollar cost averaging
Information QueryQuery supported coins, minimum amounts, execution records, order details, and plan details
min amount
,
execution history
,
records
,
plan detail
模块描述触发关键词
计划管理创建、更新、停止自动投资计划,以及追加投资
create DCA
,
auto-invest
,
stop plan
,
add to my DCA
,
dollar cost averaging
信息查询查询支持的币种、最低投资金额、执行记录、订单详情及计划详情
min amount
,
execution history
,
records
,
plan detail

Business Rules

业务规则

Investment Currency Restrictions

投资币种限制

  • Only USDT or BTC supported as investment currency (the currency deducted each period)
  • Target coins can be other assets
  • 仅支持USDT或BTC作为投资币种(每期扣除的币种)
  • 目标币种可以是其他资产

Create Plan Constraints

创建计划约束

Required Parameters:
  • Target coins to invest (asset list)
  • Investment amount per period
Optional Parameters (with defaults):
  • Investment time: Defaults to daily at 10:00 (can be customized)
  • Fund source: Defaults to
    spot
    (spot account)
  • Fund flow: Defaults to
    auto_invest
    (purchased assets remain in Spot account)
Execution Time Restriction:
  • Auto-invest only supports execution on the hour (0-23 o'clock)
  • plan_period_hour
    must be an integer from 0 to 23
  • Minutes and seconds are not supported; all executions occur at :00
  • ⚠️ CRITICAL - Time Zone:
    plan_period_hour
    uses UTC time zone
    • When user specifies local time (e.g., "10:00 AM Beijing time"), convert to UTC before passing to API
    • Example: Beijing 10:00 (UTC+8) → UTC 02:00 → set
      plan_period_hour: 2
    • Fallback: If system time zone cannot be detected, use user's specified hour directly
    • Always show both UTC and local time in confirmation (or note if time zone detection failed)
    • See
      references/autoinvest-plans.md
      → Time Zone Handling section for detailed conversion rules
plan_period_day
(create plans only)
:
  • Required on create; value must not be
    0
    . Full workflow:
    references/autoinvest-plans.md
    → Workflow step 6.
  • By
    plan_period_type
    :
    • monthly
      : Day of month 1–30
    • weekly
      or
      biweekly
      : Weekday 1–7 (1 = Monday, 7 = Sunday)
    • daily
      ,
      hourly
      , or
      4-hourly
      : Use
      1
Investment Amount Limits:
  • Minimum amount: Must be ≥ the value returned by
    gate-cli cex earn auto-invest min-amount
  • Maximum amount: Must be ≤ the value returned by
    gate-cli cex earn auto-invest config
  • Before creating a plan:
    1. Call
      gate-cli cex earn auto-invest min-amount
      to query the minimum amount
    2. Call
      gate-cli cex earn auto-invest config
      to query the maximum amount
    3. Validate that the user's input amount is within the valid range
Target Coins Constraints (for multi-target plans):
  • Maximum target coins: A plan can have at most 10 target coins
  • Minimum allocation per coin: Each target coin must have at least 10% allocation (ratio ≥ 10)
  • Before creating a multi-target plan:
    1. Check that the number of target coins ≤ 10
    2. Check that each coin's ratio ≥ 10
    3. If validation fails, reject immediately with clear explanation
Fund Flow (where purchased assets go): After creating a plan, purchased assets will flow to one of two destinations based on the
fund_flow
parameter (API field: post-purchase destination):
API
fund_flow
Meaning (EN)Typical Gate app label (localized; may vary)
earn
Simple Earn / flexible earnOften labeled Simple Earn / flexible earn in English locales
auto_invest
Spot account (default)Spot account
  • fund_flow: "earn"
    → Assets automatically transfer to Simple Earn to earn interest
  • fund_flow: "auto_invest"
    → Assets remain in Spot account for manual management (default)
Important:
  • User should choose fund flow based on their investment strategy
  • earn
    is recommended for passive income on accumulated assets
  • auto_invest
    is recommended if user plans to trade or withdraw assets frequently
  • When users refer to Simple Earn (flexible earn) or spot account in any language, map to
    earn
    or
    auto_invest
    respectively when calling MCP create/update
  • Do not use angle brackets (
    <
    or
    >
    ) in user-facing replies.
必填参数
  • 投资的目标币种(资产列表)
  • 每期投资金额
可选参数(含默认值):
  • 投资时间:默认每日10:00 UTC(可自定义)
  • 资金来源:默认
    spot
    (现货账户)
  • 资金流向:默认
    auto_invest
    (购买的资产保留在现货账户)
执行时间限制
  • 自动投资仅支持整点执行(0-23点)
  • plan_period_hour
    必须是0到23之间的整数
  • 不支持分钟和秒;所有执行均在整点进行
  • ⚠️ 关键提示 - 时区
    plan_period_hour
    使用UTC时区
    • 当用户指定本地时间(例如“北京时间上午10:00”)时,转换为UTC时间后再传递给API
    • 示例:北京时间10:00(UTC+8)→ UTC 02:00 → 设置
      plan_period_hour: 2
    • 备选方案:如果无法检测系统时区,直接使用用户指定的小时数
    • 在确认信息中始终显示UTC时间和本地时间(或注明时区检测失败)
    • 详见
      references/autoinvest-plans.md
      → 时区处理部分的详细转换规则
plan_period_day
(仅创建计划时)
  • 创建计划时必填;值不能为
    0
    。完整工作流:
    references/autoinvest-plans.md
    → 工作流步骤6。
  • 根据**
    plan_period_type
    **:
    • monthly
      :每月1–30日
    • weekly
      biweekly
      :每周1–7日(1=周一7=周日
    • daily
      hourly
      4-hourly
      :使用**
      1
      **
投资金额限制
  • 最低金额:必须≥
    gate-cli cex earn auto-invest min-amount
    返回的值
  • 最高金额:必须≤
    gate-cli cex earn auto-invest config
    返回的值
  • 创建计划前:
    1. 调用
      gate-cli cex earn auto-invest min-amount
      查询最低金额
    2. 调用
      gate-cli cex earn auto-invest config
      查询最高金额
    3. 验证用户输入的金额是否在有效范围内
目标币种约束(多目标计划):
  • 最多目标币种数量:一个计划最多包含10个目标币种
  • 单币种最低分配比例:每个目标币种的分配比例至少为10%(ratio≥10)
  • 创建多目标计划前:
    1. 检查目标币种数量≤10
    2. 检查每个币种的比例≥10
    3. 如果验证失败,立即拒绝并给出明确说明
资金流向(购买资产的去向): 创建计划后,购买的资产将根据
fund_flow
参数(API字段:购买后去向)流向以下两个目的地之一:
API
fund_flow
英文含义Gate应用典型标签(本地化,可能有所不同)
earn
Simple Earn / 灵活理财英文环境中通常标注为Simple Earn / flexible earn
auto_invest
现货账户(默认)现货账户
  • fund_flow: "earn"
    → 资产自动转入Simple Earn赚取利息
  • fund_flow: "auto_invest"
    → 资产保留在现货账户供手动管理(默认)
重要提示
  • 用户应根据自身投资策略选择资金流向
  • earn
    推荐给希望通过积累资产获得被动收入的用户
  • auto_invest
    推荐给计划频繁交易或提取资产的用户
  • 当用户提及Simple Earn(灵活理财)或现货账户时,调用MCP创建/更新接口时分别映射为
    earn
    auto_invest
  • 用户回复中不要使用尖括号(
    <
    >
    )。

After Stopping a Plan

停止计划后

  • After stopping a plan, automatic deductions will cease
  • Purchased assets typically remain in the spot account
  • 停止计划后,自动扣款将终止
  • 已购买的资产通常保留在现货账户中

Next Purchase Time

下一次购买时间

  • This function does not provide specific query for the next automatic purchase time
  • For this information, please visit Gate App or website
  • 本功能不提供下一次自动购买时间的查询
  • 如需此信息,请访问Gate应用或官网

gate-cli command index

gate-cli命令索引

Auto-Invest Related Tools (11 tools)

自动投资相关工具(11个)

#Tool NameTypeFunction
1
gate-cli cex earn auto-invest create
WriteCreate a new auto-invest plan (See Create Plan Constraints)
2
gate-cli cex earn auto-invest update
WriteUpdate an existing plan
3
gate-cli cex earn auto-invest stop
WriteStop a plan (explicit user confirmation before call — same as other writes)
4
gate-cli cex earn auto-invest add-position
Write ⚠️Add position immediately (Call only once after confirmation, strictly no repeated calls)
5
gate-cli cex earn auto-invest plans
QueryList user's auto-invest plans
6
gate-cli cex earn auto-invest plan-detail
QueryView single plan details
7
gate-cli cex earn auto-invest coins
QueryQuery supported target coins
8
gate-cli cex earn auto-invest min-amount
QueryQuery minimum investment amount
9
gate-cli cex earn auto-invest records
QueryQuery plan execution records
10
gate-cli cex earn auto-invest orders
QueryQuery order details
11
gate-cli cex earn auto-invest config
QueryQuery auto-invest configuration options
序号工具名称类型功能
1
gate-cli cex earn auto-invest create
写入创建新的自动投资计划(详见创建计划约束)
2
gate-cli cex earn auto-invest update
写入更新现有计划
3
gate-cli cex earn auto-invest stop
写入停止计划(调用前需用户明确确认——与其他写入操作相同)
4
gate-cli cex earn auto-invest add-position
写入 ⚠️立即追加投资(确认后仅调用一次,严禁重复调用)
5
gate-cli cex earn auto-invest plans
查询列出用户的自动投资计划
6
gate-cli cex earn auto-invest plan-detail
查询查看单个计划详情
7
gate-cli cex earn auto-invest coins
查询查询支持的目标币种
8
gate-cli cex earn auto-invest min-amount
查询查询最低投资金额
9
gate-cli cex earn auto-invest records
查询查询计划执行记录
10
gate-cli cex earn auto-invest orders
查询查询订单详情
11
gate-cli cex earn auto-invest config
查询查询自动投资配置选项

Supporting Tools

支持工具

Tool NameFunction
gate-cli cex spot account get
Query spot account balance
gate-cli cex earn uni lends
Optional read-only context for Simple Earn / Uni balances when fund source or debits involve earn (see Execution → balance check)
工具名称功能
gate-cli cex spot account get
查询现货账户余额
gate-cli cex earn uni lends
当资金来源或扣款涉及Earn时,可选查询Simple Earn/Uni余额作为上下文(详见执行→余额检查)

Query Function Usage

查询功能使用方法

Tool Mapping

工具映射

User RequestTool to Use
List my auto-invest plans
gate-cli cex earn auto-invest plans
View single plan details
gate-cli cex earn auto-invest plan-detail
Query supported coins
gate-cli cex earn auto-invest coins
Query minimum investment amount
gate-cli cex earn auto-invest min-amount
View plan execution records
gate-cli cex earn auto-invest records
View order details
gate-cli cex earn auto-invest orders
Query auto-invest config
gate-cli cex earn auto-invest config
用户请求使用工具
列出我的自动投资计划
gate-cli cex earn auto-invest plans
查看单个计划详情
gate-cli cex earn auto-invest plan-detail
查询支持的币种
gate-cli cex earn auto-invest coins
查询最低投资金额
gate-cli cex earn auto-invest min-amount
查看计划执行记录
gate-cli cex earn auto-invest records
查看订单详情
gate-cli cex earn auto-invest orders
查询自动投资配置
gate-cli cex earn auto-invest config

Common Query Scenarios

常见查询场景

Scenario 1: Query Supported Coins

场景1:查询支持的币种

Example Questions:
  • "Which coins can I auto-invest in?"
  • "What target coins does auto-invest support?"
Operation: Use the
gate-cli cex earn auto-invest coins
tool to query, which will return a list of all coins that support auto-invest.

示例问题
  • "我可以自动投资哪些币种?"
  • "自动投资支持哪些目标币种?"
操作:使用
gate-cli cex earn auto-invest coins
工具查询,将返回所有支持自动投资的币种列表。

Scenario 2: Query Minimum Investment Amount

场景2:查询最低投资金额

Example Questions:
  • "What's the minimum amount per period for USDT auto-invest?"
  • "What's the minimum amount when BTC is the investment currency?"
Operation: Use the
gate-cli cex earn auto-invest min-amount
tool, need to specify the investment currency (USDT or BTC) and target coins.

示例问题
  • "USDT自动投资每期的最低金额是多少?"
  • "以BTC为投资币种时,最低金额是多少?"
操作:使用
gate-cli cex earn auto-invest min-amount
工具,需指定投资币种(USDT或BTC)和目标币种。

Scenario 3: View Execution History

场景3:查看执行历史

Example Questions:
  • "How many times has my BTC auto-invest been executed recently?"
  • "View the recent execution status of this plan"
Operation: Use
gate-cli cex earn auto-invest records
to view execution records, use
gate-cli cex earn auto-invest orders
to view specific order details.
Return Information Example:
📋 Auto-Invest Execution Records

- Plan: {Plan name or ID}
- Execution count: {count}
- Latest execution: {amount} {currency} → {target coin}

示例问题
  • "我的BTC自动投资最近执行了多少次?"
  • "查看这个计划的近期执行状态"
操作:使用
gate-cli cex earn auto-invest records
查看执行记录,使用
gate-cli cex earn auto-invest orders
查看具体订单详情。
返回信息示例
📋 自动投资执行记录

- 计划:{计划名称或ID}
- 执行次数:{次数}
- 最近一次执行:{金额} {币种} → {目标币种}

Scenario 4: Plan Not Found

场景4:未找到计划

Situation: No matching auto-invest plan found during query.
Prompt: No matching auto-invest plan found. You can create a new auto-invest plan.

情况:查询时未找到匹配的自动投资计划。
提示:未找到匹配的自动投资计划。你可以创建一个新的自动投资计划。

Other Query Functions

其他查询功能

  • List all plans: Use
    gate-cli cex earn auto-invest plans
    to view all your auto-invest plans
  • Query configuration: Use
    gate-cli cex earn auto-invest config
    to view available auto-invest settings and preset options
  • 列出所有计划:使用
    gate-cli cex earn auto-invest plans
    查看所有自动投资计划
  • 查询配置:使用
    gate-cli cex earn auto-invest config
    查看可用的自动投资设置和预设选项

Sub-Modules

子模块

ModuleDocumentPurpose
Plan Management
references/autoinvest-plans.md
Create, update, stop, and top-up (add position) workflows with detailed scenarios
Compliance & Rules
references/autoinvest-compliance.md
Investment currency restrictions, region compliance, and funding source rules
模块文档用途
计划管理
references/autoinvest-plans.md
包含创建、更新、停止及追加投资的工作流和详细场景
合规与规则
references/autoinvest-compliance.md
投资币种限制、区域合规及资金来源规则

Routing Rules

路由规则

User IntentRoute toKey Decision
Create plan
references/autoinvest-plans.md
→ Scenario 1/2
Single or multi-target
Update plan
references/autoinvest-plans.md
Modify existing plan parameters
Stop plan
references/autoinvest-plans.md
→ Scenario 9
Terminate automatic deductions
Top-up / Add position
references/autoinvest-plans.md
→ Scenario 10
One-off extra purchase
Query plansSKILL.md → Tool Mapping
gate-cli cex earn auto-invest plans
Query plan detailSKILL.md → Tool Mapping
gate-cli cex earn auto-invest plan-detail
Query supported coinsSKILL.md → Scenario 1
gate-cli cex earn auto-invest coins
Query minimum amountSKILL.md → Scenario 2
gate-cli cex earn auto-invest min-amount
Query execution recordsSKILL.md → Scenario 3
gate-cli cex earn auto-invest records
Query ordersSKILL.md → Tool Mapping
gate-cli cex earn auto-invest orders
Ask about restrictions
references/autoinvest-compliance.md
Investment currency, region, funding
用户意图路由至关键决策
创建计划
references/autoinvest-plans.md
→ 场景1/2
单目标或多目标
更新计划
references/autoinvest-plans.md
修改现有计划参数
停止计划
references/autoinvest-plans.md
→ 场景9
终止自动扣款
追加投资
references/autoinvest-plans.md
→ 场景10
一次性额外购买
查询计划SKILL.md → 工具映射
gate-cli cex earn auto-invest plans
查询计划详情SKILL.md → 工具映射
gate-cli cex earn auto-invest plan-detail
查询支持的币种SKILL.md → 场景1
gate-cli cex earn auto-invest coins
查询最低金额SKILL.md → 场景2
gate-cli cex earn auto-invest min-amount
查询执行记录SKILL.md → 场景3
gate-cli cex earn auto-invest records
查询订单SKILL.md → 工具映射
gate-cli cex earn auto-invest orders
询问限制规则
references/autoinvest-compliance.md
投资币种、区域、资金相关规则

Execution

执行流程

  1. Intent Detection: Analyze user request to determine operation type (create/update/stop/top-up/query/compliance)
  2. Route Selection:
    • Plan lifecycle operations (create/update/stop/top-up) → Load
      references/autoinvest-plans.md
      and follow workflows
    • Query operations → Use Tool Mapping table and call corresponding MCP tools directly
    • Compliance questions → Load
      references/autoinvest-compliance.md
      for rules and restrictions
  3. Parameter Validation:
    • For write operations: Validate investment currency (USDT/BTC only), amount range, execution time, and for creates
      plan_period_day
      per Create Plan Constraints
    • For queries: Extract required parameters from user request
  4. Balance Check (for write operations):
    • Call
      gate-cli cex spot account get
      to verify sufficient funds
    • For Simple Earn fund source: Call
      gate-cli cex earn uni lends
      if applicable
  5. Confirmation (for write operations):
    • Display operation summary (Action Draft)
    • Wait for explicit user confirmation
    • Stop plan (
      gate-cli cex earn auto-invest stop
      ): Show Action Draft and stop — do not call the tool in that same assistant turn. Call stop only after the user's next message contains explicit confirmation (
      references/autoinvest-plans.md
      → Scenario 9).
  6. MCP Tool Call:
    • Execute the corresponding tool from the MCP tools section (Auto-Invest Related Tools or Supporting Tools tables) only
    • Pass validated parameters
  7. Response Formatting:
    • Use Response Template from sub-module documents
    • Include key information: plan ID, amount, currency, targets, cadence
  1. 意图检测:分析用户请求,确定操作类型(创建/更新/停止/追加投资/查询/合规)
  2. 路由选择
    • 计划生命周期操作(创建/更新/停止/追加投资)→ 加载
      references/autoinvest-plans.md
      并遵循工作流
    • 查询操作→ 使用工具映射表直接调用对应的MCP工具
    • 合规问题→ 加载
      references/autoinvest-compliance.md
      获取规则和限制
  3. 参数验证
    • 写入操作:验证投资币种(仅USDT/BTC)、金额范围、执行时间,以及创建计划时的
      plan_period_day
      是否符合创建计划约束
    • 查询操作:从用户请求中提取必填参数
  4. 余额检查(写入操作):
    • 调用
      gate-cli cex spot account get
      验证资金充足
    • 若资金来源为Simple Earn:必要时调用
      gate-cli cex earn uni lends
  5. 确认(写入操作):
    • 显示操作摘要(操作草案)
    • 等待用户明确确认
    • 停止计划
      gate-cli cex earn auto-invest stop
      ):显示操作草案并提示停止——请勿在同一助手回复中调用工具。仅在用户下一条消息包含明确确认后调用停止工具(详见
      references/autoinvest-plans.md
      →场景9)。
  6. MCP工具调用
    • 仅执行MCP工具部分(自动投资相关工具或支持工具表)中的对应工具
    • 传递经过验证的参数
  7. 响应格式化
    • 使用子模块文档中的响应模板
    • 包含关键信息:计划ID、金额、币种、目标、周期

Domain Knowledge

领域知识

What is Auto-Invest (DCA)?

什么是自动投资(DCA)?

Dollar-Cost Averaging (DCA) is an investment strategy where you invest a fixed amount at regular intervals, regardless of market conditions. This approach:
  • Reduces timing risk by spreading purchases over time
  • Averages out entry prices across market volatility
  • Removes emotional decision-making from investing
  • Suitable for long-term accumulation strategies
**美元成本平均法(DCA)**是一种投资策略,无论市场状况如何,都定期投资固定金额。这种策略:
  • 通过分散购买时间降低择时风险
  • 在市场波动中平均买入价格
  • 消除投资中的情绪化决策
  • 适合长期积累策略

Auto-Invest vs Manual Trading

自动投资 vs 手动交易

AspectAuto-Invest (DCA)Manual Trading
ExecutionAutomatic, scheduledManual, on-demand
DisciplineHigh (no emotion)Varies (emotion-driven)
TimingSpread over timeSingle point
Use caseLong-term accumulationActive trading
Skill requiredLowHigh
维度自动投资(DCA)手动交易
执行方式自动、定时手动、按需
纪律性高(无情绪化影响)参差不齐(受情绪驱动)
时间选择分散在不同时间点单一时间点
适用场景长期积累主动交易
技能要求

Investment Currency

投资币种

  • Investment currency: The currency deducted from your account each period (USDT or BTC only)
  • Target coins: The cryptocurrencies you want to buy (can be any supported coin)
  • Example: Invest 100 USDT (investment currency) → Buy BTC (target coin)
  • 投资币种:每期从账户中扣除的币种(仅USDT或BTC)
  • 目标币种:你想要购买的加密货币(可以是任何支持的币种)
  • 示例:投资100 USDT(投资币种)→ 购买BTC(目标币种)

Cadence Options

周期选项

Period TypeDescriptionMin Interval
HourlyEvery N hours1 hour
DailyEvery day at specified hour1 day
WeeklyEvery week on specified day7 days
BiweeklyEvery 2 weeks14 days
MonthlyEvery month on specified day~30 days
周期类型描述最小间隔
每小时每N小时一次1小时
每日每日指定时间1天
每周每周指定日期7天
每两周每2周一次14天
每月每月指定日期~30天

Fund Flow Options

资金流向选项

After creating a plan, purchased assets flow to one of two destinations:
OptionField ValueDestinationChinese UI (typical)DescriptionUse Case
Simple Earn
fund_flow: "earn"
Simple EarnLocalized app labelAssets automatically transfer to Simple Earn to earn interestRecommended for: Passive income seekers, long-term holders who want to maximize returns
Spot Account
fund_flow: "auto_invest"
Spot AccountLocalized app labelAssets remain in Spot account for manual management (default)Recommended for: Active traders, users who plan to withdraw or transfer assets frequently
Important Notes:
  • This setting determines where purchased coins go after each auto-invest execution (post-purchase destination)
  • earn
    maps to Simple Earn;
    auto_invest
    maps to spot account. API values align with localized app strings; if docs and the app disagree, follow the in-app wording.
  • earn
    option provides additional passive income on accumulated assets
  • auto_invest
    option gives you full control to trade, withdraw, or transfer at any time
  • Default is
    auto_invest
    if not specified
创建计划后,购买的资产将流向以下两个目的地之一
选项字段值目的地中文UI(典型)描述适用场景
Simple Earn
fund_flow: "earn"
Simple Earn本地化应用标签资产自动转入Simple Earn赚取利息推荐给:寻求被动收入的用户、希望最大化收益的长期持有者
现货账户
fund_flow: "auto_invest"
现货账户本地化应用标签资产保留在现货账户供手动管理(默认)推荐给:活跃交易者、计划频繁提取或转移资产的用户
重要提示
  • 此设置决定每次自动投资执行后购买币种的去向(购买后目的地)
  • **
    earn
    对应Simple Earn;
    auto_invest
    **对应现货账户。API值与本地化应用字符串一致;若文档与应用不一致,以应用内表述为准。
  • earn
    选项可为积累的资产提供额外被动收入
  • auto_invest
    选项让你完全控制资产,可随时交易、提取或转移
  • 未指定时默认值为
    auto_invest

Safety Rules

安全规则

Default: no write without confirmation

默认规则:无确认不执行写入操作

Until the user has given explicit confirmation for the current Action Draft, do not call any write tool (
gate-cli cex earn auto-invest create
,
gate-cli cex earn auto-invest update
,
gate-cli cex earn auto-invest stop
,
gate-cli cex earn auto-invest add-position
). Only read/query operations are allowed—for example: list/detail plans, supported coins, min/max config, execution records and orders, and supporting balance reads (
gate-cli cex spot account get
,
gate-cli cex earn uni lends
).
在用户对当前操作草案给出明确确认之前,不得调用任何写入工具(
gate-cli cex earn auto-invest create
gate-cli cex earn auto-invest update
gate-cli cex earn auto-invest stop
gate-cli cex earn auto-invest add-position
)。仅允许读取/查询操作——例如:列出/查看计划、支持的币种、最小/最大配置、执行记录和订单,以及支持的余额读取(
gate-cli cex spot account get
gate-cli cex earn uni lends
)。

Mandatory Confirmation for Write Operations

写入操作必须确认

All write operations (create, update, stop, add position) MUST follow this confirmation workflow:
  1. Display Action Draft: Show complete operation details before execution
  2. Wait for Confirmation: Explicitly ask user "Please confirm to proceed"
  3. Execute Only After Confirmation: Do not proceed without user's explicit agreement
Stop plan (
gate-cli cex earn auto-invest stop
): Show Action Draft (plan ID, name, effect: future deductions stop) and end the turn asking for confirmation. Call MCP only after the user's following message explicitly confirms — never call stop in the same assistant response as the first draft, even if the user already named a plan ID.
所有写入操作(创建、更新、停止、追加投资)必须遵循以下确认工作流:
  1. 显示操作草案:执行前展示完整操作细节
  2. 等待确认:明确询问用户“请确认是否继续”
  3. 仅在确认后执行:无用户明确同意不得继续
停止计划
gate-cli cex earn auto-invest stop
):展示操作草案(计划ID、名称、效果:未来扣款终止)并结束当前回复,等待用户确认。仅在用户下一条消息明确确认后调用MCP工具——即使用户已提供计划ID,也不得在首次展示草案的同一助手回复中调用停止工具。

Stale confirmation

过期确认

If the user changes any material detail after seeing an Action Draft (amount, targets, cadence, plan ID, fund flow,
plan_period_hour
,
plan_period_day
, etc.), treat earlier confirmation as void. Show an updated Action Draft and obtain a fresh explicit confirmation before any write tool call.
如果用户在看到操作草案后更改了任何重要细节(金额、目标、周期、计划ID、资金流向、
plan_period_hour
plan_period_day
等),则之前的确认视为无效。展示更新后的操作草案,并在调用写入工具前获取新的明确确认。

Add Position Safety (Critical)

追加投资安全(关键)

⚠️ The
gate-cli cex earn auto-invest add-position
tool is extremely sensitive
:
  • Call EXACTLY ONCE per user confirmation
  • NEVER call multiple times for the same request (causes duplicate deductions)
  • Always confirm amount with user before calling
  • Check balance before calling
Bad practice ❌:
User: "Add more to my plan"
Assistant: [Calls add_position multiple times to show different amounts]
Good practice ✅:
User: "Add more to my plan"
Assistant: "How much would you like to add? Your current plan is 100 USDT per period."
User: "Add 50 USDT"
Assistant: [Shows draft] "Confirm to add 50 USDT?"
User: "Yes"
Assistant: [Calls add_position ONCE]
⚠️
gate-cli cex earn auto-invest add-position
工具极为敏感
  • 每一次用户确认仅调用一次
  • 切勿针对同一请求多次调用(会导致重复扣款)
  • 调用前始终与用户确认金额
  • 调用前检查余额
错误做法 ❌:
用户:"给我的计划追加投资"
助手:[多次调用add_position以展示不同金额]
正确做法 ✅:
用户:"给我的计划追加投资"
助手:"你想要追加多少?当前计划每期投资100 USDT。"
用户:"追加50 USDT"
助手:[展示草案] "确认追加50 USDT吗?"
用户:"是的"
助手:[调用add_position一次]

Parameter Validation

参数验证

Before calling any write tool:
ValidationRuleAction if Failed
Investment currencyMust be USDT or BTCReject and explain restriction
AmountMust be within [min, max] rangeQuery min/max, then reject with valid range
Execution timeMust be integer 0-23 (on the hour)Reject and explain hourly restriction
plan_period_day
(create)
Must not be
0
; ranges per
plan_period_type
(see Create Plan Constraints)
Reject with allowed ranges; see
references/autoinvest-plans.md
Workflow step 6
BalanceMust be sufficient for first periodShow shortfall, suggest top-up or lower amount
调用任何写入工具前:
验证项规则验证失败操作
投资币种必须是USDT或BTC拒绝并说明限制
金额必须在[最小, 最大]范围内查询最小/最大金额,然后拒绝并告知有效范围
执行时间必须是0-23之间的整数(整点)拒绝并说明仅支持整点的限制
plan_period_day
(创建时)
不能为
0
;根据
plan_period_type
在对应范围内(详见创建计划约束)
拒绝并告知允许范围;详见
references/autoinvest-plans.md
工作流步骤6
余额首期投资资金必须充足显示资金缺口,建议充值或降低投资金额

No Speculation on Next Purchase Time

不得预测下一次购买时间

  • Do not calculate or display the next automatic purchase time
  • If user asks, direct them to Gate App or website for real-time schedule
  • The system does not provide this information via API
  • 不得计算或展示下一次自动购买时间
  • 如果用户询问,引导其访问Gate应用或官网获取实时时间表
  • 系统不通过API提供此信息

Error Handling

错误处理

Error ConditionDetectionResponse
Too many target coinsUser specifies > 10 target coinsReject immediately: "A plan can have at most 10 target coins. You specified {N} coins. Please reduce the number of targets."
Coin allocation too smallAny target coin has ratio < 10Reject immediately: "Each target coin must have at least 10% allocation. Coin {X} has only {Y}%. Please adjust the ratios to ensure each coin has at least 10%."
Insufficient balance
gate-cli cex spot account get
shows balance < amount
Do not proceed. Inform user of shortfall: "Your current balance is {X} {currency}, but {Y} {currency} is required. Please deposit more funds or reduce the investment amount."
Invalid investment currencyUser specifies currency other than USDT/BTCReject immediately: "Only USDT or BTC are supported as investment currency. Please choose USDT or BTC."
Amount below minimumUser amount <
gate-cli cex earn auto-invest min-amount
Call min amount tool, then inform: "Minimum amount is {min} {currency}. Please increase your investment amount."
Amount above maximumUser amount >
gate-cli cex earn auto-invest config
max
Call config tool, then inform: "Maximum amount is {max} {currency}. Please reduce your investment amount."
Invalid execution timeUser specifies minutes/seconds or hour outside 0-23Reject: "Auto-invest only supports execution on the hour (0-23). Please choose an hour between 0 and 23."
Invalid
plan_period_day
0
or out of range for
plan_period_type
on create
Do not call create; state valid ranges: monthly 1–30; weekly/biweekly 1–7 (1 = Monday); daily/hourly/4-hourly use
1
(
references/autoinvest-plans.md
Workflow step 6)
Plan not foundQuery returns no matching planInform: "No matching auto-invest plan found. You can create a new plan." (See Scenario 4)
MCP tool missingRequired tool not available in MCP serviceExplain: "Auto-invest feature requires updated MCP service. Please ensure gate-mcp is properly configured."
API error (401/403)Authentication failureGuide: "Authentication error. Please check your API key permissions include Earn (auto-invest) access." See
exchange-runtime-rules.md
for auth handling.
API error (4xx/5xx)Other API errorsReport error message and suggest retry or contact support
Missing required parameterTool schema requires param with no defaultDo not guess. Ask user: "Please specify {parameter_name} (e.g., {example})."
错误情况检测方式响应
目标币种过多用户指定超过10个目标币种立即拒绝:"一个计划最多包含10个目标币种。你指定了{N}个币种,请减少目标币种数量。"
币种分配比例过小任何目标币种的比例<10立即拒绝:"每个目标币种的分配比例至少为10%。币种{X}的比例仅为{Y}%,请调整比例确保每个币种至少为10%。"
余额不足
gate-cli cex spot account get
显示余额<所需金额
不继续操作。告知用户资金缺口:"你当前余额为{X} {币种},但需要{Y} {币种}。请充值更多资金或降低投资金额。"
无效投资币种用户指定USDT/BTC以外的币种立即拒绝:"仅支持USDT或BTC作为投资币种,请选择USDT或BTC。"
金额低于最低值用户金额<
gate-cli cex earn auto-invest min-amount
返回值
调用最低金额工具,然后告知:"最低金额为{min} {币种},请提高投资金额。"
金额高于最高值用户金额>
gate-cli cex earn auto-invest config
返回的最高值
调用配置工具,然后告知:"最高金额为{max} {币种},请降低投资金额。"
无效执行时间用户指定了分钟/秒,或小时不在0-23之间拒绝:"自动投资仅支持整点执行(0-23点),请选择0到23之间的小时数。"
无效
plan_period_day
创建时为
0
或超出对应
plan_period_type
的范围
不调用创建工具;告知有效范围:每月1–30日;每周/每两周1–7日(1=周一);每日/每小时/每4小时使用
1
(详见
references/autoinvest-plans.md
工作流步骤6)
未找到计划查询未返回匹配计划告知:"未找到匹配的自动投资计划,你可以创建一个新计划。"(详见场景4)
MCP工具缺失MCP服务中无所需工具说明:"自动投资功能需要更新的MCP服务,请确保gate-mcp已正确配置。"
API错误(401/403)身份验证失败引导:"身份验证错误,请检查你的API密钥是否具备Earn(自动投资)访问权限。"详见
exchange-runtime-rules.md
的身份验证处理。
API错误(4xx/5xx)其他API错误报告错误信息并建议重试或联系支持人员
缺少必填参数工具架构要求参数但无默认值不得猜测。询问用户:"请指定{parameter_name}(例如:{example})。"

Parameter Hygiene

参数规范

  • If a tool parameter is required and the schema provides no default, prompt the user for the value
  • Never guess or invent parameter values
  • Always validate parameters against Business Rules before calling tools
  • 如果工具参数为必填且架构未提供默认值提示用户提供值
  • 切勿猜测或编造参数值
  • 始终在调用工具前根据业务规则验证参数

Judgment Logic Summary

判断逻辑总结

ConditionActionTool(s) to Use
User wants to create planRoute to
references/autoinvest-plans.md
Scenario 1/2
Validate (incl.
plan_period_day
) →
gate-cli cex spot account get
(and
gate-cli cex earn uni lends
if earn fund source) →
gate-cli cex earn auto-invest min-amount
gate-cli cex earn auto-invest config
→ Confirm →
gate-cli cex earn auto-invest create
User wants to update planRoute to
references/autoinvest-plans.md
gate-cli cex earn auto-invest plans
(if no ID) → Confirm →
gate-cli cex earn auto-invest update
User wants to stop planRoute to
references/autoinvest-plans.md
Scenario 9
gate-cli cex earn auto-invest plans
(if no ID) → Action Draft (end turn) → user's next message confirms →
gate-cli cex earn auto-invest stop
User wants to top-up (add position)Route to
references/autoinvest-plans.md
Scenario 10
gate-cli cex earn auto-invest plans
(if no ID) →
gate-cli cex earn auto-invest plan-detail
(if no amount) →
gate-cli cex spot account get
→ Confirm →
gate-cli cex earn auto-invest add-position
(ONCE ONLY)
User wants to list plansDirect query
gate-cli cex earn auto-invest plans
User wants plan detailDirect query
gate-cli cex earn auto-invest plan-detail
User asks "which coins?"Scenario 1
gate-cli cex earn auto-invest coins
User asks "minimum amount?"Scenario 2
gate-cli cex earn auto-invest min-amount
User asks "execution history?"Scenario 3
gate-cli cex earn auto-invest records
User asks "order details?"Direct query
gate-cli cex earn auto-invest orders
User asks about investment currency restrictionsRoute to
references/autoinvest-compliance.md
Explain USDT/BTC only rule
User asks about fund sourceRoute to
references/autoinvest-compliance.md
Explain spot vs earn options
Plan not found in queryScenario 4Inform user, offer to create new plan
Insufficient balanceError HandlingShow shortfall, do not proceed
Invalid parametersError HandlingValidate against Business Rules, reject with explanation
条件操作使用工具
用户想要创建计划路由至
references/autoinvest-plans.md
场景1/2
验证(含
plan_period_day
)→
gate-cli cex spot account get
(若资金来源为Earn则调用
gate-cli cex earn uni lends
)→
gate-cli cex earn auto-invest min-amount
gate-cli cex earn auto-invest config
→ 确认 →
gate-cli cex earn auto-invest create
用户想要更新计划路由至
references/autoinvest-plans.md
gate-cli cex earn auto-invest plans
(若无ID)→ 确认 →
gate-cli cex earn auto-invest update
用户想要停止计划路由至
references/autoinvest-plans.md
场景9
gate-cli cex earn auto-invest plans
(若无ID)→ 操作草案(结束回复)→ 用户下一条消息确认 →
gate-cli cex earn auto-invest stop
用户想要追加投资路由至
references/autoinvest-plans.md
场景10
gate-cli cex earn auto-invest plans
(若无ID)→
gate-cli cex earn auto-invest plan-detail
(若无金额)→
gate-cli cex spot account get
→ 确认 →
gate-cli cex earn auto-invest add-position
(仅调用一次)
用户想要列出计划直接查询
gate-cli cex earn auto-invest plans
用户想要查看计划详情直接查询
gate-cli cex earn auto-invest plan-detail
用户询问“哪些币种?”场景1
gate-cli cex earn auto-invest coins
用户询问“最低金额?”场景2
gate-cli cex earn auto-invest min-amount
用户询问“执行历史?”场景3
gate-cli cex earn auto-invest records
用户询问“订单详情?”直接查询
gate-cli cex earn auto-invest orders
用户询问投资币种限制路由至
references/autoinvest-compliance.md
说明仅支持USDT/BTC的规则
用户询问资金来源路由至
references/autoinvest-compliance.md
说明现货与Earn选项
查询未找到计划场景4告知用户,提供创建新计划的选项
余额不足错误处理显示资金缺口,不继续操作
参数无效错误处理根据业务规则验证,拒绝并说明原因

Report Template

报告模板

Plan Creation Success

计划创建成功

markdown
✅ Auto-invest plan created

- Invest currency: {USDT|BTC}
- Amount per period: {amount}
- Cadence: {cadence description}
- Target(s): {target coin(s) with ratios if multi-target}
- Fund source: {spot|earn}
- Fund flow: {auto_invest|earn} (spot account|Simple Earn)
markdown
✅ 自动投资计划已创建

- 投资币种:{USDT|BTC}
- 每期金额:{amount}
- 周期:{周期描述}
- 目标:{目标币种(多目标时含比例)}
- 资金来源:{spot|earn}
- 资金流向:{auto_invest|earn}(现货账户|Simple Earn)

Plan Update Success

计划更新成功

markdown
✅ Auto-invest plan updated

- Plan: {id or name}
- Updated: {changed fields and new values}
markdown
✅ 自动投资计划已更新

- 计划:{ID或名称}
- 更新内容:{修改字段及新值}

Plan Stop Success

计划停止成功

markdown
✅ Auto-invest plan stopped

- Plan: {id or name}
- Status: Automatic deductions ceased
- Note: Purchased assets remain in {account type}
markdown
✅ 自动投资计划已停止

- 计划:{ID或名称}
- 状态:自动扣款已终止
- 说明:已购买资产保留在{账户类型}

Top-up Success

追加投资成功

markdown
✅ Top-up executed

- Plan: {id or name}
- Amount: {amount} {invest_currency}
- Target allocation: {per Business Rules}
markdown
✅ 追加投资已执行

- 计划:{ID或名称}
- 金额:{amount} {投资币种}
- 目标分配:{符合业务规则的分配方式}

Query Response (Plans List)

查询响应(计划列表)

markdown
📋 Your Auto-Invest Plans

{For each plan:}
**Plan {N}: {plan_name}**
- Investment: {amount} {currency} per {cadence}
- Target(s): {coin(s)}
- Execution count: {period} times
- Status: Active

{If no plans:}
You have no active auto-invest plans. Create one to start DCA investing.
markdown
📋 你的自动投资计划

{每个计划:}
**计划{N}:{计划名称}**
- 投资:{amount} {币种} 每{周期}
- 目标:{币种}
- 执行次数:{次数}
- 状态:活跃

{若无计划:}
你当前没有活跃的自动投资计划。创建一个计划开始DCA投资吧。

Query Response (Supported Coins)

查询响应(支持的币种)

markdown
📋 Supported Auto-Invest Coins

{List coins returned by `gate-cli cex earn auto-invest coins`}

You can use any of these coins as targets in your auto-invest plan.
markdown
📋 支持的自动投资币种

{列出`gate-cli cex earn auto-invest coins`返回的币种}

你可以选择这些币种作为自动投资计划的目标。

Query Response (Minimum Amount)

查询响应(最低金额)

markdown
📋 Minimum Investment Amount

- Investment currency: {USDT|BTC}
- Target(s): {coin(s)}
- Minimum per period: {min_amount} {currency}
markdown
📋 最低投资金额

- 投资币种:{USDT|BTC}
- 目标:{币种}
- 每期最低金额:{min_amount} {币种}

Error Response

错误响应

markdown
❌ {Error type}

{Explanation of what went wrong}

{Actionable suggestion to resolve}
markdown
❌ {错误类型}

{错误原因说明}

{可操作的解决建议}

Reference Documentation

参考文档

DocumentContent
references/scenarios.md
Comprehensive scenario index covering all 16 scenarios (plan lifecycle, queries, compliance)
references/autoinvest-plans.md
Plan lifecycle operations and scenarios (create, update, stop, top-up)
references/autoinvest-compliance.md
Compliance rules and restrictions (investment currency, region, funding)
文档内容
references/scenarios.md
包含所有16个场景的综合场景索引(计划生命周期、查询、合规)
references/autoinvest-plans.md
计划生命周期操作及场景(创建、更新、停止、追加投资)
references/autoinvest-compliance.md
合规规则及限制(投资币种、区域、资金)