Skill: gate-exchange/gate-exchange-tradfi (version 1.0.2)

--- name: gate-exchange-tradfi version: "2026.3.23-1" updated: "2026-03-23" description: "Gate TradFi (traditional finance) skill. Use when the user asks to query or trade traditional finance assets like forex or commodities on Gate. Triggers on 'TradFi orders', 'MT5 account', 'TradFi positions'. Do NOT use for fund transfer." --- # Gate TradFi Suite ## 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 call MCP tools explicitly listed in this skill.** Tools not documented here must NOT be called, even if they exist in the MCP server. --- ## MCP Dependencies ### Required MCP Servers | MCP Server | Status | |------------|--------| | Gate (main) | ✅ Required | ### MCP Tools Used **Query Operations (Read-only)** - cex_tradfi_query_categories - cex_tradfi_query_mt5_account_info - cex_tradfi_query_order_history_list - cex_tradfi_query_order_list - cex_tradfi_query_position_history_list - cex_tradfi_query_position_list - cex_tradfi_query_symbol_detail - cex_tradfi_query_symbol_kline - cex_tradfi_query_symbol_ticker - cex_tradfi_query_symbols - cex_tradfi_query_user_assets **Execution Operations (Write)** - cex_tradfi_close_position - cex_tradfi_create_tradfi_order - cex_tradfi_delete_order - cex_tradfi_update_order - cex_tradfi_update_position ### Authentication - API Key Required: Yes (see skill doc/runtime MCP deployment) - Permissions: Tradfi:Write - Get API Key: https://www.gate.io/myaccount/profile/api-key/manage ### Installation Check - Required: Gate (main) - Install: Run installer skill for your IDE - Cursor: `gate-mcp-cursor-installer` - Codex: `gate-mcp-codex-installer` - Claude: `gate-mcp-claude-installer` - OpenClaw: `gate-mcp-openclaw-installer` ## MCP Mode **Read and strictly follow** [`references/mcp.md`](./references/mcp.md), then execute this skill's TradFi workflow. - `SKILL.md` keeps routing and domain constraints. - `references/mcp.md` is the authoritative MCP execution layer for query/mutation separation, confirmation gates, and post-action verification. ## Sub-Modules | Module | Description | Trigger keywords | | ------------------- | ------------------------------------------------ | ---------------------------------------------------------------------------------------------- | | **Query orders** | Order list, order history | `orders`, `open orders`, `order history` | | **Query positions** | Current position list, position history | `positions`, `my positions`, `position history`, `holdings`, `current position` | | **Query market** | Category list, symbol list, ticker, symbol kline | `category`, `categories`, `symbol list`, `symbols`, `ticker`, `kline`, `candlestick`, `market` | | **Query assets** | User balance/asset info, MT5 account info | `assets`, `balance`, `account`, `my funds`, `MT5`, `mt5 account` | | **Place order** | Create new order (supports take-profit/stop-loss at creation) | `place order`, `create order`, `open order`, `buy`, `sell`, `long`, `short`, `take-profit`, `stop-loss` | | **Amend order** | Change order price, take-profit, or stop-loss (size not supported) | `amend order`, `modify order`, `change price`, `take-profit`, `stop-loss` | | **Cancel order** | Cancel one or more orders | `cancel order`, `revoke order`, `cancel` | | **Modify position** | Change position take-profit/stop-loss only (leverage, margin not supported) | `modify position`, `take-profit`, `stop-loss`, `change take-profit`, `change stop-loss` | | **Close position** | Full or partial close | `close position`, `close`, `close all`, `flat` | ## Routing Rules | Intent | Example phrases | Route to | | ------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | | **Query orders** | "My TradFi orders", "order history", "show open orders", "order status" | Read `references/query-orders.md` | | **Query positions** | "My positions", "position history", "current holdings", "what am I holding" | Read `references/query-positions.md` | | **Query market** | "TradFi categories", "category list", "symbol list", "ticker", "kline for X", "market data" | Read `references/query-market.md` | | **Query assets** | "My assets", "balance", "account balance", "MT5 account", "my MT5 info" | Read `references/query-assets.md` | | **Place order** | "Place order", "buy EURUSD", "sell XAUUSD 0.1", "open long", "order with take-profit/stop-loss" | Read `references/place-order.md` | | **Amend order** | "Amend order", "change price to X", "take-profit", "stop-loss" | Read `references/amend-order.md` | | **Cancel order** | "Cancel order", "cancel all orders", "revoke order" | Read `references/cancel-order.md` | | **Modify position** | "Modify position", "take-profit", "stop-loss", "change take-profit/stop-loss" | Read `references/modify-position.md` | | **Close position** | "Close position", "close all", "close half", "flat" | Read `references/close-position.md` | | **Unclear** | "TradFi", "show me my TradFi" | **Clarify**: list query and trading modules or ask which the user wants. | ## MCP Tools **Query (read-only)** — use only MCP-documented parameters. | # | Tool | Purpose | | ---| --------------------------------------- | ------- | | 1 | `cex_tradfi_query_order_list` | List open orders. | | 2 | [REDACTED_SECRET] | Query order history list (filled/cancelled). | | 3 | `cex_tradfi_query_position_list` | List current positions. | | 4 | [REDACTED_SECRET] | List historical positions/settlements. | | 5 | `cex_tradfi_query_categories` | Query TradFi category list. | | 6 | `cex_tradfi_query_symbols` | List symbols (by category if supported). | | 7 | `cex_tradfi_query_symbol_ticker` | Get ticker(s) for symbol(s). | | 8 | `cex_tradfi_query_symbol_detail` | Get symbol config (required before place order: leverages, min_order_volume, step_order_volume). If no result, symbol may not exist — do not place order. | | 9 | `cex_tradfi_query_symbol_kline` | Get kline/candlestick for symbol. | | 10 | `cex_tradfi_query_user_assets` | Get user account/balance (assets). | | 11 | [REDACTED_SECRET] | Get MT5 account info. | **Trading (write)** — exact tool names and parameters must match the Gate TradFi MCP tool definition. Conditions and value limits (required/optional, ranges, allowed symbols) must be declared in the skill and in each reference; do not pass undocumented parameters. | # | Tool (name per MCP) | Purpose | | ---| ---------------------------------| ------- | | 12 | `cex_tradfi_create_tradfi_order` | Place new order; supports take-profit/stop-loss. Before calling: use `cex_tradfi_query_symbol_detail` to validate symbol and get min_order_volume, step_order_volume, leverages. | | 13 | `cex_tradfi_update_order` | Amend order price, take-profit, stop-loss only (size not supported). | | 14 | `cex_tradfi_delete_order` | Cancel/delete one order. Does not support batch; one order per call. | | 15 | `cex_tradfi_update_position` | Modify position take-profit/stop-loss price only (leverage, margin not supported). | | 16 | `cex_tradfi_close_position` (or MCP equivalent) | Close position (full or partial). Full close: position identifier only, do not pass size/close_volume. | ## Parameter conditions and limits - For each MCP tool, **input conditions and limits** (required/optional parameters, value ranges, allowed symbols, precision) are defined in the MCP. This skill and each reference document must **declare** those conditions and limits so the agent and user know what can be sent. - In each trading reference (`place-order.md`, `amend-order.md`, `cancel-order.md`, `modify-position.md`, `close-position.md`), include a **Parameters** section that states: required/optional params, value constraints, and any MCP-specific rules. Do not add parameters that the MCP does not document. - If the user provides a value outside allowed range or a missing required param, ask for correction before building the confirmation payload. ## User confirmation (trading only) - **Before** calling any trading MCP tool (place order, amend order, cancel order, modify position, close position): **output all parameters** that will be sent to the MCP so the user can review them. Ask the user to confirm (e.g. "Confirm: place order with symbol=X, side=Y, size=Z, price=W. Reply yes to execute."). **Do not** call the tool until the user explicitly confirms. - This applies to every write operation; query-only flows do not require confirmation. ## Response parameter explanation (trading only) - **After** the trading MCP tool returns: in the response to the user, **explain the parameters that were used** (e.g. symbol, side, size, price, order_id, or position identifier) and the outcome (e.g. order created, order amended, order cancelled, position modified, position closed). Include a short summary table or list of the sent parameters and the result (success or error code/message). This is declared in this skill so the agent always reports back what was sent and what happened. ## Execution ### 1. Intent and parameters - Determine module: Query (orders, positions, market, assets) or Trading (place, amend, cancel, modify position, close). - For each MCP tool call, use **only the parameters defined in the Gate TradFi MCP tool definition**. Do not pass parameters that are not documented in the MCP. - Extract from user message only those keys that the MCP actually supports. Respect conditions and limits declared in the skill and in the reference. ### 2. Read sub-module and call tools - Load the corresponding reference under `references/` and follow its Workflow. - **Query**: Call query tools with extracted/prompted parameters; no confirmation needed. - **Trading**: Build the parameter set per the reference and MCP; **output parameters for user confirmation**; only after user confirms, call the trading MCP tool; then **in the response, explain the parameters used and the outcome**. ### 3. Report - **Query**: Use the sub-module Report Template (tables for orders/positions/tickers, assets). - **Trading**: Use the reference Report Template; include **parameter summary** (what was sent) and **result** (success or error). ## Domain Knowledge - **TradFi**: Gate’s traditional finance product set (e.g. FX, MT5). Symbols and categories are product-specific. - **Query**: Orders, positions, market, assets — use only MCP-documented parameters. - **Trading**: Place/amend/cancel orders and modify/close positions — use only MCP-documented tools and parameters; declare conditions/limits; require user confirmation before execution; explain parameters and outcome in the response. - **Order id for cancel/amend**: The order id used by `cex_tradfi_delete_order` and `cex_tradfi_update_order` **must** come from **`cex_tradfi_query_order_list`**. Do **not** use the `id` or `log_id` returned by `cex_tradfi_create_tradfi_order` for cancel or amend. ## Error Handling | Situation | Action | | -------------------------- | ------------------------------------------------------------------------------------------------------- | | Tool not found / 4xx/5xx | Tell user the TradFi service or tool may be unavailable; suggest retry or check Gate MCP configuration. | | Empty list | Report "No open orders" / "No positions" / "No symbols" etc., and do not assume error. | | Invalid symbol / order not found | Report "Order not found" or "Symbol not found" and suggest checking symbol list. | | Auth / permission error | Do not expose credentials; ask user to check API key or MCP auth for TradFi. | | Trading error (e.g. insufficient margin, invalid price) | Show the error message; in the response, restate the parameters that were sent and suggest correction. | ## Safety Rules - **Query**: No confirmation required; display data after tool success. - **Trading**: **Always** output parameters for user confirmation before calling place/amend/cancel/modify/close; **never** execute a write operation without explicit user confirmation. After execution, **always** explain in the response the parameters that were used and the outcome. - **Sensitive data**: Do not log or store credentials or balances; display only in the current response. ## Report Template **Query** — After each query: - **Orders**: Table with columns such as symbol, side, size, price, status, time (from list response). - **Positions**: Table with position fields (e.g. symbol, side, size, entry, margin) or "No open positions." - **Market**: Category list; symbol list; ticker table (symbol, last, 24h change, volume); or symbol kline summary (interval, range, OHLC). - **Assets**: List of assets and balances; or MT5 account/server/balance/equity table; or "Unable to load" on error. **Trading** — After each place/amend/cancel/modify/close: - **Parameters used**: List or table of the parameters sent to the MCP (e.g. symbol, side, size, price, order_id). - **Result**: Success (e.g. order id, status) or error (code/message). Suggest next step if error.

