gate-exchange-flashswap
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGate Flash Swap
Gate Flash Swap
General Rules
通用规则
Read and follow the shared runtime rules before proceeding:
→
exchange-runtime-rules.mdGate Flash Swap supports instant cryptocurrency conversion with three swap modes: one-to-one, one-to-many, and many-to-one. This Skill covers the full lifecycle: querying pairs, previewing quotes, executing swaps, and tracking orders.
在操作前请阅读并遵循共享的运行时规则:
→
exchange-runtime-rules.mdGate Flash Swap 支持加密货币即时转换,提供三种闪兑模式:一对一、一对多和多对一。该Skill覆盖全生命周期:查询交易对、预览报价、执行闪兑以及追踪订单。
Trigger Conditions
触发条件
This Skill is activated when the user's request matches any of the following:
- Wants to swap/convert/exchange one cryptocurrency for another
- Wants to buy multiple cryptocurrencies at once using one currency (e.g. "buy 1u BTC, 2u ETH")
- Wants to sell multiple cryptocurrencies into one target currency (e.g. "sell 1 BTC, 2 ETH for USDT")
- Asks which currencies support flash swap
- Asks about minimum/maximum swap amounts or limits
- Requests flash swap order history or specific order details
- Uses keywords: "flash swap", "convert", "quick exchange", "swap", "instant swap"
当用户请求匹配以下任意场景时,将激活该Skill:
- 想要将一种加密货币兑换为另一种
- 想要用一种货币一次性购买多种加密货币(例如“用1u买入BTC、2u买入ETH”)
- 想要将多种加密货币卖出兑换为一种目标货币(例如“卖出1 BTC、2 ETH兑换为USDT”)
- 询问哪些货币支持闪兑
- 询问闪兑的最小/最大金额限制
- 请求查看闪兑订单历史或特定订单详情
- 使用关键词:“flash swap”、“convert”、“quick exchange”、“swap”、“instant swap”
Quick Start
快速开始
Common usage examples:
- One-to-one swap: "Sell 1 BTC for USDT"
- Buy multiple coins: "Buy 1u BTC, 2u ETH, 3u SOL"
- Sell multiple coins: "Sell 1 BTC, 2 ETH, 3 SOL for USDT"
- Check pairs: "Show me flash swap supported pairs"
- Order history: "Show me my flash swap orders"
常见使用示例:
- 一对一闪兑:“卖出1 BTC兑换为USDT”
- 一键购买多种币种:“买入1u BTC、2u ETH、3u SOL”
- 一键卖出多种币种:“卖出1 BTC、2 ETH、3 SOL兑换为USDT”
- 查询支持的交易对:“显示支持闪兑的交易对”
- 查看订单历史:“显示我的闪兑订单”
Domain Knowledge
领域知识
Flash Swap is a quick crypto exchange service provided by Gate. Users can instantly convert one cryptocurrency to another at the real-time exchange rate without placing orders and waiting for matching.
Swap Modes:
- One-to-One: Swap a single currency for another single currency (e.g. BTC → USDT)
- One-to-Many: Swap one currency into multiple target currencies (e.g. USDT → BTC + ETH + SOL)
- Many-to-One: Swap multiple currencies into one target currency (e.g. BTC + ETH + SOL → USDT)
Key Concepts:
- sell_asset / buy_asset: The currency symbols for the sell side and buy side
- sell_amount / buy_amount: Specify one of them; the API calculates the other. For one-to-many, use per target; for many-to-one, use
sell_amountper sourcesell_amount - quote_id: A unique identifier returned by the preview API, required for order creation. The exact validity period is indicated by in the response. Always check this field — do not assume a fixed duration
valid_timestamp - Order Status: = success,
1= failed2
API Field Naming:
- returns snake_case fields:
cex_fc_list_fc_currency_pairs,sell_min_amount,sell_max_amount,buy_min_amount,buy_max_amount,currency_pair,sell_currencybuy_currency - and multi-currency preview APIs return camelCase fields in some environments (e.g.
cex_fc_preview_fc_order_v1). Always read the actual field names from the response — do not assume a fixed naming conventionsellMinAmount - and
cex_fc_list_fc_ordersreturn snake_case:cex_fc_get_fc_order,sell_currency,buy_currency,sell_amount,buy_amountcreate_time
Data type note: is returned as a string in API responses. is also a string.
order_idquote_idMCP Tool Inventory:
| Tool | Type | Description |
|---|---|---|
| Preview | One-to-one swap quote preview |
| Create | One-to-one swap order creation (requires |
| Preview | One-to-many swap quote preview |
| Create | One-to-many swap order creation |
| Preview | Many-to-one swap quote preview |
| Create | Many-to-one swap order creation |
| Query | List supported flash swap pairs and limits |
| Query | Query flash swap order history |
| Query | Query single flash swap order by ID |
Flash Swap 是Gate提供的一种快速加密货币兑换服务。用户可以按照实时汇率即时将一种加密货币转换为另一种,无需下单等待撮合。
闪兑模式:
- 一对一:将单一货币兑换为另一种单一货币(例如 BTC → USDT)
- 一对多:将一种货币兑换为多种目标货币(例如 USDT → BTC + ETH + SOL)
- 多对一:将多种货币兑换为一种目标货币(例如 BTC + ETH + SOL → USDT)
核心概念:
- sell_asset / buy_asset:卖出和买入的货币符号
- sell_amount / buy_amount:二者指定其一即可,由API计算另一值。对于一对多模式,为每个目标币种指定;对于多对一模式,为每个源币种指定
sell_amountsell_amount - quote_id:预览API返回的唯一标识符,是创建订单的必填项。其确切有效期由响应中的字段指示,请务必检查该字段,不要假设固定时长
valid_timestamp - 订单状态:= 成功,
1= 失败2
API字段命名:
- 返回蛇形命名字段:
cex_fc_list_fc_currency_pairs、sell_min_amount、sell_max_amount、buy_min_amount、buy_max_amount、currency_pair、sell_currencybuy_currency - 和多币种预览API在部分环境中返回驼峰命名字段(例如
cex_fc_preview_fc_order_v1)。请始终以响应中的实际字段名为准,不要假设固定命名规则sellMinAmount - 和
cex_fc_list_fc_orders返回蛇形命名字段:cex_fc_get_fc_order、sell_currency、buy_currency、sell_amount、buy_amountcreate_time
数据类型说明:API响应中以字符串形式返回,同样为字符串类型。
order_idquote_idMCP工具清单:
| 工具 | 类型 | 描述 |
|---|---|---|
| 预览 | 一对一闪兑报价预览 |
| 创建 | 一对一闪兑订单创建(需要 |
| 预览 | 一对多闪兑报价预览 |
| 创建 | 一对多闪兑订单创建 |
| 预览 | 多对一闪兑报价预览 |
| 创建 | 多对一闪兑订单创建 |
| 查询 | 列出支持的闪兑交易对及限额 |
| 查询 | 查询闪兑订单历史 |
| 查询 | 通过ID查询单个闪兑订单 |
Workflow
工作流程
Step 1: Identify User Intent
步骤1:识别用户意图
Analyze the user's request to determine which flash swap operation to perform.
Intent classification:
| User Intent | Mode | Preview Tool | Create Tool |
|---|---|---|---|
| Swap one coin for another (e.g. "sell 1 BTC for USDT") | one-to-one | | |
| One-click swap without separate confirmation (e.g. "directly swap 100 USDT to GT") | one-to-one-auto | | — |
| Buy multiple coins with one currency (e.g. "buy 1u BTC, 2u ETH") | one-to-many | | |
| Split one currency into multiple by ratio (e.g. "split 1000 USDT, half BTC half ETH") | one-to-many-split | | |
| Buy specific quantities of multiple coins (e.g. "buy 0.1 BTC and 1 ETH with USDT") | one-to-many-buy | | |
| Sell multiple coins into one currency (e.g. "sell 1 BTC, 2 ETH for USDT") | many-to-one | | |
| Consolidate all holdings of certain coins into one (e.g. "convert all my BTC, ETH, DOGE to USDT") | many-to-one-all | | |
| Preview-only for multi-currency (e.g. "how much GT can I get for my BTC and ETH?") | many-to-one-preview | | — |
| Query supported flash swap pairs | query | | — |
| Query flash swap order list | query | | — |
| Query single flash swap order by ID | query | | — |
| Verify latest order result (e.g. "did my swap succeed?") | verify-order | | — |
Key data to extract:
- : "one_to_one" / "one_to_one_auto" / "one_to_many" / "one_to_many_split" / "one_to_many_buy" / "many_to_one" / "many_to_one_all" / "many_to_one_preview" / "list_pairs" / "list_orders" / "get_order" / "verify_order"
intent - /
sell_asset: currencies involvedbuy_asset - /
sell_amount: amounts specified by the userbuy_amount
分析用户请求,确定要执行的闪兑操作类型。
意图分类:
| 用户意图 | 模式 | 预览工具 | 创建工具 |
|---|---|---|---|
| 将一种币种兑换为另一种(例如“卖出1 BTC兑换为USDT”) | one-to-one | | |
| 无需单独确认的一键闪兑(例如“直接将100 USDT兑换为GT”) | one-to-one-auto | | — |
| 用一种货币购买多种币种(例如“买入1u BTC、2u ETH”) | one-to-many | | |
| 按比例将一种货币拆分兑换为多种(例如“将1000 USDT拆分,一半BTC一半ETH”) | one-to-many-split | | |
| 购买指定数量的多种币种(例如“用USDT买入0.1 BTC和1 ETH”) | one-to-many-buy | | |
| 将多种币种卖出兑换为一种货币(例如“卖出1 BTC、2 ETH兑换为USDT”) | many-to-one | | |
| 将持有的特定币种全部整合为一种(例如“将我所有的BTC、ETH、DOGE转换为USDT”) | many-to-one-all | | |
| 仅预览多币种兑换结果(例如“我的BTC和ETH能兑换多少GT?”) | many-to-one-preview | | — |
| 查询支持的闪兑交易对 | query | | — |
| 查询闪兑订单列表 | query | | — |
| 通过ID查询单个闪兑订单 | query | | — |
| 验证最新订单结果(例如“我的闪兑成功了吗?”) | verify-order | | — |
需要提取的关键数据:
- : "one_to_one" / "one_to_one_auto" / "one_to_many" / "one_to_many_split" / "one_to_many_buy" / "many_to_one" / "many_to_one_all" / "many_to_one_preview" / "list_pairs" / "list_orders" / "get_order" / "verify_order"
intent - /
sell_asset: 涉及的币种buy_asset - /
sell_amount: 用户指定的金额buy_amount
Step 2: Pre-validate Swap Amount (before any preview)
步骤2:预验证闪兑金额(预览前)
Before calling the preview API, validate the user's amount against the pair's min/max limits to avoid unnecessary API calls.
Call with:
cex_fc_list_fc_currency_pairs- : the sell_asset or buy_asset from the user's request
currency
Key data to extract:
- /
sell_min_amount: allowed range for the sell sidesell_max_amount - /
buy_min_amount: allowed range for the buy sidebuy_max_amount
Validation logic:
- If the user's <
sell_amount, inform them the amount is below the minimum and do NOT proceed to previewsell_min_amount - If the user's >
sell_amount, inform them the amount exceeds the maximumsell_max_amount - If the pair is not found, the currency is not supported for flash swap
Skip this step if the user explicitly requests "one-click" or "direct" swap to minimize latency.
在调用预览API之前,先根据交易对的最小/最大限额验证用户输入的金额,避免不必要的API调用。
调用,参数包括:
cex_fc_list_fc_currency_pairs- : 用户请求中的sell_asset或buy_asset
currency
需要提取的关键数据:
- /
sell_min_amount: 卖出侧允许的金额范围sell_max_amount - /
buy_min_amount: 买入侧允许的金额范围buy_max_amount
验证逻辑:
- 如果用户的<
sell_amount,告知用户金额低于最小值,不进行预览sell_min_amount - 如果用户的>
sell_amount,告知用户金额超过最大值sell_max_amount - 如果未找到对应交易对,说明该币种不支持闪兑
如果用户明确要求“一键”或“直接”闪兑,可跳过此步骤以减少延迟。
Step 3: Preview — One-to-One Swap (if intent = one_to_one or one_to_one_auto)
步骤3:预览 — 一对一闪兑(当意图为one_to_one或one_to_one_auto时)
Call with:
cex_fc_preview_fc_order_v1- (required, string): asset to sell, e.g. "BTC"
sell_asset - (required, string): asset to buy, e.g. "USDT"
buy_asset - (string): amount to sell. Choose one between
sell_amountandsell_amountbuy_amount - (string): amount to buy. Choose one between
buy_amountandsell_amountbuy_amount
Key data to extract:
- : required for creating the order
quote_id - /
sell_asset: confirmed sell sidesell_amount - /
buy_asset: calculated buy sidebuy_amount - : exchange rate
price - : quote expiry time
valid_timestamp
For one_to_one intent: Present the preview to the user and ask for confirmation before proceeding to create.
For one_to_one_auto intent: The user has pre-authorized the swap by explicitly requesting "direct" or "one-click" execution. Skip the separate confirmation prompt and immediately proceed to Step 4. This is compliant with the Safety Rules as the user's direct request serves as confirmation. However: if the preview returns any error (code != 0), do NOT proceed to Step 4 — report the error to the user immediately.
调用,参数包括:
cex_fc_preview_fc_order_v1- (必填,字符串): 要卖出的资产,例如"BTC"
sell_asset - (必填,字符串): 要买入的资产,例如"USDT"
buy_asset - (字符串): 卖出金额。
sell_amount和sell_amount二选一buy_amount - (字符串): 买入金额。
buy_amount和sell_amount二选一buy_amount
需要提取的关键数据:
- : 创建订单的必填项
quote_id - /
sell_asset: 确认的卖出侧信息sell_amount - /
buy_asset: 计算得出的买入侧信息buy_amount - : 兑换汇率
price - : 报价过期时间
valid_timestamp
对于one_to_one意图: 向用户展示预览结果,等待用户确认后再执行创建步骤。
对于one_to_one_auto意图: 用户明确要求“直接”或“一键”执行,即已预先授权闪兑。跳过单独的确认提示,直接进入步骤4。这符合安全规则,因为用户的直接请求可视为确认。但需注意: 如果预览返回错误(code != 0),请勿进入步骤4 — 立即向用户报告错误。
Step 4: Create — One-to-One Swap (after user confirms Step 3, or auto for one_to_one_auto)
步骤4:创建 — 一对一闪兑(用户确认步骤3后,或one_to_one_auto模式自动执行)
Pre-condition: Step 3 must have returned with a valid . If Step 3 failed (any ), do NOT execute this step. Never fabricate a .
code == 0quote_idcode != 0quote_idCall with body JSON string:
cex_fc_create_fc_order_v1- (required, string): from preview response — must be the actual value returned by the API
quote_id - (required, string): asset to sell
sell_asset - (required, string): amount to sell
sell_amount - (required, string): asset to buy
buy_asset - (required, string): amount to buy
buy_amount
Key data to extract:
- : created order ID
id - :
status= success,1= failed2 - /
sell_asset/sell_amount/buy_asset: confirmed amountsbuy_amount - : executed rate
price - : order creation timestamp
create_time - /
error.code: check for errors even when HTTP status is 200error.message
Order result verification: After creating, check the field:
status- If : Inform the user the swap succeeded, show the final
status == 1receivedbuy_amount - If : Inform the user the swap failed, suggest re-previewing and trying again
status == 2 - If : Report the specific error message to the user
error.code != 0
前置条件: 步骤3必须返回且包含有效的。如果步骤3失败(code != 0),请勿执行此步骤。绝对不要伪造。
code == 0quote_idquote_id调用,请求体JSON字符串包含:
cex_fc_create_fc_order_v1- (必填,字符串): 来自预览响应的实际值
quote_id - (必填,字符串): 要卖出的资产
sell_asset - (必填,字符串): 卖出金额
sell_amount - (必填,字符串): 要买入的资产
buy_asset - (必填,字符串): 买入金额
buy_amount
需要提取的关键数据:
- : 创建的订单ID
id - :
status= 成功,1= 失败2 - /
sell_asset/sell_amount/buy_asset: 确认的金额信息buy_amount - : 执行汇率
price - : 订单创建时间戳
create_time - /
error.code: 即使HTTP状态为200,也要检查是否存在错误error.message
订单结果验证: 创建完成后,检查字段:
status- 如果: 告知用户闪兑成功,展示最终收到的
status == 1buy_amount - 如果: 告知用户闪兑失败,建议重新预览后重试
status == 2 - 如果: 向用户报告具体错误信息
error.code != 0
Step 5: Preview — One-to-Many Swap (if intent = one_to_many, one_to_many_split, or one_to_many_buy)
步骤5:预览 — 一对多闪兑(当意图为one_to_many、one_to_many_split或one_to_many_buy时)
For one_to_many_split: The user specifies a total amount and a distribution ratio (e.g. "split 1000 USDT, half BTC half ETH"). Calculate the per-target before calling the API.
sell_amountFor one_to_many_buy: The user specifies target per currency (e.g. "buy 0.1 BTC and 1 ETH"). Use the field instead of in the params array to let the API calculate the required sell amount.
buy_amountbuy_amountsell_amountCall with body JSON string:
cex_fc_preview_fc_multi_currency_one_to_many_order- (required, array): each element contains:
params- (required, string): source currency (same for all, e.g. "USDT")
sell_asset - (string): amount of source currency to spend on this target
sell_amount - (required, string): target currency (e.g. "BTC", "ETH")
buy_asset - (string): alternative to sell_amount
buy_amount
Key data to extract:
- : array of preview results, each containing
orders[],quote_id,sell_amount,buy_amount, andpriceerror - : total amount of source currency consumed
total_consume_amount - Check each order's — if non-zero, that item failed to get a quote
error.code
Present the full preview table and highlight any failed items. Ask for confirmation.
对于one_to_many_split: 用户指定总金额和分配比例(例如“将1000 USDT拆分,一半BTC一半ETH”)。在调用API前计算每个目标币种的。
sell_amount对于one_to_many_buy: 用户指定每个币种的目标(例如“买入0.1 BTC和1 ETH”)。在参数数组中使用字段,由API计算所需的卖出金额。
buy_amountbuy_amount调用,请求体JSON字符串包含:
cex_fc_preview_fc_multi_currency_one_to_many_order- (必填,数组): 每个元素包含:
params- (必填,字符串): 源币种(所有元素相同,例如"USDT")
sell_asset - (字符串): 用于该目标币种的源币种金额
sell_amount - (必填,字符串): 目标币种(例如"BTC"、"ETH")
buy_asset - (字符串):
buy_amount的替代项sell_amount
需要提取的关键数据:
- : 预览结果数组,每个元素包含
orders[]、quote_id、sell_amount、buy_amount和priceerror - : 消耗的源币种总金额
total_consume_amount - 检查每个订单的— 非0表示该项目获取报价失败
error.code
向用户展示完整的预览表格,并高亮失败项目,等待用户确认。
Step 6: Create — One-to-Many Swap (after user confirms Step 5)
步骤6:创建 — 一对多闪兑(用户确认步骤5后)
Important: Exclude any items that failed in preview (where or is missing).
error.code != 0quote_idCall with body JSON string:
cex_fc_create_fc_multi_currency_one_to_many_order- (required, array): each element contains:
params- (required, string): source currency
sell_asset - (required, string): amount to sell
sell_amount - (required, string): target currency
buy_asset - (required, string): amount to buy (from preview)
buy_amount - (string): from preview response
quote_id
Key data to extract:
- : array of created orders, each with
orders[],id,statuserror - : actual total consumed
total_consume_amount - Check each order's for per-item failures
error.code
重要提示: 排除所有预览失败的项目(或缺少的项目)。
error.code != 0quote_id调用,请求体JSON字符串包含:
cex_fc_create_fc_multi_currency_one_to_many_order- (必填,数组): 每个元素包含:
params- (必填,字符串): 源币种
sell_asset - (必填,字符串): 卖出金额
sell_amount - (必填,字符串): 目标币种
buy_asset - (必填,字符串): 买入金额(来自预览结果)
buy_amount - (字符串): 来自预览响应
quote_id
需要提取的关键数据:
- : 创建的订单数组,每个元素包含
orders[]、id、statuserror - : 实际消耗的总金额
total_consume_amount - 检查每个订单的,查看是否有项目失败
error.code
Step 7: Preview — Many-to-One Swap (if intent = many_to_one, many_to_one_all, or many_to_one_preview)
步骤7:预览 — 多对一闪兑(当意图为many_to_one、many_to_one_all或many_to_one_preview时)
For many_to_one_all: The user wants to consolidate all holdings of specified currencies. Before previewing, query the user's spot account balances to determine the actual amount for each currency. Filter out currencies whose balance is below the flash swap minimum amount ( from ).
sell_min_amountcex_fc_list_fc_currency_pairsCall with body JSON string:
cex_fc_preview_fc_multi_currency_many_to_one_order- (required, array): each element contains:
params- (required, string): source currency (e.g. "BTC", "ETH")
sell_asset - (string): amount to sell
sell_amount - (required, string): target currency (same for all, e.g. "USDT")
buy_asset - (string): alternative to sell_amount
buy_amount
Key data to extract:
- : array of preview results with
orders[],quote_id,sell_amount,buy_amount,priceerror - : total amount of target currency to receive
total_acquire_amount - Check each order's — non-zero means that item failed
error.code
Present the full preview table and highlight any failed items.
For many_to_one_preview: Present the total expected (sum of all successful items) and do NOT proceed to create. Inform the user this is a preview only.
buy_amountFor many_to_one and many_to_one_all: Ask for user confirmation before proceeding to create.
对于many_to_one_all: 用户想要将持有的特定币种全部整合为一种。在预览前,先查询用户的现货账户余额,确定每个币种的实际金额。过滤掉余额低于闪兑最低金额(来自的)的币种。
cex_fc_list_fc_currency_pairssell_min_amount调用,请求体JSON字符串包含:
cex_fc_preview_fc_multi_currency_many_to_one_order- (必填,数组): 每个元素包含:
params- (必填,字符串): 源币种(例如"BTC"、"ETH")
sell_asset - (字符串): 卖出金额
sell_amount - (必填,字符串): 目标币种(所有元素相同,例如"USDT")
buy_asset - (字符串):
buy_amount的替代项sell_amount
需要提取的关键数据:
- : 预览结果数组,包含
orders[]、quote_id、sell_amount、buy_amount、priceerror - : 预计收到的目标币种总金额
total_acquire_amount - 检查每个订单的— 非0表示该项目失败
error.code
向用户展示完整的预览表格,并高亮失败项目。
对于many_to_one_preview: 展示预计收到的总(所有成功项目的总和),不执行创建操作,告知用户这仅为预览结果。
buy_amount对于many_to_one和many_to_one_all: 等待用户确认后再执行创建步骤。
Step 8: Create — Many-to-One Swap (after user confirms Step 7)
步骤8:创建 — 多对一闪兑(用户确认步骤7后)
Important: Exclude any items that failed in preview. Including a failed item (e.g. ) will cause the entire request to be rejected with .
buy_amount: "0"code: 4Call with body JSON string:
cex_fc_create_fc_multi_currency_many_to_one_order- (required, array): each element contains:
params- (required, string): source currency
sell_asset - (required, string): amount to sell
sell_amount - (required, string): target currency
buy_asset - (required, string): amount to buy (from preview)
buy_amount - (string): from preview response
quote_id
Key data to extract:
- : array of created orders with
orders[],id,statuserror - : actual total received
total_acquire_amount
重要提示: 排除所有预览失败的项目。如果包含失败项目(例如),会导致整个请求被拒绝,返回。
buy_amount: "0"code: 4调用,请求体JSON字符串包含:
cex_fc_create_fc_multi_currency_many_to_one_order- (必填,数组): 每个元素包含:
params- (必填,字符串): 源币种
sell_asset - (必填,字符串): 卖出金额
sell_amount - (必填,字符串): 目标币种
buy_asset - (必填,字符串): 买入金额(来自预览结果)
buy_amount - (字符串): 来自预览响应
quote_id
需要提取的关键数据:
- : 创建的订单数组,包含
orders[]、id、statuserror - : 实际收到的总金额
total_acquire_amount
Step 9: Query Flash Swap Pairs (if intent = list_pairs)
步骤9:查询闪兑交易对(当意图为list_pairs时)
Call with:
cex_fc_list_fc_currency_pairs- (optional, string): filter by currency symbol
currency - (optional, number): max items returned (default 1000)
limit - (optional, number): page number
page
Large result set warning: Without a currency filter, this may return thousands of rows. Summarize the total count, show a sample of 20 pairs, and suggest filtering by currency.
Key data to extract:
- : list of currency pairs with
items[],currency_pair,sell_currency,buy_currency,sell_min_amount,sell_max_amount,buy_min_amountbuy_max_amount
调用,参数包括:
cex_fc_list_fc_currency_pairs- (可选,字符串): 按币种符号过滤
currency - (可选,数字): 最大返回数量(默认1000)
limit - (可选,数字): 页码
page
大数据集警告: 如果不设置币种过滤,可能返回数千条结果。请汇总总数,展示20个示例,并建议用户按币种过滤。
需要提取的关键数据:
- : 交易对列表,包含
items[]、currency_pair、sell_currency、buy_currency、sell_min_amount、sell_max_amount、buy_min_amountbuy_max_amount
Step 10: Query Flash Swap Order History (if intent = list_orders)
步骤10:查询闪兑订单历史(当意图为list_orders时)
Before calling, validate the parameter if provided. Only (success) and (failed) are valid.
status12Call with:
cex_fc_list_fc_orders- (optional, number):
status= success,1= failed2 - (optional, string): filter by sell currency
sell_currency - (optional, string): filter by buy currency
buy_currency - (optional, number): max records
limit - (optional, number): page number
page - (optional, boolean):
reversefor newest first (default)true
Key data to extract:
- Order list with ,
id,sell_currency,buy_currency,sell_amount,buy_amount,price,statuscreate_time
调用前,如果用户提供了参数,需先验证。仅(成功)和(失败)为有效值。
status12调用,参数包括:
cex_fc_list_fc_orders- (可选,数字):
status= 成功,1= 失败2 - (可选,字符串): 按卖出币种过滤
sell_currency - (可选,字符串): 按买入币种过滤
buy_currency - (可选,数字): 最大记录数
limit - (可选,数字): 页码
page - (可选,布尔值):
reverse表示按最新优先排序(默认)true
需要提取的关键数据:
- 订单列表,包含、
id、sell_currency、buy_currency、sell_amount、buy_amount、price、statuscreate_time
Step 11: Query Single Order (if intent = get_order or verify_order)
步骤11:查询单个订单(当意图为get_order或verify_order时)
Call with:
cex_fc_get_fc_order- (required, number): the order ID to query
order_id
If the API returns 404, inform the user the order was not found.
For verify_order: After retrieving the order, check :
status- If : Confirm the swap succeeded, show the final
status == 1actually receivedbuy_amount - If : Inform the user the swap failed, suggest re-previewing and placing a new order
status == 2
Key data to extract:
- Full order details: ,
id,sell_currency,buy_currency,sell_amount,buy_amount,price,statuscreate_time
调用,参数包括:
cex_fc_get_fc_order- (必填,数字): 要查询的订单ID
order_id
如果API返回404,告知用户未找到该订单。
对于verify_order: 查询订单后,检查:
status- 如果: 确认闪兑成功,展示最终实际收到的
status == 1buy_amount - 如果: 告知用户闪兑失败,建议重新预览后下单
status == 2
需要提取的关键数据:
- 完整订单详情: 、
id、sell_currency、buy_currency、sell_amount、buy_amount、price、statuscreate_time
Step 12: Format and Present Results
步骤12:格式化并展示结果
Format results using the appropriate Report Template. For swap operations, always show:
- Preview summary table with quote details
- After creation, show order IDs, status, and any per-item errors
使用对应的报告模板格式化结果。对于闪兑操作,需始终展示:
- 包含报价详情的预览汇总表格
- 创建完成后,展示订单ID、状态以及每个项目的错误信息
Error Handling
错误处理
| Error Scenario | Handling |
|---|---|
| Region/compliance restriction (code -2) | CRITICAL: The API returns |
| Preview failed (any non-zero code) | CRITICAL: If the preview API returns any |
| Amount below minimum (sell_amount < sell_min_amount) | Query |
| Amount above maximum (sell_amount > sell_max_amount) | Inform the user the amount exceeds the maximum allowed, show the limit |
| Quote expired (code 1052) | The |
| Unable to get accurate quote (code 4 / 400001 / 400007) | These are quote-related errors from the server. |
| Multi-currency create: entire request rejected (code 4) | Likely caused by including a preview-failed item with |
| Order status == 2 (failed) | Inform the user the swap failed. Suggest re-previewing with adjusted parameters and trying again |
| Order not found (404) | The |
| MCP service connection failure | Prompt user to check network or VPN, suggest retrying later |
| order_id not provided | Prompt user to provide an order ID, or use the order list query first |
| Empty query results | Inform user no data was found, suggest adjusting filters |
| Currency not supported | Inform user that the specified currency is not available for flash swap |
| Invalid status value | Status only accepts |
| Large result set (thousands of rows) | Summarize total count, show sample of 20, suggest filtering by currency |
| Balance below minimum for many_to_one_all | When consolidating all holdings, skip currencies whose balance < sell_min_amount and inform the user which were excluded |
| 错误场景 | 处理方式 |
|---|---|
| 区域/合规限制(code -2) | 严重: API返回 |
| 预览失败(任何非0 code) | 严重: 如果预览API返回任何 |
| 金额低于最小值(sell_amount < sell_min_amount) | 先调用 |
| 金额超过最大值(sell_amount > sell_max_amount) | 告知用户金额超过允许的最大值,展示限额 |
| 报价过期(code 1052) | |
| 无法获取准确报价(code 4 / 400001 / 400007) | 这些是服务器返回的报价相关错误。 |
| 多币种创建请求被整体拒绝(code 4) | 可能因包含预览失败的项目(例如 |
| 订单状态 == 2(失败) | 告知用户闪兑失败,建议调整参数后重新预览并尝试 |
| 订单未找到(404) | |
| MCP服务连接失败 | 提示用户检查网络或VPN,建议稍后重试 |
| 未提供order_id | 提示用户提供订单ID,或先查询订单列表 |
| 查询结果为空 | 告知用户未找到数据,建议调整过滤条件 |
| 币种不支持 | 告知用户指定币种不支持闪兑 |
| 无效的status值 | status仅接受 |
| 大数据集(数千条结果) | 汇总总数,展示20个示例,建议用户按币种过滤 |
| many_to_one_all模式下余额低于最小值 | 整合所有持仓时,跳过余额 < sell_min_amount的币种,并告知用户哪些币种被排除 |
Safety Rules
安全规则
- NEVER fabricate results: If any API call returns an error (code != 0), you MUST report the actual error to the user. NEVER fabricate a successful response, fake order ID, fake quote_id, or fake transaction result. This is the most critical safety rule
- NEVER proceed after preview failure: If the preview API returns any error (code != 0, including code -2 for region restriction), you MUST stop immediately. Do NOT call the create API. Do NOT invent a quote_id (e.g. "AUTO-GT-001"). Report the error honestly
- Always preview before creating: Every swap must go through the preview step first. For standard flows, show the quote to the user and wait for explicit confirmation before calling the create API. For mode only: the user has explicitly requested a direct swap (e.g. "directly swap", "one-click"), which counts as pre-authorized confirmation — proceed to create immediately after preview without a separate confirmation prompt
one_to_one_auto - No write operations without confirmation: Never call any create/order API unless (a) the user has explicitly confirmed the preview result, or (b) the user explicitly requested a one-click/direct swap. Query operations (list pairs, list orders, get order) do not require confirmation
- Exclude failed preview items: When creating multi-currency orders, only include items that succeeded in preview ()
error.code == 0 - Do not expose sensitive info: Never output API Key, Secret, or authentication tokens
- Display amounts as-is: Do not round or modify amounts from API responses
- Warn on large amounts: If the total swap amount exceeds 10,000 USDT equivalent, remind the user to double-check
- Stale confirmation handling: If the user confirms a previous preview, check whether the current time has exceeded the from that preview response. If expired, automatically re-preview to get a fresh quote before creating
valid_timestamp
- 绝对不要伪造结果: 如果任何API调用返回错误(code != 0),必须向用户报告实际错误。绝对不要伪造成功响应、虚假订单ID、虚假quote_id或虚假交易结果。这是最关键的安全规则
- 预览失败后绝对不要继续: 如果预览API返回任何错误(code != 0,包括区域限制的code -2),必须立即停止。不要调用创建API。不要编造quote_id(例如“AUTO-GT-001”)。如实报告错误
- 创建前必须预览: 所有闪兑操作必须先经过预览步骤。对于标准流程,向用户展示报价并等待明确确认后再调用创建API。仅模式例外:用户明确要求一键/直接闪兑,这视为预先授权确认 — 预览后直接执行创建,无需单独确认提示
one_to_one_auto - 无确认不执行写入操作: 除非(a)用户已明确确认预览结果,或(b)用户明确要求一键/直接闪兑,否则不要调用任何创建/订单API。查询操作(列出交易对、订单列表、查询单个订单)无需确认
- 排除预览失败的项目: 创建多币种订单时,仅包含预览成功的项目()
error.code == 0 - 不要暴露敏感信息: 绝对不要输出API Key、Secret或认证令牌
- 按原样展示金额: 不要对API返回的金额进行四舍五入或修改
- 大额提醒: 如果闪兑总金额超过10000 USDT等值,提醒用户再次核对
- 过期确认处理: 如果用户确认了之前的预览结果,检查当前时间是否超过该预览响应中的。如果已过期,自动重新预览获取新报价后再创建订单
valid_timestamp
Judgment Logic Summary
判断逻辑汇总
| Condition | Action | Tool |
|---|---|---|
| User wants to swap one coin for another | Preview one-to-one, then create after confirmation | |
| User says "directly" or "one-click" swap | Preview + create automatically without separate confirmation | |
| User references a previous quote_id for confirmation | Create order using the referenced quote_id | |
| Swap amount is suspiciously small | Pre-validate against pair min amount before preview | |
| User wants to buy multiple coins with one currency | Preview one-to-many, then create | |
| User wants to split one currency by ratio (e.g. "half and half") | Calculate per-target sell_amount, then preview one-to-many | |
| User specifies buy quantities (e.g. "buy 0.1 BTC and 1 ETH") | Use buy_amount in params, preview one-to-many | |
| User wants to sell multiple coins into one currency | Preview many-to-one, then create | |
| User wants to consolidate "all" of certain holdings | Query balances, filter by min amounts, preview many-to-one, then create | |
| User asks "how much can I get" without wanting to execute | Preview-only many-to-one, sum buy_amounts, do NOT create | |
Preview returns items with | Warn user, exclude failed items before creating | — |
| Preview returns code -2 (region restriction) | STOP immediately. Do NOT create. Inform user flash swap is not available in their region | — |
| Preview returns any non-zero code | STOP. Do NOT create. Do NOT fabricate quote_id. Report exact error to user | — |
| Create returns code 1052 (quote expired) | Re-run preview to get fresh quote | Preview tool |
| Create returns per-item error (400001/400007) | Report which items failed, suggest adjusting amounts | — |
| Multi-currency create rejected with code 4 | Remove failed preview items and retry | Create tool |
| Order status == 2 after create | Inform user swap failed, suggest retrying | — |
| User asks "did my swap succeed?" | Query order by ID, check status field | |
| User asks about supported pairs or limits | Query pair list | |
| User queries order history | Query order list | |
| User queries specific order by ID | Query single order | |
| Order not found (404) | Inform user, suggest checking ID | — |
| User provides invalid status filter | Reject and inform valid values are 1 or 2 | — |
| 条件 | 操作 | 工具 |
|---|---|---|
| 用户想要将一种币种兑换为另一种 | 预览一对一闪兑,用户确认后创建 | |
| 用户要求“直接”或“一键”闪兑 | 预览后自动创建,无需单独确认 | |
| 用户引用之前的quote_id进行确认 | 使用该quote_id创建订单 | |
| 闪兑金额异常小 | 预览前先通过交易对查询验证金额 | |
| 用户想用一种货币购买多种币种 | 预览一对多闪兑,用户确认后创建 | |
| 用户要求按比例拆分兑换(例如“各一半”) | 计算每个目标币种的sell_amount,然后预览一对多闪兑 | |
| 用户指定买入数量(例如“买入0.1 BTC和1 ETH”) | 在参数中使用buy_amount,预览一对多闪兑 | |
| 用户想要将多种币种卖出兑换为一种 | 预览多对一闪兑,用户确认后创建 | |
| 用户想要将特定币种的所有持仓整合为一种 | 查询余额,过滤低于最小值的币种,预览多对一闪兑,用户确认后创建 | |
| 用户询问“能兑换多少”但不想执行 | 仅预览多对一闪兑,汇总buy_amount,不创建 | |
| 预览返回error.code != 0的项目 | 提醒用户,创建时排除失败项目 | — |
| 预览返回code -2(区域限制) | 立即停止。不执行创建。告知用户所在区域不支持闪兑 | — |
| 预览返回任何非0 code | 停止操作。不执行创建。不伪造quote_id。向用户报告确切错误 | — |
| 创建返回code 1052(报价过期) | 重新预览获取新报价 | 预览工具 |
| 创建返回项目级错误(400001/400007) | 报告哪些项目失败,建议调整金额 | — |
| 多币种创建被code 4拒绝 | 移除预览失败的项目后重试 | 创建工具 |
| 创建后订单状态 == 2 | 告知用户闪兑失败,建议重试 | — |
| 用户询问“我的闪兑成功了吗?” | 通过ID查询订单,检查状态字段 | |
| 用户询问支持的交易对或限额 | 查询交易对列表 | |
| 用户查询订单历史 | 查询订单列表 | |
| 用户通过ID查询特定订单 | 查询单个订单 | |
| 订单未找到(404) | 告知用户,建议检查ID | — |
| 用户提供无效的status过滤条件 | 拒绝并告知有效值为1或2 | — |
Report Template
报告模板
Timestamp format: All placeholders use ISO 8601 format: .
{timestamp}YYYY-MM-DD HH:mm:ss UTC时间戳格式: 所有占位符使用ISO 8601格式:。
{timestamp}YYYY-MM-DD HH:mm:ss UTCOne-to-One Preview Report
一对一预览报告
markdown
undefinedmarkdown
undefinedFlash Swap Preview (One-to-One)
闪兑预览(一对一)
Quote ID: {quote_id}
Valid Until: {valid_timestamp}
| Sell | Amount | Buy | Amount | Rate |
|---|---|---|---|---|
| {sell_asset} | {sell_amount} | {buy_asset} | {buy_amount} | {price} |
Proceed with this swap? (Yes/No)
undefined报价ID: {quote_id}
有效截止时间: {valid_timestamp}
| 卖出币种 | 金额 | 买入币种 | 金额 | 汇率 |
|---|---|---|---|---|
| {sell_asset} | {sell_amount} | {buy_asset} | {buy_amount} | {price} |
是否确认执行该闪兑?(是/否)
undefinedOne-to-One Order Report
一对一订单报告
markdown
undefinedmarkdown
undefinedFlash Swap Order Created
闪兑订单已创建
Order ID: {id}
Status: {status_text}
Created At: {create_time}
| Sell | Amount | Buy | Amount | Rate |
|---|---|---|---|---|
| {sell_asset} | {sell_amount} | {buy_asset} | {buy_amount} | {price} |
undefined订单ID: {id}
状态: {status_text}
创建时间: {create_time}
| 卖出币种 | 金额 | 买入币种 | 金额 | 汇率 |
|---|---|---|---|---|
| {sell_asset} | {sell_amount} | {buy_asset} | {buy_amount} | {price} |
undefinedMulti-Currency Preview Report (One-to-Many / Many-to-One)
多币种预览报告(一对多 / 多对一)
markdown
undefinedmarkdown
undefinedFlash Swap Preview ({mode})
闪兑预览({mode})
Total {direction}: {total_amount} {currency}
| # | Sell | Sell Amount | Buy | Buy Amount | Rate | Quote ID | Status |
|---|---|---|---|---|---|---|---|
| {n} | {sell_asset} | {sell_amount} | {buy_asset} | {buy_amount} | {price} | {quote_id} | {status} |
{failed_count} item(s) failed to get a quote and will be excluded from the order.
Proceed with {success_count} successful item(s)? (Yes/No)
undefined总{direction}: {total_amount} {currency}
| 序号 | 卖出币种 | 卖出金额 | 买入币种 | 买入金额 | 汇率 | 报价ID | 状态 |
|---|---|---|---|---|---|---|---|
| {n} | {sell_asset} | {sell_amount} | {buy_asset} | {buy_amount} | {price} | {quote_id} | {status} |
有{failed_count}个项目获取报价失败,将被排除在订单外。
是否确认执行{success_count}个成功项目的闪兑?(是/否)
undefinedMulti-Currency Order Report
多币种订单报告
markdown
undefinedmarkdown
undefinedFlash Swap Orders Created ({mode})
闪兑订单已创建({mode})
Total {direction}: {total_amount} {currency}
| # | Order ID | Sell | Sell Amount | Buy | Buy Amount | Status | Error |
|---|---|---|---|---|---|---|---|
| {n} | {id} | {sell_asset} | {sell_amount} | {buy_asset} | {buy_amount} | {status_text} | {error_message} |
{success_count}/{total_count} orders succeeded.
undefined总{direction}: {total_amount} {currency}
| 序号 | 订单ID | 卖出币种 | 卖出金额 | 买入币种 | 买入金额 | 状态 | 错误信息 |
|---|---|---|---|---|---|---|---|
| {n} | {id} | {sell_asset} | {sell_amount} | {buy_asset} | {buy_amount} | {status_text} | {error_message} |
{success_count}/{total_count}个订单执行成功。
undefinedPair List Report
交易对列表报告
markdown
undefinedmarkdown
undefinedGate Flash Swap Supported Pairs
Gate Flash Swap 支持的交易对
Query Time: {timestamp}
Filter: {currency filter or "None"}
| Pair | Sell Currency | Buy Currency | Sell Min | Sell Max |
|---|---|---|---|---|
| {currency_pair} | {sell_currency} | {buy_currency} | {sell_min_amount} | {sell_max_amount} |
Total: {total} pairs.
undefined查询时间: {timestamp}
过滤条件: {currency filter or "无"}
| 交易对 | 卖出币种 | 买入币种 | 最小卖出金额 | 最大卖出金额 |
|---|---|---|---|---|
| {currency_pair} | {sell_currency} | {buy_currency} | {sell_min_amount} | {sell_max_amount} |
总计: {total}个交易对。
undefinedOrder List Report
订单列表报告
markdown
undefinedmarkdown
undefinedGate Flash Swap Order History
Gate Flash Swap 订单历史
Query Time: {timestamp}
Filters: Status={status}, Sell={sell_currency}, Buy={buy_currency}
| Order ID | Sell | Sell Amount | Buy | Buy Amount | Status | Created At |
|---|---|---|---|---|---|---|
| {id} | {sell_currency} | {sell_amount} | {buy_currency} | {buy_amount} | {status_text} | {create_time} |
Total: {total} records.
undefined查询时间: {timestamp}
过滤条件: 状态={status}, 卖出币种={sell_currency}, 买入币种={buy_currency}
| 订单ID | 卖出币种 | 卖出金额 | 买入币种 | 买入金额 | 状态 | 创建时间 |
|---|---|---|---|---|---|---|
| {id} | {sell_currency} | {sell_amount} | {buy_currency} | {buy_amount} | {status_text} | {create_time} |
总计: {total}条记录。
undefinedOrder Detail Report
订单详情报告
markdown
undefinedmarkdown
undefinedGate Flash Swap Order Details
Gate Flash Swap 订单详情
| Field | Value |
|---|---|
| Order ID | {id} |
| Sell Currency | {sell_currency} |
| Sell Amount | {sell_amount} |
| Buy Currency | {buy_currency} |
| Buy Amount | {buy_amount} |
| Exchange Rate | {price} |
| Status | {status_text} |
| Created At | {create_time} |
undefined| 字段 | 值 |
|---|---|
| 订单ID | {id} |
| 卖出币种 | {sell_currency} |
| 卖出金额 | {sell_amount} |
| 买入币种 | {buy_currency} |
| 买入金额 | {buy_amount} |
| 兑换汇率 | {price} |
| 状态 | {status_text} |
| 创建时间 | {create_time} |
undefined