gate-gate-skills

gate-exchange-bot

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

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.

Authoring Language

This skill is authored in English. End-user replies should still follow normal language adaptation.

Skill Dependencies

gate-cli commands used

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

MCP-backed command mapping

gate-cli commandBacking bot capability
gate-cli cex bot strategy recommendcex_bot_get_ai_hub_strategy_recommend
gate-cli cex bot portfolio runningcex_bot_get_ai_hub_portfolio_running
gate-cli cex bot portfolio detailcex_bot_get_ai_hub_portfolio_detail
gate-cli cex bot spot-grid createcex_bot_post_ai_hub_spot_grid_create
gate-cli cex bot margin-grid createcex_bot_post_ai_hub_margin_grid_create
gate-cli cex bot infinite-grid createcex_bot_post_ai_hub_infinite_grid_create
gate-cli cex bot futures-grid createcex_bot_post_ai_hub_futures_grid_create
gate-cli cex bot spot-martingale createcex_bot_post_ai_hub_spot_martingale_create
gate-cli cex bot contract-martingale createcex_bot_post_ai_hub_contract_martingale_create
gate-cli cex bot portfolio stopcex_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

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.

Resolving gate-cli (binary path)

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

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.

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.

Module Overview

ModuleDescriptionTrigger keywords
DiscoverRecommend AIHub bot strategies by market, strategy type, filter, or refresh contextrecommend strategy, bundle, top1, refresh recommendation, filter strategy
Spot GridManual spot grid creationspot grid, manual grid
Margin GridManual margin grid creationmargin grid
Infinite GridManual infinite grid creationinfinite grid
Futures GridManual futures grid creationfutures grid, contract grid
Spot MartingaleManual spot martingale creationspot martingale
Contract MartingaleManual contract martingale creationcontract martingale, futures martingale
Portfolio ListList running strategiesrunning strategies, bots I have running, portfolio running
Portfolio DetailQuery a single strategy detailstrategy detail, bot detail, P&L detail
Portfolio StopStop one running strategystop 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

gate-cli Command Index

#CommandPurpose
1gate-cli cex bot strategy recommendDiscover recommendations for top1, bundle, filter, or refresh scenes
2gate-cli cex bot spot-grid createCreate a manual spot grid
3gate-cli cex bot margin-grid createCreate a manual margin grid
4gate-cli cex bot infinite-grid createCreate a manual infinite grid
5gate-cli cex bot futures-grid createCreate a manual futures grid
6gate-cli cex bot spot-martingale createCreate a manual spot martingale
7gate-cli cex bot contract-martingale createCreate a manual contract martingale
8gate-cli cex bot portfolio runningList running strategies
9gate-cli cex bot portfolio detailQuery a single strategy detail
10gate-cli cex bot portfolio stopStop one strategy

Execution Workflow

1. Intent classification

  • 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

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

3. Scenario coverage

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

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.

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.

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.

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.