Claude
Skills
Sign in
Back

gate-exchange-assetswap

Included with Lifetime
$97 forever

Use this skill whenever the user wants Gate Exchange asset allocation optimization for spot holdings (list eligible assets, load config, evaluate/preview, place orders, query history). Trigger phrases include "asset allocation optimization", "allocation configuration", "portfolio allocation", "rebalance spot to stablecoin", "Top 5 market cap allocation", "optimize holdings to BTC", "preview allocation optimization", "allocation optimization order list".

General

What this skill does


### 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`](https://github.com/gate/gate-skills/blob/master/skills/exchange-runtime-rules.md) §4 (or [`gate-runtime-rules.md`](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md) §4).


# Gate Exchange Asset Allocation Optimization

## 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](https://github.com/gate/gate-skills/blob/master/skills/gate-runtime-rules.md)
- **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.

## Skill Dependencies


### gate-cli commands used

**Query operations (read-only, profile scope)**

- `gate-cli cex assetswap assets`
- `gate-cli cex assetswap config`
- `gate-cli cex assetswap evaluate`
- `gate-cli cex assetswap order list`
- `gate-cli cex assetswap order get`

**Execution operations (write, trade scope)**

- `gate-cli cex assetswap order preview`
- `gate-cli cex assetswap order create`

### 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](https://github.com/gate/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.
- API Key required: Yes
- **Permissions:** Profile (read) for listing, config, evaluation, and order queries; Trade for preview and order creation
- **Portal:** create or rotate keys outside the chat: https://www.gate.com/myaccount/profile/api-key/manage

### Installation Check

- **Required:** Gate (main) MCP with asset allocation optimization tools enabled (MCP names `cex_assetswap_*`); prefer **`gate-cli cex assetswap …`** when running from the host CLI.
- **Install (MCP / IDE):** `gate-mcp-cursor-installer`, `gate-mcp-codex-installer`, `gate-mcp-claude-installer`, or `gate-mcp-openclaw-installer`.
- **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:** Before preview or order creation, confirm the runtime works (e.g. **`gate-cli --version`** or deployment-specific checks).

---

## Trigger Conditions

Activate this skill when the user wants any of the following:

- Multi-asset spot **portfolio optimization** or **rebalancing** into a **strategy** (conservative stablecoin, conviction single asset, or market-cap-weighted basket)
- To see which spot balances are **eligible** for asset allocation optimization
- **Preview** estimated execution, slippage, or risk hints before committing
- **Submit** an asset allocation optimization order after confirmation
- **Query** historical allocation optimization orders or **one order’s** status and child orders

Do **not** use this skill for: transfers between accounts or products, Launchpool or earn subscriptions, single manual spot limit/market orders without the allocation product, or dust handling below product thresholds (route to the appropriate transfer, earn, spot, or small-balance product skill instead).

---

## Data privacy and collection

- **AI interaction information**: User prompts, follow-up instructions, and tool arguments used while following this skill qualify as AI interaction data under the [Gate Privacy Policy](https://www.gate.com/legal/privacy-policy) (see §4.2.7). Do not ask for or repeat API keys, secrets, or unrelated personal data in user-visible output.
- **Data flow**: Account and trading data for this skill flow **only** through the configured **Gate (main) MCP** to **Gate Exchange APIs** via the asset-swap tools above (MCP `cex_assetswap_*` or equivalent `gate-cli cex assetswap …` calls). Do not relay the same data to undocumented third-party services, scrapers, or custom backends as part of this workflow.
- **Minimization**: Pass only parameters required by each documented MCP call (symbols, amounts, strategy fields, pagination). Do not send full chat transcripts or unrelated context fields into tool payloads.

---

## Domain Knowledge

**Product**: Asset Allocation Optimization exposes Exchange capability for restructuring multiple spot holdings into a target mix. One optimization may map to multiple internal execution legs at the order layer.

**Strategy types** (conceptual; exact enums and parameters come from `gate-cli cex assetswap config`):

| Strategy | Typical targets | Meaning |
|----------|------------------|---------|
| Conservative | USDT, GUSD, USDC (examples) | Consolidate into a single stablecoin; risk-off / idle cash posture |
| Conviction ("faith") | BTC, ETH, GT (examples) | Reallocate selected spot toward target weights in the chosen asset(s); intermediate steps follow the product and API |
| Market cap | Top 2, Top 5 (examples) | Index-like exposure weighted by market cap into a basket such as BTC, ETH, SOL, BNB, XRP (actual list from API) |

**Listing rules** (for agent interpretation; product may filter server-side):

- Default presentation may exclude major reserve assets (e.g. BTC, ETH, USDT, USDC) unless the user explicitly asks to include them in the sell set.
- Only **spot available** balances participate; locked balances from earn, borrow, staking, or similar are out of scope.
- Very small balances (e.g. below roughly USD 10 equivalent) may be hidden or routed to small-balance handling; exact thresholds follow API or product rules.

**Out of scope for public skill documentation** (do not document as standard Exchange MCP capabilities):

- Banner or UI-only feature flags
- Non-standard semantic "validate and fill parameters" helpers not published as Exchange MCP

**Rate limiting**: Align with wallet or Exchange API limits when documented (example: 200 requests per 10 seconds per user or key); confirm in published API docs.

**Preview → create payload (mandatory for agents)**:

- After a successful `gate-cli cex assetswap order preview`, construct the `gate-cli cex assetswap order create` body from the preview response **`data.order`** only: for each object in **`data.order.from`** and **`data.order.to`**, emit `{ "asset": <value>, "amount": <value> }` using the preview’s **`asset`** and **`amount`** string fields (use **`amount`**, not **`amount_show`**, unless published API docs say otherwise).
- Preserve the **array order** of `to` (and `from` if multiple legs) exactly as returned in `data.order`; do not reorder symbols for convenience.
- A preview request may use **`ratio`** on `to`; the **create** call must still use the **resolved `asset` + `amount`** legs from the preview output. Creating with ratio-only `to` while omitting preview amounts often yields quote errors (for example `code: 4`).
- If the API returns additional preview-bound fields (for example top-level `usdt_evaluated_value` or `transaction_fee` inside `data`), mirror them on create **when the MCP or Exchange docs require it**; otherwise the `from` / `to` legs from preview are the primary contract.

**Main chain (mandatory o
Files: 5
Size: 34.6 KB
Complexity: 55/100
Category: General

Related in General