path: CHANGELOG.md
content: # Changelog

All notable changes to the Gate Exchange TradFi Query skill are documented here.

Format: version with date-based suffix (`YYYY.M.DD-N`). Each release uses a sequential suffix: `YYYY.M.DD-1`, `YYYY.M.DD-2`, etc.

---

## [2026.3.13-13] - 2026-03-13

### Changed

- **Order id for cancel/amend**: Documented that the `id` and `log_id` returned by `cex_tradfi_create_tradfi_order` **must not** be used as the order id for `cex_tradfi_delete_order` or `cex_tradfi_update_order`. The cancel and amend APIs require the order id from **`cex_tradfi_query_order_list`**. Updated `references/place-order.md` (report note), `references/cancel-order.md` (order id source), `references/amend-order.md` (order id source), and SKILL.md Domain Knowledge.

---

## [2026.3.13-12] - 2026-03-13

### Changed

- **Place order (cex_tradfi_create_tradfi_order)**: Before placing an order, **must** call **`cex_tradfi_query_symbol_detail`** with the symbol. If no result or error, do not place order (symbol may not exist). From the response: validate order size **≥** `min_order_volume` and size is an **integer multiple of** `step_order_volume`; if leverage is passed, it **must** be in the `leverages` array. Leverage is optional. Updated `references/place-order.md` (symbol config validation, workflow, all scenarios) and SKILL.md (added `cex_tradfi_query_symbol_detail` to query tools; place-order tool note). Query tool numbering 8–11, trading 12–16.

---

## [2026.3.13-11] - 2026-03-13

### Changed

- **cex_tradfi_close_position**: Full close (全部平仓) does not require size or close_volume — pass position identifier only. Updated `references/close-position.md`: parameters table, conditions, workflow, Scenario 1 (full close), and response template to state that full close omits size/close_volume; partial close still passes close size/close_volume per MCP.

---

## [2026.3.13-10] - 2026-03-13

### Changed

- **cex_tradfi_create_tradfi_order**: Documented that the tool **supports setting take-profit and stop-loss price** when placing an order. Updated `references/place-order.md`: intro, parameters table, pre-execution confirmation, workflow, report template, and added Scenario 3 (place order with take-profit/stop-loss). Updated SKILL.md Sub-Modules and MCP Tools table.

---

## [2026.3.13-9] - 2026-03-13

### Changed

- **cex_tradfi_update_position**: Documented that the tool supports **take-profit price** and **stop-loss price** only; **leverage, margin mode, and other fields are not supported**. Updated `references/modify-position.md`: parameters table, workflow, and scenarios now only cover take-profit/stop-loss; removed leverage and margin-mode scenarios; added Scenario 3 for both take-profit and stop-loss. If user asks to change leverage or margin, agent must reply that the tool only supports take-profit and stop-loss. Updated SKILL.md Sub-Modules, Routing, and MCP Tools table accordingly.

---

## [2026.3.13-8] - 2026-03-13

### Changed

- **cex_tradfi_update_order**: Documented that the tool supports **price** and **take-profit / stop-loss price** only; **size is not supported**. Updated `references/amend-order.md` (parameters table, workflow, scenarios): removed amend-size and amend-price-and-size scenarios; added Scenario 2 for take-profit/stop-loss. If user asks to change size, agent must reply that the tool does not support it. Updated SKILL.md Sub-Modules, Routing, and MCP Tools table accordingly.

