gate-gate-skills

gate-exchange-earn

stars39
forks19
watches39
updated2026-09-03 02:38:25

Gate Smart Earn Assistant

General Rules

本 L2 Skill 遵循公共运行时规则文件:

gate-runtime-rules.md(Gate Skills 通用运行时规则:CLI / 凭证检查、授权验证、版本检查)

gate-skills-disambiguation.md(L1/L2 Skill 路由消歧规则)

⚠️ STOP — You MUST read and strictly follow both documents above before proceeding. Do NOT select or call any tool until all rules are read. These rules have the highest priority.

  • 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.

Regulatory and safety notices

  • This skill is intended for users aged 18 or above with full civil capacity.
  • Digital asset products involve significant risk and may result in partial or total loss. Yields are indicative, not guaranteed.
  • The above is for informational purposes only and does not constitute investment, financial, tax, or legal advice. AI-assisted outputs are for general information only and do not constitute any representation, warranty, or guarantee by Gate.
  • Users must comply with the laws and regulations of their jurisdiction. Gate operates under licenses in multiple jurisdictions; see https://www.gate.com/gategroup/legal/licenses for the Gate licenses page.
  • This skill processes user prompts and queries; operational data is sent to the Gate API through gate-cli on the user-controlled host. Do not paste API secrets into chat.

Skill Dependencies

  • Before any gate-cli invocation: ensure gate-cli is installed. Let GATE_CLI_BIN="${GATE_OPENCLAW_SKILLS_BIN:-$HOME/.openclaw/skills/bin}/gate-cli". If [ ! -x "$GATE_CLI_BIN" ] (and command -v gate-cli also fails if you rely on PATH), run setup.sh (e.g. sh ./setup.sh from this skill directory), then re-check. Do not continue with authenticated earn reads or writes until gate-cli runs successfully (e.g. gate-cli --version).
  • No MCP servers are required; execution is gate-cli only for the commands listed below and in references/gate-cli.md.

gate-cli commands used

Query operations (read-only)

  • gate-cli cex earn uni rate
  • gate-cli cex earn uni currency
  • gate-cli cex earn uni records
  • gate-cli cex earn uni interest
  • gate-cli cex earn uni interest-records
  • gate-cli cex earn fixed products
  • gate-cli cex earn fixed products-asset
  • gate-cli cex earn fixed lends
  • gate-cli cex earn dual plans
  • gate-cli cex earn dual orders
  • gate-cli cex earn dual balance
  • gate-cli cex earn staking find
  • gate-cli cex earn staking assets
  • gate-cli cex earn staking awards
  • gate-cli cex earn staking orders
  • gate-cli cex spot account list
  • gate-cli cex spot account get
  • gate-cli info compliance check-token-security

Execution operations (write; Action Draft + explicit Y required)

  • gate-cli cex earn uni lend (with --json for lend/redeem semantics per CLI help)
  • gate-cli cex earn uni change (with --json, e.g. auto renew)
  • gate-cli cex earn fixed create (with --json)
  • gate-cli cex earn dual place
  • gate-cli cex earn staking swap

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 (see gate-cli).
  • Env / flags: when both GATE_API_KEY and GATE_API_SECRET are set, or --api-key / --api-secret where supported, never ask the user to paste secrets into chat.
  • Permissions: use an API key with scopes appropriate to earn and spot balance checks (e.g. earn read/write and spot read for pre-trade balance validation). Create a dedicated, least-privilege key when possible.
  • Portal: manage keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage

Installation check

  • Required: gate-cli (install via setup.sh when missing, per Skill Dependencies).
  • GateClaw / OpenClaw: setup.sh installs to $HOME/.openclaw/skills/bin/gate-cli by default; add that directory to PATH if agents invoke gate-cli by name.
  • Sanity check: confirm a lightweight read succeeds where applicable before writes (for example earn product listing commands after credentials resolve).

Execution mode

Read and strictly follow references/gate-cli.md, then execute this skill's routing and case logic.

  • SKILL.md holds intent routing, signal model, and the case map.
  • references/gate-cli.md is the authoritative execution contract for gate-cli usage, pre-checks, confirmation gates, and degraded handling.

Domain knowledge

Logical capability groups (L1 alignment)

Logical moduleRole in this L2 skill
Simple Earn (flexible/fixed)Product discovery, rates, positions, subscribe/redeem
Dual-currency (dual)Plans, orders, balances, placement
StakingDiscover products, positions, rewards, participate
Spot account (subset)Available balance checks before subscribe flows
Token security (info)Optional risk signal when comparing products for a coin

Four-dimensional intent signals (non-exclusive)

