crypto-com-app
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill: crypto-com-app
Skill: crypto-com-app
Agent Capability Requirements
Agent能力要求
This skill requires your agent platform to support the following capabilities. If your platform lacks any required capability, the skill will not function.
| Capability | Required | Details |
|---|---|---|
| Shell command execution | Yes | Must be able to run |
| Environment variables | Yes | Must read |
| JSON parsing | Yes | Must parse structured JSON from script stdout to extract fields |
| Multi-turn conversation | Yes | Trading uses a quote → confirm flow that spans multiple user turns |
| Persistent memory | No | Used for |
| Elapsed-time awareness | No | Used to check quote expiry ( |
本Skill要求你的Agent平台支持以下能力。若你的平台缺少任何必需能力,本Skill将无法正常运行。
| 能力 | 是否必需 | 详情 |
|---|---|---|
| Shell命令执行 | 是 | 必须能够运行 |
| 环境变量 | 是 | 必须从Shell环境中读取 |
| JSON解析 | 是 | 必须解析脚本标准输出中的结构化JSON以提取字段 |
| 多轮对话 | 是 | 交易采用报价→确认的流程,需跨越多轮用户对话 |
| 持久化内存 | 否 | 用于 |
| 时间感知 | 否 | 用于检查报价过期时间( |
CRITICAL: How This Skill Works
重要提示:本Skill的工作方式
You MUST use the TypeScript scripts for ALL API interactions. NEVER call the API directly with , , or any other HTTP method.
curlfetchThe scripts handle request signing, error handling, and response formatting. If you bypass them:
- The request will fail (missing HMAC signature)
- The response won't be filtered or structured
For every user request, find the matching command below and run it via . Read the JSON output. Act on it.
npx tsx所有API交互必须通过TypeScript脚本进行。严禁使用、或其他任何HTTP方法直接调用API。
curlfetch脚本会处理请求签名、错误处理和响应格式化。如果绕过脚本:
- 请求会失败(缺少HMAC签名)
- 响应不会被过滤或结构化
对于每个用户请求,找到下面匹配的命令并通过运行。读取JSON输出后执行相应操作。
npx tsxConfigurations
配置项
- BASE_URL:
https://wapi.crypto.com - CDC_API_KEY:
{{env.CDC_API_KEY}} - CDC_API_SECRET:
{{env.CDC_API_SECRET}} - CONFIRMATION_REQUIRED: (Default: true)
{{memory.confirmation_required}} - SKILL_DIR: The directory containing this file. Resolve it from the path you loaded this file from (e.g. if you read
SKILL.md, then/home/user/skills/crypto-com-app/SKILL.mdisSKILL_DIR)./home/user/skills/crypto-com-app
- BASE_URL:
https://wapi.crypto.com - CDC_API_KEY:
{{env.CDC_API_KEY}} - CDC_API_SECRET:
{{env.CDC_API_SECRET}} - CONFIRMATION_REQUIRED: (默认值:true)
{{memory.confirmation_required}} - SKILL_DIR: 包含此文件的目录。从你加载本文件的路径中解析(例如,如果你读取的是
SKILL.md,那么/home/user/skills/crypto-com-app/SKILL.md为SKILL_DIR)。/home/user/skills/crypto-com-app
Environment Setup
环境设置
-
Bothand
CDC_API_KEYmust be set as environment variables before use.CDC_API_SECRET -
Before running any script, check whether both variables are set by running:bash
echo "CDC_API_KEY=${CDC_API_KEY:+set}" "CDC_API_SECRET=${CDC_API_SECRET:+set}"If either prints empty instead of, prompt the user:set"Your API credentials are not configured. Please set them in your terminal before I can proceed:export CDC_API_KEY="your-api-key" export CDC_API_SECRET="your-api-secret"You can generate an API key at https://help.crypto.com/en/articles/13843786-api-key-management. Let me know once you've set them."Then stop and wait for the user to confirm before retrying. -
If a script returns aerror, treat it the same way: prompt the user to set the variables and wait.
MISSING_ENV
-
使用前必须将和
CDC_API_KEY设置为环境变量。CDC_API_SECRET -
运行任何脚本前,通过运行以下命令检查两个变量是否已设置:bash
echo "CDC_API_KEY=${CDC_API_KEY:+set}" "CDC_API_SECRET=${CDC_API_SECRET:+set}"如果其中任何一个显示为空而非,请提示用户:set"你的API凭证未配置。请在终端中设置以下变量后再继续:export CDC_API_KEY="your-api-key" export CDC_API_SECRET="your-api-secret"然后停止操作并等待用户确认后再重试。 -
如果脚本返回错误,处理方式相同:提示用户设置变量并等待。
MISSING_ENV
Script Commands
脚本命令
ALL API interactions MUST go through these scripts. They handle signing, execution, filtering, and error formatting. Run the appropriate command below via shell, then parse the JSON output.
Prerequisite: (Node.js 18+ required; is fetched automatically by ).
npx tsxtsxnpxImportant: All script paths below use as a placeholder for this skill's root directory. Resolve it from the path you loaded this SKILL.md from, or into the skill directory and use as the path. Either approach works.
$SKILL_DIRcd./scripts/...**所有API交互必须通过这些脚本进行。**它们负责签名、执行、过滤和错误格式化。通过Shell运行下面相应的命令,然后解析JSON输出。
前置条件: (需要Node.js 18+;会由自动获取)。
npx tsxtsxnpx**注意:**以下所有脚本路径使用作为本Skill根目录的占位符。你可以从加载SKILL.md的路径中解析它,或者进入Skill目录后使用作为路径。两种方式均可。
$SKILL_DIR./scripts/...Account Commands
账户命令
bash
undefinedbash
undefinedFiltered non-zero balances (scope: fiat | crypto | all)
过滤后的非零余额(范围:法币 | 加密货币 | 全部)
npx tsx $SKILL_DIR/scripts/account.ts balances [fiat|crypto|all]
npx tsx $SKILL_DIR/scripts/account.ts balances [fiat|crypto|all]
Single token balance lookup
单个代币余额查询
npx tsx $SKILL_DIR/scripts/account.ts balance <SYMBOL>
npx tsx $SKILL_DIR/scripts/account.ts balance <SYMBOL>
Weekly trading limit
每周交易限额
npx tsx $SKILL_DIR/scripts/account.ts trading-limit
npx tsx $SKILL_DIR/scripts/account.ts trading-limit
Find funded source wallets for a trade type
查找可用于交易类型的已充值源钱包
npx tsx $SKILL_DIR/scripts/account.ts resolve-source <purchase|sale|exchange>
npx tsx $SKILL_DIR/scripts/account.ts resolve-source <purchase|sale|exchange>
Kill switch — revoke API key
紧急关停开关 — 撤销API密钥
npx tsx $SKILL_DIR/scripts/account.ts revoke-key
undefinednpx tsx $SKILL_DIR/scripts/account.ts revoke-key
undefinedTrade Commands
交易命令
Trading follows a two-step flow: get a quotation first, then confirm the order.
bash
undefined交易遵循两步流程:先获取报价,再确认订单。
bash
undefinedStep 1 — Get quotation (type: purchase | sale | exchange)
步骤1 — 获取报价(类型:purchase | sale | exchange)
npx tsx $SKILL_DIR/scripts/trade.ts quote <type> '<json-params>'
npx tsx $SKILL_DIR/scripts/trade.ts quote <type> '<json-params>'
Returns: {"ok": true, "data": {"id": "<quotation-id>", "from_amount": {...}, "to_amount": {...}, "countdown": 15, ...}}
返回结果:{"ok": true, "data": {"id": "<quotation-id>", "from_amount": {...}, "to_amount": {...}, "countdown": 15, ...}}
Step 2 — Confirm order: pass the data.id from Step 1 as <quotation-id>
步骤2 — 确认订单:将步骤1中的data.id作为<quotation-id>传入
npx tsx $SKILL_DIR/scripts/trade.ts confirm <type> <quotation-id>
npx tsx $SKILL_DIR/scripts/trade.ts confirm <type> <quotation-id>
View recent transactions
查看近期交易
npx tsx $SKILL_DIR/scripts/trade.ts history
**How to map user intent to trade type:**
| User says | Trade type | From | To |
|-----------|-----------|------|-----|
| "Buy CRO with 100 USD" | `purchase` | USD (fiat) | CRO (crypto) |
| "Sell 0.1 BTC" | `sale` | BTC (crypto) | USD (fiat) |
| "Swap 0.1 BTC to ETH" | `exchange` | BTC (crypto) | ETH (crypto) |
**Quotation JSON params by trade type:**
| Type | JSON fields |
|------|------------|
| purchase | `{"from_currency":"USD","to_currency":"CRO","from_amount":"100"}` or use `to_amount` instead |
| sale | `{"from_currency":"BTC","to_currency":"USD","from_amount":"0.1","fixed_side":"from"}` |
| exchange | `{"from_currency":"BTC","to_currency":"ETH","from_amount":"0.1","side":"buy"}` |
**Example — "Buy CRO with 100 USD":**
1. Run: `npx tsx $SKILL_DIR/scripts/trade.ts quote purchase '{"from_currency":"USD","to_currency":"CRO","from_amount":"100"}'`
2. Read `data.id`, `data.from_amount`, `data.to_amount`, `data.countdown` from the response.
3. **If confirmation required** (default): Ask user "Confirm: 100 USD for X CRO? Valid for {countdown}s. Reply 'YES' to proceed."
- If user says YES (within countdown): `npx tsx $SKILL_DIR/scripts/trade.ts confirm purchase <data.id>`
4. **If confirmation opted out** (`memory.confirmation_required` is `false`): Skip asking and immediately run `npx tsx $SKILL_DIR/scripts/trade.ts confirm purchase <data.id>`
**Opt-in / Opt-out:** Users can say "stop asking for confirmation" to auto-execute trades, or "require confirmation" to re-enable the prompt. See Section 3 below.npx tsx $SKILL_DIR/scripts/trade.ts history
**用户意图与交易类型的映射:**
| 用户表述 | 交易类型 | 转出 | 转入 |
|-----------|-----------|------|-----|
| "用100美元买入CRO" | `purchase` | 美元(法币) | CRO(加密货币) |
| "卖出0.1个BTC" | `sale` | BTC(加密货币) | 美元(法币) |
| "将0.1个BTC兑换为ETH" | `exchange` | BTC(加密货币) | ETH(加密货币) |
**各交易类型的报价JSON参数:**
| 类型 | JSON字段 |
|------|------------|
| purchase | `{"from_currency":"USD","to_currency":"CRO","from_amount":"100"}` 或使用`to_amount`替代 |
| sale | `{"from_currency":"BTC","to_currency":"USD","from_amount":"0.1","fixed_side":"from"}` |
| exchange | `{"from_currency":"BTC","to_currency":"ETH","from_amount":"0.1","side":"buy"}` |
**示例 — "用100美元买入CRO":**
1. 运行:`npx tsx $SKILL_DIR/scripts/trade.ts quote purchase '{"from_currency":"USD","to_currency":"CRO","from_amount":"100"}'`
2. 从响应中读取`data.id`、`data.from_amount`、`data.to_amount`、`data.countdown`。
3. **如果需要确认**(默认设置):询问用户“确认:用100美元兑换X个CRO?有效期{countdown}秒。回复'YES'继续。”
- 如果用户在倒计时内回复YES:运行`npx tsx $SKILL_DIR/scripts/trade.ts confirm purchase <data.id>`
4. **如果无需确认**(`memory.confirmation_required`为`false`):跳过询问,直接运行`npx tsx $SKILL_DIR/scripts/trade.ts confirm purchase <data.id>`
**开启/关闭确认:**用户可以说“停止要求确认”来自动执行交易,或说“需要确认”来重新启用提示。请查看下方第3节。Coin Discovery Commands
币种发现命令
bash
undefinedbash
undefinedSearch coins
搜索币种
npx tsx $SKILL_DIR/scripts/coins.ts search '{"keyword":"BTC","sort_by":"rank","sort_direction":"asc","native_currency":"USD","page_size":10}'
**Required JSON parameters:**
| Parameter | Type | Allowed values |
|-----------|------|----------------|
| `sort_by` | string | `rank`, `market_cap`, `alphabetical`, `volume`, `performance` |
| `sort_direction` | string | `asc`, `desc` |
| `native_currency` | string | Uppercase currency code (e.g. `USD`) |
| `keyword` | string | Search string, 1–100 chars; matches coin name and symbol only |
| `page_size` | integer | Number of results per page |
**Optional:** `page_token` — opaque token for fetching the next page (see pagination below).
**Pagination:** The response includes a `pagination` object with `has_more` (boolean) and `next_page_token` (string). When `has_more` is `true`, pass `next_page_token` as `page_token` in the next request to fetch the next page.
**Key response fields per coin:** `rails_id` (identical to `currency_id` / `currency` in trade and account APIs — use this to cross-reference), `price_native`, `price_usd`, `percent_change_*_native` (price performance over past timeframes, e.g. `percent_change_24h_native`).npx tsx $SKILL_DIR/scripts/coins.ts search '{"keyword":"BTC","sort_by":"rank","sort_direction":"asc","native_currency":"USD","page_size":10}'
**必需的JSON参数:**
| 参数 | 类型 | 允许值 |
|-----------|------|----------------|
| `sort_by` | 字符串 | `rank`, `market_cap`, `alphabetical`, `volume`, `performance` |
| `sort_direction` | 字符串 | `asc`, `desc` |
| `native_currency` | 字符串 | 大写货币代码(如`USD`) |
| `keyword` | 字符串 | 搜索字符串,1-100字符;仅匹配币种名称和符号 |
| `page_size` | 整数 | 每页结果数量 |
**可选参数:** `page_token` — 用于获取下一页的不透明令牌(见下方分页说明)。
**分页:**响应包含一个`pagination`对象,其中包含`has_more`(布尔值)和`next_page_token`(字符串)。当`has_more`为`true`时,将`next_page_token`作为`page_token`传入下一次请求以获取下一页。
**每个币种的关键响应字段:** `rails_id`(与交易和账户API中的`currency_id` / `currency`相同 — 用于交叉引用)、`price_native`、`price_usd`、`percent_change_*_native`(过去一段时间内的价格表现,如`percent_change_24h_native`)。Output Format
输出格式
Every script prints structured JSON to stdout:
Success:
json
{"ok": true, "data": { ... }}Error:
json
{"ok": false, "error": "ERROR_CODE", "error_message": "Human-readable message"}每个脚本都会向标准输出打印结构化JSON:
成功:
json
{"ok": true, "data": { ... }}错误:
json
{"ok": false, "error": "ERROR_CODE", "error_message": "易读错误信息"}Constraints
约束条件
- Validation: Success requires in the script output.
ok: true - Confirmation Window: Quote validity is defined by the field in the quotation data.
countdown - Execution Warning: If order confirmation takes > 5s, notify: "Order submitted but taking longer than expected. Check order status with 'Show recent trades'".
- Rate Limits:
- Max 10 trades per minute.
- Max 100 API calls per minute.
- On HTTP 429 (error): wait 60 seconds before retrying the same request. Inform the user: "Rate limit reached — please wait 60 seconds before trying again."
RATE_LIMITED
- 验证: 成功的标志是脚本输出中。
ok: true - 确认窗口: 报价有效期由报价数据中的字段定义。
countdown - 执行警告: 如果订单确认耗时超过5秒,通知用户:“订单已提交,但处理时间超出预期。可通过‘显示近期交易’查看订单状态。”
- 速率限制:
- 每分钟最多10笔交易。
- 每分钟最多100次API调用。
- 遇到HTTP 429(错误):等待60秒后再重试相同请求。告知用户:“已达到速率限制 — 请等待60秒后再尝试。”
RATE_LIMITED
Error Handling
错误处理
All scripts return structured errors. Parse the field to determine the appropriate response.
error所有脚本都会返回结构化错误。解析字段以确定相应的响应方式。
errorScript Error Codes
脚本错误代码
These are the values in the script's JSON output. They tell you what category of failure occurred.
error| Error Code | Meaning | Agent Response |
|---|---|---|
| | Tell user to set env vars via terminal |
| API returned non-200 or | Report: "Transaction failed: {error_message}" |
| Bad command-line arguments | Show correct usage from the |
| Quotation request rejected by API | Report the |
| Order confirmation failed | Report and suggest: "Check order status with 'Show recent trades'" |
| Key already revoked or does not exist | "API key not found — it may have already been revoked." |
| Too many requests (HTTP 429) | "Rate limit reached — please wait 60 seconds before trying again." |
| Unexpected error | Report the raw |
Rule: When is in the output, stop the current operation and report the error to the user using the guidance above. Never proceed to the next step after a failure.
okfalse这些是脚本JSON输出中的值,用于说明失败的类别。
error| 错误代码 | 含义 | Agent响应 |
|---|---|---|
| | 告知用户通过终端设置环境变量 |
| API返回非200状态码或 | 报告:“交易失败:{error_message}” |
| 命令行参数错误 | 显示 |
| API拒绝了报价请求 | 将 |
| 订单确认失败 | 报告并建议:“通过‘显示近期交易’查看订单状态” |
| 密钥已被撤销或不存在 | “未找到API密钥 — 它可能已被撤销。” |
| 请求过多(HTTP 429) | “已达到速率限制 — 请等待60秒后再尝试。” |
| 意外错误 | 报告原始 |
规则: 当输出中为时,停止当前操作并根据上述指导向用户报告错误。失败后切勿进行下一步操作。
okfalseCommon API Errors (Quick Reference)
常见API错误(快速参考)
These are the specific API error codes that appear inside the of , , or responses. They tell you why the API rejected the request.
error_messageQUOTATION_FAILEDEXECUTION_FAILEDAPI_ERROR | Meaning | Recovery |
|---|---|---|
| Insufficient funds | Check balances, reduce trade amount |
| Currency code not recognized | Verify via coin search |
| Quote expired or already used | Request a new quotation |
| Quotation engine error | Retry shortly |
| Not eligible for Prime benefits | Proceed without Prime |
| Account not approved for trading | Contact support |
| Feature restricted on account | Report |
| An existing order is in progress | Wait or cancel existing order |
| Fiat-to-crypto not enabled | Account feature not available |
| Crypto-to-fiat not enabled | Account feature not available |
| Bank transfer not enabled | Account feature not available |
| Required parameter missing | Script bug — report it |
| Transaction creation failed | Retry or contact support |
| API key revoked or expired | Generate a new API key, update env vars |
| Key doesn't exist or belongs to another user | Verify correct key is set in |
For dynamic errors (limit exceeded, currency disabled, cooling-off, etc.), report the and directly to the user. For full details, see references/errors.md.
errorerror_message这些是出现在、或响应的中的具体API错误代码,用于说明API拒绝请求的原因。
QUOTATION_FAILEDEXECUTION_FAILEDAPI_ERRORerror_message | 含义 | 解决方法 |
|---|---|---|
| 余额不足 | 检查余额,减少交易金额 |
| 货币代码未被识别 | 通过币种搜索验证 |
| 报价过期或已被使用 | 请求新的报价 |
| 报价引擎错误 | 稍后重试 |
| 不符合Prime权益资格 | 不使用Prime权益继续操作 |
| 账户未被批准进行交易 | 联系客服 |
| 账户的该功能被限制 | 将 |
| 已有订单在处理中 | 等待或取消现有订单 |
| 法币买币功能未启用 | 该账户功能不可用 |
| 币兑法币功能未启用 | 该账户功能不可用 |
| 银行转账功能未启用 | 该账户功能不可用 |
| 缺少必需参数 | 脚本错误 — 请报告 |
| 交易创建失败 | 重试或联系客服 |
| API密钥已被撤销或过期 | 生成新的API密钥,更新环境变量 |
| 密钥不存在或属于其他用户 | 验证 |
对于动态错误(超出限制、货币禁用、冷却期等),直接向用户报告和。详细信息请参阅references/errors.md。
errorerror_messageLogic & Rules
逻辑与规则
1. Asset & Source Disambiguation
1. 资产与源钱包歧义处理
Determine the trade type first:
- Purchase — fiat → crypto
- Sale — crypto → fiat
- Exchange — crypto → crypto
Then resolve the source wallet:
- For purchase: run . The script returns only funded fiat entries.
npx tsx $SKILL_DIR/scripts/account.ts resolve-source purchase - For sale or exchange: run (or
npx tsx $SKILL_DIR/scripts/account.ts resolve-source sale). The script returns only funded crypto entries.exchange
Result (from ):
data.status- → auto-select
SELECTED.data.currency - → prompt user to choose from
AMBIGUOUS.data.options - → inform user "No funded wallets found" and stop.
EMPTY
"Sell All" Scenario: If user says "Sell all [TOKEN]", run . Use the amount (or ) as for the quotation.
npx tsx $SKILL_DIR/scripts/account.ts balance [TOKEN]data.availabledata.balancefrom_amount首先确定交易类型:
- Purchase(买入) — 法币→加密货币
- Sale(卖出) — 加密货币→法币
- Exchange(兑换) — 加密货币→加密货币
然后解析源钱包:
- 对于买入:运行。脚本仅返回已充值的法币条目。
npx tsx $SKILL_DIR/scripts/account.ts resolve-source purchase - 对于卖出或兑换:运行(或
npx tsx $SKILL_DIR/scripts/account.ts resolve-source sale)。脚本仅返回已充值的加密货币条目。exchange
结果(来自):
data.status- → 自动选择
SELECTED。data.currency - → 提示用户从
AMBIGUOUS中选择。data.options - → 告知用户“未找到已充值的钱包”并停止操作。
EMPTY
**“全部卖出”场景:**如果用户说“卖出全部[TOKEN]”,运行。将金额(或)作为报价的。
npx tsx $SKILL_DIR/scripts/account.ts balance [TOKEN]data.availabledata.balancefrom_amount2. Trading Process (Quotation → Confirmation → Execution)
2. 交易流程(报价→确认→执行)
When the user asks to buy, sell, or swap crypto, always follow this three-step flow:
-
Step A — Get Quotation: Build the JSON params from the user's request (see the "Quotation JSON params" table in Trade Commands) and run:Read
npx tsx $SKILL_DIR/scripts/trade.ts quote <type> '<json-params>',data.id,data.from_amount, anddata.to_amountfrom the response.data.countdown -
Step B — Ask User to Confirm:
- IF is
memory.confirmation_required(or unset):true- Prompt: "Confirm: {from_amount} for {to_amount}? Valid for {countdown}s. Reply 'YES' to proceed."
- Expiration Logic: If the user replies "YES" after seconds have elapsed, reject: "Transaction rejected: The quotation rate has expired. Please request a new quote."
countdown - Execute Step C ONLY if user replies "YES" within the valid window.
- ELSE (Opted Out):
- Notify: "Quotation received. Proceeding to execution automatically..."
- Immediately proceed to Step C.
- IF
-
Step C — Execute Order: Run:using the
npx tsx $SKILL_DIR/scripts/trade.ts confirm <type> <data.id>from Step A.id
当用户要求买入、卖出或兑换加密货币时,必须遵循以下三步流程:
-
**步骤A — 获取报价:**根据用户请求构建JSON参数(见交易命令中的“报价JSON参数”表格)并运行:从响应中读取
npx tsx $SKILL_DIR/scripts/trade.ts quote <type> '<json-params>'、data.id、data.from_amount和data.to_amount。data.countdown -
步骤B — 请求用户确认:
- 如果为
memory.confirmation_required(或未设置):true- 提示:“确认:用{from_amount}兑换{to_amount}?有效期{countdown}秒。回复'YES'继续。”
- **过期逻辑:**如果用户在秒后回复“YES”,拒绝操作:“交易被拒绝:报价汇率已过期。请重新请求报价。”
countdown - 仅当用户在有效窗口内回复“YES”时,执行步骤C。
- 否则(已关闭确认):
- 通知:“已获取报价。将自动执行交易...”
- 直接执行步骤C。
- 如果
-
**步骤C — 执行订单:**运行:,使用步骤A中的
npx tsx $SKILL_DIR/scripts/trade.ts confirm <type> <data.id>。id
3. Memory Management (Opt-in/Out)
3. 内存管理(开启/关闭确认)
- To Opt-out: If user says "stop asking for confirmation" or "enable auto-trade", update to
memory.confirmation_required.false - To Opt-in: If user says "require confirmation" or "enable manual trade", update to
memory.confirmation_required.true - Platforms without persistent memory: If your platform does not support , treat
{{memory.*}}as alwaysconfirmation_required(safest default).true
- **关闭确认:**如果用户说“停止要求确认”或“启用自动交易”,将更新为
memory.confirmation_required。false - **开启确认:**如果用户说“需要确认”或“启用手动交易”,将更新为
memory.confirmation_required。true - **不支持持久化内存的平台:**如果你的平台不支持,默认将
{{memory.*}}视为confirmation_required(最安全的设置)。true
4. Error Handling
4. 错误处理
- All script outputs include an field. Success is defined ONLY as
ok.ok: true - If is
ok, readfalseand respond per the Error Handling table above.error - Never proceed to the next step after a failed command.
- 所有脚本输出均包含字段。仅当
ok时视为成功。ok: true - 如果为
ok,读取false并根据上述错误处理表格进行响应。error - 失败后切勿进行下一步操作。
5. Account & History
5. 账户与历史记录
- History: Run — display the entries from
npx tsx $SKILL_DIR/scripts/trade.ts history.data - Weekly Trading Limit: Run — display as: "📊 Weekly Trading Limit: {data.used} / {data.limit} USD (Remaining: {data.remaining} USD)".
npx tsx $SKILL_DIR/scripts/account.ts trading-limit - Balances (Categorized):
- If "List Fiat": run .
npx tsx $SKILL_DIR/scripts/account.ts balances fiat - If "List Crypto": run .
npx tsx $SKILL_DIR/scripts/account.ts balances crypto - If "List All": run . Crucial: Display Fiat category first, followed by Crypto balances below.
npx tsx $SKILL_DIR/scripts/account.ts balances all - The scripts automatically filter out zero-balance entries. If a category has no entries in the output, display "No holdings" under that header.
- If "List Fiat": run
- **历史记录:**运行— 显示
npx tsx $SKILL_DIR/scripts/trade.ts history中的条目。data - **每周交易限额:**运行— 显示为:“📊 每周交易限额:{data.used} / {data.limit} 美元(剩余:{data.remaining} 美元)”。
npx tsx $SKILL_DIR/scripts/account.ts trading-limit - 分类余额:
- 如果用户要求“列出法币余额”:运行。
npx tsx $SKILL_DIR/scripts/account.ts balances fiat - 如果用户要求“列出加密货币余额”:运行。
npx tsx $SKILL_DIR/scripts/account.ts balances crypto - 如果用户要求“列出全部余额”:运行。**重要:**先显示法币类别,再显示加密货币余额。
npx tsx $SKILL_DIR/scripts/account.ts balances all - 脚本会自动过滤掉零余额条目。如果某类别在输出中没有条目,在该标题下显示“无持仓”。
- 如果用户要求“列出法币余额”:运行
6. Kill Switch
6. 紧急关停开关
- Trigger: User says "STOP ALL TRADING", "kill switch", or similar emergency stop command.
- ALWAYS require explicit confirmation regardless of :
memory.confirmation_required- Prompt: "⚠️ WARNING: This will immediately revoke your API key and disable all trading. A new API key must be generated to resume. Type 'CONFIRM KILL SWITCH' to proceed."
- Execute ONLY if user replies with the exact phrase.
- Execution: Run .
npx tsx $SKILL_DIR/scripts/account.ts revoke-key - On success (): Notify: "🛑 Kill switch activated. API key has been revoked. All trading is disabled. Generate a new API key and update your environment variables to resume."
ok: true - On error: Notify: "API key not found — it may have already been revoked or does not exist."
API_KEY_NOT_FOUND - Idempotency: Revoking an already-revoked key is not an error; treat it the same as a successful revocation.
- **触发条件:**用户说“停止所有交易”、“紧急关停”或类似的紧急停止命令。
- 无论设置如何,必须要求明确确认:
memory.confirmation_required- 提示:“⚠️ 警告:这将立即撤销你的API密钥并禁用所有交易。恢复交易必须生成新的API密钥。输入'CONFIRM KILL SWITCH'继续。”
- 仅当用户回复确切短语时才执行。
- **执行:**运行。
npx tsx $SKILL_DIR/scripts/account.ts revoke-key - **成功时():**通知:“🛑 紧急关停开关已激活。API密钥已被撤销。所有交易已禁用。生成新的API密钥并更新环境变量以恢复交易。”
ok: true - **遇到错误时:**通知:“未找到API密钥 — 它可能已被撤销或不存在。”
API_KEY_NOT_FOUND - **幂等性:**撤销已被撤销的密钥不算错误;视为成功撤销。
7. Balance Display Format
7. 余额显示格式
- Fiat Header: "🏦 Fiat Balances"
- Crypto Header: "🪙 Crypto Balances"
- Always list Fiat section before Crypto section when both are requested.
- Never display zero-balance assets. Only show assets with a balance greater than 0. If all assets in a category are zero, show "No holdings" under that header.
- 法币标题:“🏦 法币余额”
- 加密货币标题:“🪙 加密货币余额”
- 当同时请求法币和加密货币余额时,始终先显示法币部分。
- **绝不显示零余额资产。**仅显示余额大于0的资产。如果某类别下所有资产均为零,在该标题下显示“无持仓”。