---

## [2026.3.13-7] - 2026-03-13

### Added

- **Trading modules**: Place order, amend order, cancel order, modify position, close position. New sub-modules and routing to `references/place-order.md`, `references/amend-order.md`, `references/cancel-order.md`, `references/modify-position.md`, `references/close-position.md`. MCP tools: `cex_tradfi_create_tradfi_order`, `cex_tradfi_update_order`, `cex_tradfi_delete_order` (one order per call; no batch), `cex_tradfi_update_position`, `cex_tradfi_close_position`.
- **Parameter conditions and limits**: Skill and each trading reference must declare input conditions and value limits from the MCP; only MCP-documented parameters may be used.
- **User confirmation**: Before any trading MCP call, output all parameters to the user and require explicit confirmation; do not execute until confirmed.
- **Response parameter explanation**: After each trading operation, explain in the response the parameters that were used and the outcome (success or error).

### Changed

- **SKILL.md**: Extended from read-only query suite to full TradFi suite (query + trading). Description, Sub-Modules, Routing Rules, MCP Tools, Execution, Domain Knowledge, Error Handling, Safety Rules, and Report Template updated. Existing query content unchanged.

### Fixed

- **MCP tool names**: Corrected to actual Gate TradFi MCP names: `cex_tradfi_create_order` → `cex_tradfi_create_tradfi_order`; `cex_tradfi_amend_order` → `cex_tradfi_update_order`; `cex_tradfi_modify_position` → `cex_tradfi_update_position`; cancel/delete uses `cex_tradfi_delete_order` only (no `cex_tradfi_cancel_order` or `cex_tradfi_delete_orders`; no batch support). Updated in SKILL.md and all trading reference docs; cancel-order doc uses single tool `cex_tradfi_delete_order`, batch scenario removed.

---

## [2026.3.13-6] - 2026-03-13

### Changed

- **Terminology**: TradFi-only wording. Removed "currency", "pair", and crypto symbols (e.g. BTC_USDT, USDT) from all docs. Use "symbol" for instruments (e.g. EURUSD, XAUUSD); "asset" for balance/account; table headers and error messages use "symbol" / "asset" instead of "pair" / "currency". Example prompts use TradFi symbols (EURUSD, XAUUSD).

---

## [2026.3.13-5] - 2026-03-13

### Changed

- **MCP tool names**: Updated all skill docs to use the actual Gate TradFi MCP tool names: `cex_tradfi_query_order_list`, `cex_tradfi_query_position_list`, [REDACTED_SECRET], `cex_tradfi_query_symbols`, `cex_tradfi_query_symbol_ticker`, `cex_tradfi_query_symbol_kline`, `cex_tradfi_query_user_assets`, [REDACTED_SECRET]. Removed previous naming (list_orders, list_positions, get_tickers, get_accounts, etc.) so the agent invokes the correct MCP tools.

---

## [2026.3.13-4] - 2026-03-13

### Added

- **Order history**: Added MCP tool `cex_tradfi_query_order_history_list` for querying order history (filled/cancelled). Open orders use `cex_tradfi_query_order_list`; order history uses `cex_tradfi_query_order_history_list`.

---

## [2026.3.13-3] - 2026-03-13

### Changed

- **Query orders**: Removed single-order-by-ID flow and any use of `order_id` parameter. `cex_tradfi_query_order_list` does not support order_id; use only parameters documented in the MCP. Order module now supports only: order list (open) and order history.
- **All modules**: Skill now states that only MCP-documented parameters may be used for each tool; no unsupported parameters (e.g. order_id, or optional filters not in the MCP) may be added.

---

## [2026.3.13-2] - 2026-03-13

### Changed

- **Query market** — `references/query-market.md`: now covers **category list** (`cex_tradfi_query_categories`), **symbol list** (`cex_tradfi_query_symbols`), **ticker** (`cex_tradfi_query_symbol_ticker`), and **symbol kline** (`cex_tradfi_query_symbol_kline`). Replaced prior pair list with category + symbol list (`cex_tradfi_query_symbols`).
- **Query assets** — `references/query-assets.md`: added **MT5 account info** via `cex_tradfi_query_mt5_account_info`; user assets still via `cex_tradfi_query_user_assets`.
- **SKILL.md**: frontmatter fixed (name without `##`); description and routing updated for category/symbol/MT5; MCP tool table extended to 10 tools (all `cex_tradfi_*`). Domain Knowledge updated for categories, symbols, and MT5.
- **README**: Core Capabilities and Example Prompts updated; scope clarified (no order placement, no fund transfer).

### Scope

- Read-only only; no order placement, no fund or balance transfer. All tools prefixed with `cex_tradfi`.

---

## [2026.3.13-1] - 2026-03-13

### Added

- **Query orders** — `references/query-orders.md`: open orders → `cex_tradfi_query_order_list`; order history → `cex_tradfi_query_order_history_list`. No order_id; use only MCP-documented parameters.
- **Query positions** — `references/query-positions.md`: list current positions, list position history. MCP tools: `cex_tradfi_query_position_list`, `cex_tradfi_query_position_history_list`.
- **Query market** — `references/query-market.md`: category list, symbol list, ticker, symbol kline (see 2026.3.13-2). MCP tools: `cex_tradfi_query_categories`, `cex_tradfi_query_symbols`, `cex_tradfi_query_symbol_ticker`, `cex_tradfi_query_symbol_kline`.
- **Query assets** — `references/query-assets.md`: user account/balance and MT5 account info. MCP tools: `cex_tradfi_query_user_assets`, `cex_tradfi_query_mt5_account_info`.
- Routing-based SKILL.md with Sub-Modules, Routing Rules, MCP tool table, Execution, Domain Knowledge, Error Handling, and Safety Rules.
- README with Overview, Core Capabilities table, and Architecture.

### Scope

- Read-only skill; no order placement, cancel, amend, or transfer.
- All content in English; no deprecated brand text (Gate only).


path: README.md
content: # Gate Exchange TradFi Query Skill

## Overview

AI Agent skill for querying Gate TradFi (traditional finance) data in read-only mode. All MCP tools used are prefixed with `cex_tradfi`. It supports four query areas: order list and order history, current and historical positions, market data (category list, symbol list, ticker, symbol kline), and user assets plus MT5 account info. **No order placement, fund transfer, or balance transfer.**

### Core Capabilities

| Module              | Description                                           | Example prompts                                                       |
| ------------------- | ----------------------------------------------------- | --------------------------------------------------------------------- |
| **Query orders**    | Order list, order history                             | "My TradFi orders", "Order history"                                  |
| **Query positions** | Current position list, position history               | "My positions", "Position history", "Current holdings"               |
| **Query market**    | Category list, symbol list, ticker, symbol kline      | "TradFi categories", "Symbol list", "Ticker for X", "Kline 1d"       |
| **Query assets**    | User balance/asset info, MT5 account info             | "My assets", "Balance", "MT5 account", "My MT5 info"                 |

## Architecture

This skill uses a **routing architecture**:

- **SKILL.md** defines the four sub-modules, routing rules, MCP tool list (all `cex_tradfi_*`), and execution flow. Intent is mapped to one of the reference documents.
- **references/** holds one document per module:
  - `query-orders.md` — order list, order history
  - `query-positions.md` — current position list, position history
  - `query-market.md` — category list, symbol list, ticker, symbol kline
  - `query-assets.md` — user assets/balance, MT5 account info

Each reference contains a Workflow (steps and tool calls), Report Template, and scenarios with Context, Prompt Examples, and Expected Behavior. The agent loads the matching reference and follows its workflow to call the appropriate `cex_tradfi_*` MCP tools and format the response.

## Prerequisites

- Gate MCP configured and connected with TradFi tools (all prefixed with `cex_tradfi_`, e.g. `cex_tradfi_query_order_list`, `cex_tradfi_query_categories`, [REDACTED_SECRET]). If your MCP uses different tool names, map them in SKILL.md or in the reference docs.

## Example Prompts

```
# Orders
"My TradFi open orders"
"Order history"

# Positions
"My positions"
"Position history"

# Market
"TradFi category list"
"Symbol list"
"Ticker for EURUSD"
"Kline 1d for EURUSD"

# Assets
"My TradFi balance"
"Account balance"
"MT5 account"
"My MT5 info"
```

## File Structure

```
gate-exchange-tradfi/
├── README.md
├── SKILL.md
├── CHANGELOG.md
└── references/
    ├── query-orders.md
    ├── query-positions.md
    ├── query-market.md
    └── query-assets.md
```

## Security and Scope

- **Read-only**: This skill only queries data. It does **not** place or cancel orders, and does **not** perform fund transfers or balance transfers.
- No credentials are stored or logged; balance, position, and MT5 account data are displayed only in the current response.
- Confirmation is not required for query-only flows.

## Authentication

This skill does **not** handle credentials directly. Authentication is managed by the Gate MCP platform layer — the MCP server holds the user's API key and injects it into API calls automatically. No environment variables or secrets are required by the skill itself. Users should configure their Gate API key in the MCP server settings (see [Gate MCP](https://github.com/gateio/gate-mcp) for setup instructions).

## Source

- **Repository**: [github.com/gate/gate-skills](https://github.com/gate/gate-skills)
- **Publisher**: [Gate.com](https://www.gate.com)


path: references/amend-order.md
content: # Gate TradFi Amend Order

Amend an existing TradFi order: **price** and/or **take-profit / stop-loss price** only. **Size is not supported** by `cex_tradfi_update_order`. Use only MCP-documented tool names and parameters.

## MCP tools and parameters

| Tool | Purpose | Parameters (declare per MCP) |
| -----| --------| -----------------------------|
| `cex_tradfi_update_order` | Amend one order | Supports **price** and **take-profit / stop-loss price** only. **Does not support changing size.** Required/optional from MCP: order_id, and at least one of new price, take-profit price, stop-loss price. Do not pass size or parameters not documented in the MCP. |

- **Conditions and limits**: Only open orders can be amended. Value constraints (price step, etc.) must follow MCP or API rules. **Do not pass or prompt for size** — the tool does not support it.
- **Order id source**: The order id for `cex_tradfi_update_order` **must** come from **`cex_tradfi_query_order_list`** (the open order list). **Do not use** the `id` or `log_id` returned by `cex_tradfi_create_tradfi_order` — those cannot be used for amend. Resolve from `cex_tradfi_query_order_list` if user refers to order by position or description.

## Pre-execution confirmation

Before calling `cex_tradfi_update_order`: **output all parameters** that will be sent (e.g. order_id, new price, take-profit price, stop-loss price). Show before/after if available. Ask the user to confirm. Do **not** call the tool until the user explicitly confirms.

---

## Workflow

1. Identify the order to amend (from user-provided order_id or by listing open orders and letting user choose).
2. Determine what to change per user message: **price** and/or **take-profit price** and/or **stop-loss price** only. If the user asks to change size, tell them the tool does not support changing size.
3. Build parameter set using **only MCP-documented parameters** (no size).
4. **Output the full parameter set (and before/after) to the user and ask for confirmation.** Do not call the tool until user confirms.
5. After confirmation, call `cex_tradfi_update_order`.
6. In the response: **explain the parameters that were used** and the outcome (success or error). Use the Report Template below.

## Report Template

After execution, include:

- **Parameters used**: What was sent (e.g. order_id, new price, take-profit, stop-loss).
- **Result**: Success (updated order state) or error code/message. If error, restate the sent parameters and suggest correction.

---

## Scenario 1: Amend price

**Context**: User wants to change the limit price of an open order.

**Prompt Examples**:
- "Amend order 12345 price to 1.0600"
- "Change order price to 1.06"
- "Update my EURUSD order price to 1.0600"

**Expected Behavior**:
1. Resolve order (by order_id or from list). Get current price.
2. Build params: order_id, new price. Output for confirmation.
3. After confirmation, call `cex_tradfi_update_order`.
4. Respond with parameters used and result.

**Response Template**:
```
Parameters sent:
| Order ID | New price |
| 12345    | 1.0600    |

Result: Order amended. Price updated to 1.0600.
```

---

## Scenario 2: Amend take-profit or stop-loss price

**Context**: User wants to change take-profit and/or stop-loss price for an open order.

**Prompt Examples**:
- "Amend order 12345 take-profit to 1.07"
- "Change stop-loss to 1.04 for order 12345"
- "Update order 12345 take-profit 1.07 stop-loss 1.04"

**Expected Behavior**:
1. Resolve order. Build params: order_id, and take-profit price and/or stop-loss price (per MCP). Output for confirmation.
2. After confirmation, call `cex_tradfi_update_order`.
3. Respond with parameters used and result.

**Note**: If the user asks to change **size**, reply that `cex_tradfi_update_order` does not support changing size; only price and take-profit/stop-loss price can be amended.


path: references/cancel-order.md
content: # Gate TradFi Cancel Order

Cancel one TradFi order per call. Use only MCP-documented tool names and parameters. **Only one tool: `cex_tradfi_delete_order`; it does not support batch** — one order per call. To cancel multiple orders, call it once for each order. Declare conditions and limits from the MCP here.

## MCP tools and parameters

| Tool | Purpose | Parameters (declare per MCP) |
| -----| --------| -----------------------------|
| `cex_tradfi_delete_order` | Cancel/delete one order | Required: order identifier (order_id). Use only parameters documented in the MCP. Does not support batch. |

- **Order id source**: The order id for `cex_tradfi_delete_order` **must** come from **`cex_tradfi_query_order_list`** (the open order list). **Do not use** the `id` or `log_id` returned by `cex_tradfi_create_tradfi_order` — those cannot be used as the cancel/delete parameter. If the user wants to cancel an order they just placed, call `cex_tradfi_query_order_list` first and use the order id from that response.
- **Conditions and limits**: Only open orders can be cancelled. **Multiple orders**: call `cex_tradfi_delete_order` once per order.

## Pre-execution confirmation

Before calling `cex_tradfi_delete_order`: **output what will be cancelled** (e.g. order_id). Ask the user to confirm. Do **not** call the tool until the user explicitly confirms.

---

## Workflow

1. Identify the order to cancel: by order_id from user, or list open orders and let user choose one (by number).
2. Build parameter set using **only MCP-documented parameters**.
3. **Output the target (order_id) to the user and ask for confirmation.** Do not call the tool until user confirms.
4. After confirmation, call `cex_tradfi_delete_order` with the order_id. For more than one order, repeat (one call per order).
5. In the response: **explain what was cancelled** (parameters sent) and the outcome. Use the Report Template below.

## Report Template

After execution, include:

- **Parameters used**: What was sent (e.g. order_id for each call).
- **Result**: Success (cancelled) or error code/message. If error, restate the sent parameters and suggest correction.

---

## Scenario 1: Cancel by order_id

**Context**: User provides an order identifier to cancel.

**Prompt Examples**:
- "Cancel order 12345"
- "Revoke order 12345"
- "Cancel my order 12345"

**Expected Behavior**:
1. Parse order_id. Output it for confirmation.
2. After confirmation, call `cex_tradfi_delete_order` with order_id.
3. Respond with parameters used and result.

**Response Template**:
```
Parameters sent:
| Order ID |
| 12345    |

Result: Order cancelled.
```

---

## Scenario 2: List orders then cancel

**Context**: User wants to cancel but does not know order_id; list open orders first.

**Prompt Examples**:
- "Cancel my order"
- "Show my orders" (then user selects which to cancel)

**Expected Behavior**:
1. Call `cex_tradfi_query_order_list` (with only MCP-documented params).
2. Show order list with numbered options. User selects one by number.
3. Map selection to order_id. Output for confirmation.
4. After confirmation, call `cex_tradfi_delete_order` with that order_id.
5. Respond with parameters used and result.


path: references/close-position.md
content: # Gate TradFi Close Position

Close a TradFi position (full or partial). Use only MCP-documented tool names and parameters. **Full close (全部平仓): do not pass size or close_volume** — the tool closes the entire position without that parameter. For partial close, pass close size/close_volume per MCP.

## MCP tools and parameters

| Tool | Purpose | Parameters (declare per MCP) |
| -----| --------| -----------------------------|
| `cex_tradfi_close_position` | Close position | **Full close**: position identifier (symbol or position_id) only; **do not pass size or close_volume**. **Partial close**: position identifier and close size/close_volume (per MCP). Do not pass parameters not documented in the MCP. |

- **Full close**: **Do not pass size or close_volume**; the tool closes the whole position. Use only position identifier (e.g. symbol or position_id).
- **Partial close**: Pass close size or close_volume per MCP; it must not exceed current position size. Value constraints (size step, min/max) must follow MCP or API rules.
- **Position identification**: Use only the identifier the MCP documents. Current positions from `cex_tradfi_query_position_list`.

## Pre-execution confirmation

Before calling `cex_tradfi_close_position`: **output all parameters** that will be sent (e.g. symbol for full close, or symbol + close size for partial). Ask the user to confirm. Do **not** call the tool until the user explicitly confirms.

---

## Workflow

1. Identify the position to close (symbol or position_id from user or from `cex_tradfi_query_position_list`).
2. **Full close**: Build params with position identifier only; **do not pass size or close_volume**. **Partial close**: Determine close size (e.g. user says "close half" or "close 0.05"); validate against current position and MCP; pass close size/close_volume per MCP.
3. Build parameter set using **only MCP-documented parameters**.
4. **Output the full parameter set to the user and ask for confirmation.** Do not call the tool until user confirms.
5. After confirmation, call `cex_tradfi_close_position`.
6. In the response: **explain the parameters that were used** and the outcome (e.g. closed size, realized PnL if returned). Use the Report Template below.

## Report Template

After execution, include:

- **Parameters used**: What was sent (e.g. symbol only for full close; symbol + close size for partial).
- **Result**: Success (position closed or reduced; realized PnL if available) or error code/message. If error, restate the sent parameters and suggest correction.

---

## Scenario 1: Full close (全部平仓)

**Context**: User wants to close the entire position for a symbol. **Do not pass size or close_volume** — full close uses position identifier only.

**Prompt Examples**:
- "Close EURUSD position"
- "Close all EURUSD"
- "Flat EURUSD"
- "Close my EURUSD"

**Expected Behavior**:
1. Resolve position (e.g. via `cex_tradfi_query_position_list`). Confirm it exists.
2. Build params: **position identifier (symbol or position_id) only**; do **not** pass size or close_volume. Output for confirmation.
3. After confirmation, call `cex_tradfi_close_position`.
4. Respond with parameters used and result.

**Response Template**:
```
Parameters sent:
| Symbol  | (full close — no size/close_volume) |
| EURUSD  | —                                  |

Result: Position closed. Realised PnL: … (if returned by MCP).
```

---

## Scenario 2: Partial close

**Context**: User wants to close part of the position. Pass close size or close_volume per MCP.

**Prompt Examples**:
- "Close 0.05 EURUSD"
- "Close half of my EURUSD position"
- "Reduce EURUSD by 0.05"

**Expected Behavior**:
1. Resolve position and current size. Compute close size (e.g. half or user-specified amount). Validate against position size and MCP limits.
2. Build params: position identifier and **close size/close_volume** (per MCP). Output for confirmation.
3. After confirmation, call `cex_tradfi_close_position`.
4. Respond with parameters used and result (remaining position if available).


path: references/mcp.md
content: ---
name: gate-exchange-tradfi-mcp
version: "2026.3.30-1"
updated: "2026-03-30"
description: "MCP execution specification for TradFi module: symbols, market data, assets, order/position query and order/position mutations."
---

# Gate TradFi MCP Specification

## 1. Scope and Trigger Boundaries

In scope:
- TradFi symbols and market data query
- TradFi order/position/assets query
- TradFi order/place/update/cancel and position close/update operations

Out of scope:
- CEX spot/futures/DEX operations

## 2. MCP Detection and Fallback

Detection:
1. Verify `cex_tradfi_*` tools are available.
2. Probe with `cex_tradfi_query_symbols` or `cex_tradfi_query_user_assets`.

Fallback:
- If write operations unavailable, switch to read-only TradFi mode.

## 3. Authentication

- API key required.
- Mutation calls require strict auth and explicit confirmation.

## 4. MCP Resources

No mandatory MCP resources.

## 5. Tool Calling Specification

Namespace note:
- `cex_tradfi` is the base namespace prefix used by this module.
- `cex_tradfi_*` endpoints belong to the TradFi module namespace.

### Read tools
- `cex_tradfi_query_categories`
- `cex_tradfi_query_mt5_account_info`
- `cex_tradfi_query_symbols`
- `cex_tradfi_query_symbol_detail`
- `cex_tradfi_query_symbol_ticker`
- `cex_tradfi_query_symbol_kline`
- `cex_tradfi_query_order_list`
- `cex_tradfi_query_order_history_list`
- `cex_tradfi_query_position_list`
- `cex_tradfi_query_position_history_list`
- `cex_tradfi_query_user_assets`

### Write tools
- `cex_tradfi_create_tradfi_order`
- `cex_tradfi_update_order`
- `cex_tradfi_delete_order`
- `cex_tradfi_update_position`
- `cex_tradfi_close_position`

## 6. Execution SOP (Non-Skippable)

1. Classify intent (query vs mutation).
2. For mutations, build action draft including symbol/side/volume/price and risk notes.
3. Require explicit confirmation.
4. Execute mutation call.
5. Verify via order/position query endpoints.

## 7. Output Templates

```markdown
## TradFi Action Draft
- Action: {place_or_update_or_cancel_or_close}
- Symbol: {symbol}
- Parameters: {key_params}
- Risk: market volatility and execution slippage.
Reply "Confirm action" to proceed.
```

```markdown
## TradFi Result
- Status: {success_or_failed}
- Object: {order_or_position_id}
- Updated State: {state_summary}
```

## 8. Safety and Degradation Rules

1. Never execute TradFi mutation calls without explicit immediate confirmation.
2. Keep symbol and volume precision as API expects.
3. If market data is stale/unavailable, warn before mutation.
4. Preserve backend error codes/messages.
5. Degrade to query-only mode when write permissions are missing.


path: references/modify-position.md
content: # Gate TradFi Modify Position

Modify an existing TradFi position: **take-profit and/or stop-loss price only**. **Other fields (e.g. leverage, margin mode) are not supported** by `cex_tradfi_update_position`. Use only MCP-documented tool names and parameters.

## MCP tools and parameters

| Tool | Purpose | Parameters (declare per MCP) |
| -----| --------| -----------------------------|
| `cex_tradfi_update_position` | Modify position | Supports **take-profit price** and **stop-loss price** only. **Does not support leverage, margin mode, or other fields.** Required/optional from MCP: position identifier (symbol or position_id), and take-profit price and/or stop-loss price. Do not pass parameters not documented in the MCP. |

- **Conditions and limits**: Only existing positions can be modified. Value constraints for take-profit/stop-loss must follow MCP or API rules. **Do not pass or prompt for leverage, margin mode, or other fields** — the tool does not support them.
- **Position identification**: Use only the identifier the MCP documents. Current positions can be listed via `cex_tradfi_query_position_list`.

## Pre-execution confirmation

Before calling `cex_tradfi_update_position`: **output all parameters** that will be sent (e.g. symbol or position_id, take-profit price, stop-loss price). Ask the user to confirm. Do **not** call the tool until the user explicitly confirms.

---

## Workflow

1. Identify the position to modify (symbol or position_id from user or from `cex_tradfi_query_position_list`).
2. Determine what to change per user message: **take-profit price** and/or **stop-loss price** only. If the user asks to change leverage, margin mode, or anything else, tell them the tool only supports take-profit and stop-loss price.
3. Build parameter set using **only MCP-documented parameters**.
4. **Output the full parameter set to the user and ask for confirmation.** Do not call the tool until user confirms.
5. After confirmation, call `cex_tradfi_update_position`.
6. In the response: **explain the parameters that were used** and the outcome. Use the Report Template below.

## Report Template

After execution, include:

- **Parameters used**: What was sent (e.g. symbol/position_id, take-profit price, stop-loss price).
- **Result**: Success (position updated) or error code/message. If error, restate the sent parameters and suggest correction.

---

## Scenario 1: Set or change take-profit price

**Context**: User wants to set or change the take-profit price for an open position.

**Prompt Examples**:
- "Set take-profit to 1.08 for my EURUSD position"
- "Modify position EURUSD take-profit 1.08"
- "Change take-profit to 1.08"

**Expected Behavior**:
1. Resolve position (symbol or position_id). Build params: position identifier, take-profit price. Output for confirmation.
2. After confirmation, call `cex_tradfi_update_position`.
3. Respond with parameters used and result.

**Response Template**:
```
Parameters sent:
| Symbol | Take-profit price |
| EURUSD | 1.08              |

Result: Position modified. Take-profit set to 1.08.
```

---

## Scenario 2: Set or change stop-loss price

**Context**: User wants to set or change the stop-loss price for an open position.

**Prompt Examples**:
- "Set stop-loss to 1.03 for EURUSD"
- "Modify position stop-loss 1.03"
- "Change stop-loss to 1.03"

**Expected Behavior**:
1. Resolve position. Build params: position identifier, stop-loss price. Output for confirmation.
2. After confirmation, call `cex_tradfi_update_position`.
3. Respond with parameters used and result.

---

## Scenario 3: Set or change both take-profit and stop-loss

**Context**: User wants to set or change both take-profit and stop-loss for a position.

**Prompt Examples**:
- "Set take-profit 1.08 and stop-loss 1.03 for EURUSD"
- "Modify position EURUSD take-profit 1.08 stop-loss 1.03"

**Expected Behavior**:
1. Build params: position identifier, take-profit price, stop-loss price. Output for confirmation.
2. After confirmation, call `cex_tradfi_update_position`.
3. Respond with parameters used and result.

**Note**: If the user asks to change **leverage**, **margin mode**, or any other field, reply that `cex_tradfi_update_position` only supports take-profit and stop-loss price; other modifications are not supported.


path: references/place-order.md
content: # Gate TradFi Place Order

Place a new TradFi order. **Before placing an order, call `cex_tradfi_query_symbol_detail`** with the symbol to get the trading pair configuration; if the symbol is not found, do not place the order. **`cex_tradfi_create_tradfi_order` supports setting take-profit and stop-loss price** (optional, per MCP). Use only MCP-documented tool names and parameters.

## MCP tools and parameters

| Tool | Purpose | Parameters (declare per MCP) |
| -----| --------| -----------------------------|
| `cex_tradfi_query_symbol_detail` | Get symbol config (required before place order) | Pass symbol (trading pair). Returns config including `leverages`, `min_order_volume`, `step_order_volume`. If no result or error, symbol may not exist — do not place order. |
| `cex_tradfi_create_tradfi_order` | Place new order | Required/optional from MCP. Typical: symbol, side, size (volume), price (limit) or market flag. **Optional: take-profit price, stop-loss price**, leverage. Do not pass parameters not documented in the MCP. |

### Symbol config validation (from `cex_tradfi_query_symbol_detail`)

- **Pre-order requirement**: Before calling `cex_tradfi_create_tradfi_order`, call **`cex_tradfi_query_symbol_detail`** with the symbol. If the query returns no data or an error, **do not place the order** — the symbol may not exist; inform the user.
- **If symbol config is found**, use the response to validate:
  - **`leverages`** (array): Supported leverage values. Leverage is optional; if the user specifies leverage, it **must** be one of the values in `leverages`. Do not pass a leverage value not in this array.
  - **`min_order_volume`**: Minimum order volume. Order size **must be greater than or equal to** `min_order_volume`.
  - **`step_order_volume`**: Minimum order size step. Order size **must be an integer multiple of** `step_order_volume` (e.g. valid sizes: step_order_volume, 2×step_order_volume, …; and size ≥ min_order_volume).
- **Missing required param**: Ask the user (e.g. symbol, side, size, or price for limit orders).

## Pre-execution confirmation

Before calling `cex_tradfi_create_tradfi_order`: **output all parameters** that will be sent (e.g. symbol, side, size, price or market, and **take-profit / stop-loss** if set). Ask the user to confirm (e.g. "Confirm: place order symbol=EURUSD, side=buy, size=0.1, price=1.0500, take-profit 1.08, stop-loss 1.03. Reply yes to execute."). Do **not** call the tool until the user explicitly confirms.

---

## Workflow

1. Parse user intent: symbol, side, size, price (or market), **take-profit / stop-loss price** and **leverage** (optional) if the user specifies them.
2. If symbol/side/size missing or invalid, ask user. For limit orders, price is required unless MCP supports market orders with a different convention.
3. **Required before place order**: Call **`cex_tradfi_query_symbol_detail`** with the symbol (trading pair). If the call returns no data or an error, **do not place the order** — tell the user the symbol may not exist.
4. **If symbol detail is returned**: From the response get `leverages`, `min_order_volume`, `step_order_volume`. Validate: (a) Order size **≥** `min_order_volume`; (b) Order size is an **integer multiple of** `step_order_volume`; (c) If leverage is provided, it **must** be in the `leverages` array. If validation fails, ask the user to correct size or leverage.
5. Build parameter set using **only MCP-documented parameters** (include take-profit, stop-loss, leverage when requested and valid).
6. **Output the full parameter set to the user and ask for confirmation.** Do not call the place-order tool until user confirms.
7. After confirmation, call `cex_tradfi_create_tradfi_order` with the confirmed parameters.
8. In the response: **explain the parameters that were used** and the outcome (order id, status, or error). Use the Report Template below.

## Report Template

After execution, include:

- **Parameters used**: Table or list of what was sent (symbol, side, size, price/market, **take-profit, stop-loss** if set, and any other params).
- **Result**: Order id and status (e.g. open, filled) or error code/message. If error, restate the sent parameters and suggest correction.

**Important**: The `id` and `log_id` returned by `cex_tradfi_create_tradfi_order` **must not be used** as the order id for the cancel (`cex_tradfi_delete_order`) or amend (`cex_tradfi_update_order`) APIs. For cancel or amend, the order id **must** come from **`cex_tradfi_query_order_list`** (the order list query). If the user wants to cancel or amend an order they just created, call `cex_tradfi_query_order_list` first and use the order id from that response.

---

## Scenario 1: Limit order

**Context**: User wants to place a limit order with symbol, side, size, and price.

**Prompt Examples**:
- "Place order buy EURUSD 0.1 at 1.0500"
- "Sell XAUUSD 0.01 at 2650"
- "Open long EURUSD size 0.1 limit 1.05"

**Expected Behavior**:
1. Extract symbol, side, size, price. Call `cex_tradfi_query_symbol_detail(symbol)`; if no result, do not place order and inform user.
2. From symbol detail validate size ≥ min_order_volume, size is integer multiple of step_order_volume; if leverage given, it must be in leverages array.
3. Output parameters for user confirmation. Wait for confirmation.
4. Call `cex_tradfi_create_tradfi_order` with only MCP-documented parameters.
5. Respond with parameters used and result (order id, status or error).

**Response Template**:
```
Parameters sent:
| Symbol | Side | Size | Price |
| EURUSD | buy | 0.1 | 1.0500 |

Result: Order created. Order ID: … Status: open.
```

---

## Scenario 2: Market order (if supported by MCP)

**Context**: User wants to place a market order. Only include if the MCP documents a market-order parameter or equivalent.

**Prompt Examples**:
- "Market buy EURUSD 0.1"
- "Sell XAUUSD 0.01 market"

**Expected Behavior**:
1. Extract symbol, side, size. Call `cex_tradfi_query_symbol_detail(symbol)`; if no result, do not place order.
2. Validate size and optional leverage from symbol detail (min_order_volume, step_order_volume, leverages). Use MCP-documented way to indicate market.
3. Output parameters for user confirmation. Wait for confirmation.
4. Call `cex_tradfi_create_tradfi_order`.
5. Respond with parameters used and result.

---

## Scenario 3: Place order with take-profit and/or stop-loss

**Context**: User wants to place an order and set take-profit and/or stop-loss price at creation. **`cex_tradfi_create_tradfi_order` supports this.**

**Prompt Examples**:
- "Buy EURUSD 0.1 at 1.05, take-profit 1.08, stop-loss 1.03"
- "Place order sell XAUUSD 0.01 at 2650 with stop-loss 2640"
- "Open long EURUSD 0.1 limit 1.05, take-profit 1.08"

**Expected Behavior**:
1. Extract symbol, side, size, price (or market), take-profit/stop-loss if given. Call `cex_tradfi_query_symbol_detail(symbol)`; if no result, do not place order.
2. Validate size (min_order_volume, step_order_volume) and leverage (leverages array) from symbol detail. Build params per MCP.
3. Output full parameter set for user confirmation.
4. After confirmation, call `cex_tradfi_create_tradfi_order` with the parameters.
5. Respond with parameters used and result.


path: references/query-assets.md
content: # Query TradFi User Assets and MT5 Account — Workflow and Scenarios

Read-only: get user account/balance (assets) and MT5 account info. All tools use `cex_tradfi_*` prefix. **Pass only parameters documented in the MCP for each tool.** No transfers or trading.

## Workflow

### Step 1: Identify query type

- **User assets / balance**: User wants TradFi account balances (e.g. "my assets", "balance", "account").
- **MT5 account info**: User wants MT5 account details (e.g. "MT5 account", "my MT5 info", "MT5 login").

### Step 2: Call tools

- **User assets**: Call `cex_tradfi_query_user_assets` with only MCP-documented parameters. Extract: asset (or as returned by API), available, locked/total as returned.
- **MT5 account**: Call [REDACTED_SECRET] with only MCP-documented parameters. Extract: account id, server, login, balance, equity, margin, or fields as returned.

### Step 3: Format response

Use the Report Template below. If the API returns empty or error, report "Unable to load assets" or "Unable to load MT5 account" and suggest checking connection or permissions.

## Report Template

**Assets / Balance**


| Asset   | Available | Locked | Total |
| ------- | --------- | ------ | ----- |
| ...     | ...       | ...    | ...   |


(If the API uses different field names, map them accordingly, e.g. "balance", "free", "used".)

**MT5 account**


| Field    | Value       |
| -------- | ----------- |
| Account  | ...         |
| Server   | ...         |
| Balance  | ...         |
| Equity   | ...         |
| Margin   | ...         |
| (others) | as returned |


---

## Scenario 1: Get account balance (user assets)

**Context**: User wants to see their TradFi account balance or assets.

**Prompt Examples**:

- "My TradFi assets"
- "Balance"
- "How much do I have"
- "Account balance"
- "My funds"

**Expected Behavior**:

1. Call `cex_tradfi_query_user_assets`.
2. Format as assets table (asset, available, locked, total).
3. If error or empty, reply "Unable to load assets" and do not retry indefinitely.
4. Do not expose API keys or secrets; only display balance data returned by the tool.

---

## Scenario 2: Get balance for a specific asset

**Context**: User asks for one asset only (e.g. USD).

**Prompt Examples**:

- "My TradFi balance"
- "How much USD do I have"

**Expected Behavior**:

1. Call `cex_tradfi_query_user_assets` with only MCP-documented parameters. If the response includes multiple assets, show the requested one or all as returned.
2. Show that asset’s available/locked/total.
3. If asset not found in response, reply "No balance for {asset}."

---

## Scenario 3: Get MT5 account info

**Context**: User wants to see their MT5 account information.

**Prompt Examples**:

- "MT5 account"
- "My MT5 info"
- "MT5 account details"
- "MT5 login"

**Expected Behavior**:

1. Call `cex_tradfi_query_mt5_account_info`.
2. Format as MT5 account table or key-value list (account, server, balance, equity, margin, etc.).
3. If error or empty, reply "Unable to load MT5 account" and suggest checking MT5 connection or permissions.
4. Do not expose passwords or sensitive credentials; only display info returned by the tool.



path: references/query-market.md
content: # Query TradFi Market Data — Workflow and Scenarios

Read-only: query category list, symbol list, ticker, and symbol kline. All tools use `cex_tradfi_*` prefix. **Pass only parameters documented in the MCP for each tool.** No trading.

## Workflow

### Step 1: Identify query type

- **Category list**: User wants TradFi product categories (e.g. "TradFi categories", "category list").
- **Symbol list**: User wants the list of tradeable symbols (e.g. "symbol list", "list symbols", optionally by category).
- **Ticker(s)**: User wants price/volume for one or more symbols (e.g. "ticker for X", "price of symbol Y").
- **Symbol kline**: User wants OHLCV for a symbol over an interval (e.g. "kline for symbol X", "1d chart for Y").

### Step 2: Call tools

- **Category list**: Call `cex_tradfi_query_categories` with only MCP-documented parameters. Extract: category id, name, or fields as returned.
- **Symbol list**: Call `cex_tradfi_query_symbols` with only MCP-documented parameters (e.g. category only if the MCP defines it). Extract: symbol and other fields as returned.
- **Ticker(s)**: Call `cex_tradfi_query_symbol_ticker` with only MCP-documented parameters (e.g. symbol(s) if defined). Extract: last, 24h change, volume, etc.
- **Symbol kline**: Call `cex_tradfi_query_symbol_kline` with only MCP-documented parameters (e.g. symbol, interval, limit only if defined). Extract: timestamp, open, high, low, close, volume.

### Step 3: Format response

Use the Report Template below. If no data, report "No categories" / "No symbols" / "Symbol not found" / "No kline data" as applicable.

## Report Template

**Category list**

| Category ID / Name | Description (if any) |
|-------------------|----------------------|
| ...               | ...                  |

**Symbol list**

| Symbol   | Category | Status   |
|----------|----------|----------|
| ...      | ...      | tradeable / ... |

**Ticker(s)**

| Symbol   | Last   | 24h Change | 24h High | 24h Low | 24h Volume |
|----------|--------|------------|----------|---------|------------|
| ...      | ...    | ...%       | ...      | ...     | ...        |

**Symbol kline (summary)**

- Symbol: {symbol}
- Interval: {interval}
- From – To: {time range}
- Latest: O {open} H {high} L {low} C {close} V {volume}

(Full series can be shown as table or last N candles.)

---

## Scenario 1: Query category list

**Context**: User wants to see TradFi product category list.

**Prompt Examples**:
- "TradFi category list"
- "Query TradFi categories"
- "What categories are there"
- "List TradFi categories"

**Expected Behavior**:
1. Call `cex_tradfi_query_categories`.
2. Format as category table (id, name, or as returned).
3. If empty, reply "No categories returned."

---

## Scenario 2: List symbols

**Context**: User wants to see the list of tradeable symbols (optionally for a category).

**Prompt Examples**:
- "TradFi symbol list"
- "List symbols"
- "Symbols for category X"
- "What symbols can I trade"

**Expected Behavior**:
1. Call `cex_tradfi_query_symbols` with only the parameters documented in the MCP (e.g. category only if the MCP defines that parameter).
2. Format as symbol table (symbol, category, status).
3. If empty, reply "No symbols returned."

---

## Scenario 3: Get ticker for one or more symbols

**Context**: User wants current price and 24h stats for a symbol or symbols.

**Prompt Examples**:
- "Ticker for XAUUSD"
- "TradFi price for XAUUSD"
- "Ticker for symbol X and Y"

**Expected Behavior**:
1. Extract symbol(s) from user message; if unclear, ask which symbol(s).
2. Call `cex_tradfi_query_symbol_ticker` with the symbol(s).
3. Format as ticker table.
4. If symbol not found, reply "Symbol not found" and suggest listing symbols.

---

## Scenario 4: Get symbol kline / candlestick data

**Context**: User wants OHLCV data for a symbol (chart or analysis).

**Prompt Examples**:
- "Kline for XAUUSD 1d"
- "Candlestick 5m for symbol X"
- "Last 30 days 1d kline for XAUUSD"

**Expected Behavior**:
1. Call `cex_tradfi_query_symbol_kline` with only the parameters documented in the MCP (e.g. symbol, interval, limit only if defined).
3. Show kline summary and optionally last N candles in a table.
4. If no data, reply "No kline data for this symbol/interval."


path: references/query-orders.md
content: # Query TradFi Orders — Workflow and Scenarios

Read-only: list order list and order history. No create/cancel/amend. **Use only parameters documented in the Gate TradFi MCP for each tool; do not pass unsupported parameters.**

## Workflow

### Step 1: Identify query type

- **Order list (open orders)**: User wants current open orders (e.g. "my open orders", "list orders").
- **Order history**: User wants past orders (e.g. "order history", "recent filled/cancelled orders").

### Step 2: Call tools

- **Order list (open orders)**: Call `cex_tradfi_query_order_list` with only the parameters defined in the MCP for this tool. Extract: symbol, side, size, price, status, time, and other fields as returned.
- **Order history**: Call `cex_tradfi_query_order_history_list` with only the parameters defined in the MCP for this tool. Extract: same fields; indicate filled/cancelled where available.

### Step 3: Format response

Use the Report Template below. If the list is empty, report "No open orders" or "No orders in history" as applicable.

## Report Template

**Order list / Open orders**


| Symbol | Side | Size | Price | Status | Time (UTC) |
| ------ | ---- | ---- | ----- | ------ | ---------- |
| ...    | ...  | ...  | ...   | ...    | ...        |


**Order history**


| Symbol | Side | Size | Price | Filled | Status | Time |
| ------ | ---- | ---- | ----- | ------ | ------ | ---- |
| ...    | ...  | ...  | ...   | ...    | ...    | ...  |


---

## Scenario 1: List open orders

**Context**: User wants to see current open TradFi orders.

**Prompt Examples**:

- "Show my TradFi open orders"
- "List my orders"
- "What orders do I have open"

**Expected Behavior**:

1. Call `cex_tradfi_query_order_list` with only the parameters supported by the MCP for this tool.
2. Format result as order list table.
3. If empty, reply "No open orders."

---

## Scenario 2: Order history

**Context**: User wants to see past orders (filled or cancelled).

**Prompt Examples**:

- "TradFi order history"
- "My recent orders"
- "Show filled orders"

**Expected Behavior**:

1. Call `cex_tradfi_query_order_history_list` with only the parameters documented in the MCP for this tool.
2. Format as order history table.
3. If empty, reply "No orders in history."



path: references/query-positions.md
content: # Query TradFi Positions — Workflow and Scenarios

Read-only: list current positions and position history. **Pass only parameters documented in the MCP for each tool.** No open/close or modify.

## Workflow

### Step 1: Identify query type

- **Current positions**: User wants live positions (e.g. "my positions", "current holdings").
- **Position history**: User wants past positions or settlements (e.g. "position history", "past holdings").

### Step 2: Call tools

- **Current positions**: Call `cex_tradfi_query_position_list` with only MCP-documented parameters. Extract: symbol, side, size, entry price, margin, PnL if available, etc.
- **Position history**: Call `cex_tradfi_query_position_history_list` with only MCP-documented parameters (e.g. limit or time range only if defined in the MCP). Extract: same fields plus close time / settlement info.

### Step 3: Format response

Use the Report Template below. If the list is empty, report "No open positions" or "No position history" as applicable.

## Report Template

**Current positions**

| Symbol | Side | Size | Entry | Margin | Unrealized PnL | Mode |
|--------|------|------|-------|--------|----------------|------|
| ...    | ...  | ...  | ...   | ...    | ...            | ...  |

**Position history**

| Symbol | Side | Size | Entry | Close / Settle Time | Realized PnL |
|----------------|------|------|-------|---------------------|--------------|
| ...            | ...  | ...  | ...   | ...                 | ...          |

---

## Scenario 1: List current positions

**Context**: User wants to see all current TradFi positions.

**Prompt Examples**:
- "My TradFi positions"
- "Current holdings"
- "What am I holding"
- "Show my positions"

**Expected Behavior**:
1. Call `cex_tradfi_query_position_list`.
2. Format result as current-positions table.
3. If empty, reply "No open positions."

---

## Scenario 2: Position history

**Context**: User wants to see historical positions or closed positions.

**Prompt Examples**:
- "Position history"
- "My past positions"
- "Closed positions"

**Expected Behavior**:
1. Call `cex_tradfi_query_position_history_list` with only the parameters documented in the MCP.
2. Format as position history table.
3. If empty, reply "No position history."


Security scan verdicts — ClawScan: suspicious | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)