SignalDimensionTypical triggersCLI subset (union with others)
S1Earn productsearn, Simple Earn, dual, staking, fixed, flexiblecex earn product/discovery commands
S2Yield, risk, compareAPY, APR, risk, which is better, compare; product-side 收益 (what products or markets pay—rates, tiers, “这个产品收益怎么样”)dual plans, staking find, check-token-security
S3Positions and PnLmy earn, how much earned, positions, history; 持仓 收益 (accrued interest/rewards on my holdings, earn PnL and history)uni records, dual orders, fixed lends, staking orders, staking assets
S4Subscribe, redeem, configuresubscribe, redeem, join, auto renew, participatebalance reads then uni lend, fixed create, dual place, staking swap, uni change

收益 keyword: When the query contains 收益 (or close synonyms such as 收益率 in a yield sense), split S2 vs S3 before activating both:

  • 产品收益 (product yield): asks what a product or listing pays or how yields compare—APY/APR, annualized rate, which option is higher. → Activate S2 only for this angle; do not activate S3 solely from this cue.
  • 持仓收益 (position / holdings yield): asks how much the user has earned on existing positions—accumulated interest, rewards received, “我赚了多少”, bucketed PnL. → Activate S3 only for this angle; do not activate S2 solely from this cue.

Other signals (e.g. S1, S4) still activate from their own cues independently.

Defaulting: broad earn browse with little specificity activates S1+S2. Vague “how much did I earn” style queries bias toward S3. If 收益 is present but product vs 持仓 is ambiguous, prefer one short clarifying question; if a default is required, bias toward S3 when the wording implies my holdings (e.g. 我 / 我的 / 累计 / 持仓) and toward S2 when it implies catalog or quoted rates (e.g. 哪个 / 年化 / 产品对比).

Execution mode: S1/S2/S3 without S4 is research-only (fetch and summarize). If S4 is active, use research plus Action Draft, then execute writes only after explicit Y in the immediately previous user turn.

Out of scope (route elsewhere)

  • Spot/perpetual/options trading execution (buy/sell on the book) → trading copilot / gate-exchange-spot or futures skills.
  • New-listing research, listing alerts → dedicated listing/research skills.
  • Broad market or single-coin non-earn research → market research / info research skills.
  • Full account risk (liquidation, margin) unrelated to earn positions → account or unified-account skills.

Presentation rules

  • When the user asks for separate earn buckets (for example flexible interest vs staking rewards), present sections per product; do not merge into a single “total profit” line unless they explicitly ask for a total.
  • For that style of query (including 「余币宝利息 / 质押奖励分别赚了多少」), default analysis/export window is the trailing ~three months: use now − 90 days through now for --from / --to (Unix ms per CLI) on time-filterable reads (e.g. uni interest-records, uni records). Say the window in the reply. Use full-history cumulative APIs or unpaginated totals only if the user asks for lifetime / 全部 / 累计历史等.
  • For dual and similar products, present APY in human-readable percent form when the API returns a fraction (for example multiply by 100 for display when that matches CLI output semantics); state assumptions if ambiguous.
  • Do not promise fixed returns; label estimates and floating yield clearly.

Workflow

When the user asks for any earn-related operation, follow this sequence.

Step 1: Route intent (earn vs non-earn)

If the request is clearly not about earn, staking, dual, flexible/fixed savings, or idle-fund earn allocation, route to the appropriate non-earn skill instead of forcing earn CLI.

Step 2: Extract parameters and activate signals

Extract where possible: product_type (simple / dual / staking), currency, amount, term or days, risk_preference, and whether the user wants a write (S4). If the query contains 收益, apply the 产品收益 → S2 only / 持仓收益 → S3 only split before merging signal CLI sets.

Step 3: Build the CLI set

  • Union CLI from each activated signal (see Domain knowledge).
  • Deduplicate identical command lines with identical arguments.
  • Run independent reads in parallel when safe; serialize writes to one confirmed action at a time.

Step 4: Preflight reads and synthesis

  • For writes (S4), always check available balance with gate-cli cex spot account list or gate-cli cex spot account get as appropriate before drafting.
  • Follow references/gate-cli.md §2.1 (--help before required flags) for every leaf command.

Step 5: Action Draft and confirmation for any write (mandatory)

Before gate-cli cex earn uni lend, gate-cli cex earn uni change, gate-cli cex earn fixed create, gate-cli cex earn dual place, or gate-cli cex earn staking swap:

  1. Present an Action Draft (product type, currency, amount, indicative APR or terms, material risks including dual exercise/settlement risk where relevant).
  2. Ask for Y to confirm or N to cancel. Treat confirmation as single-use; parameter or intent changes require a new draft.
  3. Execute the write only after Y in the immediately previous user turn.
  4. On failure, do not auto-retry writes; surface the error and suggest App/Web or corrected parameters.

Step 6: Result and verification

  • After writes, verify with the matching read commands (records, orders, lends, staking orders) when useful.
  • If a read fails, degrade gracefully: state which dimension is unavailable; never fabricate balances or APY.

Case routing map (1–15)

CaseUser intentCore decisionTool sequence (abbrev.)
1Idle capital, low risk, best earn mixRank conservative products across typesParallel: fixed products, fixed products-asset, uni rate, uni currency, dual plans → synthesized report
2Compare dual vs staking for a coinCompare APR, lock/exercise narrative, optional check-token-securitydual plans + staking find + optional check-token-security
3Portfolio review and better productsPositions then market scanuni records, dual orders, fixed lends, staking orders → recommendations; writes only after draft + Y
4Staking detail and participateExplain terms then optional staking swapstaking find + spot balance read → draft → staking swap after Y
5Auto renew / roll strategyIdentify renewable rows then uni change if user confirmsPosition reads → draft → uni change --json after Y
6Flexible rate and min rateQuote flexible parametersuni rate, uni currency
7Fixed products for asset sorted by yieldList and sort fixed offersfixed products-asset
8Staking discovery high yieldList and sort stakingstaking find
9Dual plans filter (e.g. sell-high BTC)Filter plans by currency and product typedual plans
10Cross-type APR comparisonSide-by-side table with footnotes on methodologyuni rate, uni currency, fixed products-asset, staking find
11Separate PnL by earn typeNo cross-section totals unless asked; default window ~last 3 months (--from/--to ≈ 90d); lifetime only on explicit askSum/fetch per bucket: uni interest-records (+ uni records if needed) with time filter for flexible; staking awards (paginate; filter by row timestamps if CLI has no --from/--to); staking assets for position snapshot; uni interest only for lifetime per-currency totals when user asks
12Subscribe flexible (e.g. USDT)Balance + rules then lendspot balance + uni currency → draft → uni lend --json after Y
13Subscribe fixed termPick tenor from productsfixed products-asset + spot balance → draft → fixed create --json after Y
14Redeem flexible sliceCheck redeemable then redeemuni records → draft → uni lend --json redeem after Y
15Dual settled historyFilter settled dual orders and summarize by currencydual orders, dual balance

Judgment Logic Summary

ConditionAction
Query contains 收益Classify 产品收益S2 only (that angle); 持仓收益S3 only (that angle); never activate both S2 and S3 solely from the same undifferentiated 收益 mention
User asks for earn yields, products, or comparisons without subscribe/redeemS1/S2/S3 only; read documented gate-cli commands; no writes
User asks to subscribe, redeem, join staking, place dual, or change auto renewActivate S4; complete reads then Action Draft; no write without Y
User mixes trading (“market buy BTC”) with earnRoute trading to spot/trading skills; handle earn portions only if clearly separable
check-token-security returns empty or errorsSkip or label “risk data unavailable”; do not block read-only browsing solely for that
User wants bucketed earn PnLUse Case 11 pattern; separate sections; default data scope = ~last 90 days unless user asks for all-time
Stale or ambiguous confirmationRe-issue Action Draft; do not execute writes
Multi-step writes (e.g. redeem then subscribe)Require separate confirmation per write leg

Report template

## Earn Result

| Item | Value |
|------|-------|
| Scenario | {case_name} |
| Product | {product_type} |
| Currency | {currency} |
| Status | {status} |
| Key metrics | {apr_or_amounts} |

{decision_text}

Example decision_text:

  • Action Draft: Flexible USDT earn, amount 2000 USDT, indicative APR {x}%, risks: floating yield. Reply Y to confirm or N to cancel.
  • Read-only summary: top fixed USDT terms sorted by APR (see table). No subscription executed.
  • Not executed: available balance below requested amount.

Error handling

Error typeTypical causeHandling strategy
Insufficient balanceNot enough spot available for subscriptionShow shortfall; suggest lower amount or funding
Product unavailableTenor sold out or currency unsupportedExplain; refresh product list
Auth or permission failureKey missing earn or spot read scopeStop writes; guide credential and scope fix
Missing confirmationUser did not send YKeep draft pending; reads only
Stale confirmationParameters changed since YInvalidate; re-draft
CLI partial failureOne parallel read failsContinue other dimensions; label gaps
Write failureExchange rejects orderNo auto-retry; show message; suggest App/Web

Safety rules

  • Never call earn write commands without a prior Action Draft and explicit Y in the immediately previous user turn.
  • Dual-currency products carry exercise/settlement risk; state that plainly before any dual place confirmation.
  • Do not guarantee returns or imply zero risk.
  • Invalidate confirmation after any material change to amount, currency, product, or side.
  • Prefer --format json for machine parsing when the host workflow requires it (optional per operator policy).

Cross-skill workflows

  • Fund spot then earn: user may need spot transfer or deposit skills first if spot balance is insufficient (this skill only checks and reports).
  • Trading after redeem: after successful redeem to spot, trading skills may apply; do not conflate order placement with earn writes.