Loading...
Loading...
Compare original and translation side by side
| 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 ( |
| 能力 | 是否必需 | 详情 |
|---|---|---|
| Shell命令执行 | 是 | 必须能够运行 |
| 环境变量 | 是 | 必须从Shell环境中读取 |
| JSON解析 | 是 | 必须解析脚本标准输出中的结构化JSON以提取字段 |
| 多轮对话 | 是 | 交易采用报价→确认的流程,需跨越多轮用户对话 |
| 持久化内存 | 否 | 用于 |
| 时间感知 | 否 | 用于检查报价过期时间( |
curlfetchnpx tsxcurlfetchnpx tsxhttps://wapi.crypto.com{{env.CDC_API_KEY}}{{env.CDC_API_SECRET}}{{memory.confirmation_required}}SKILL.md/home/user/skills/crypto-com-app/SKILL.mdSKILL_DIR/home/user/skills/crypto-com-apphttps://wapi.crypto.com{{env.CDC_API_KEY}}{{env.CDC_API_SECRET}}{{memory.confirmation_required}}SKILL.md/home/user/skills/crypto-com-app/SKILL.mdSKILL_DIR/home/user/skills/crypto-com-appCDC_API_KEYCDC_API_SECRETecho "CDC_API_KEY=${CDC_API_KEY:+set}" "CDC_API_SECRET=${CDC_API_SECRET:+set}"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."
MISSING_ENVCDC_API_KEYCDC_API_SECRETecho "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_ENVnpx tsxtsxnpx$SKILL_DIRcd./scripts/...npx tsxtsxnpx$SKILL_DIR./scripts/...undefinedundefinedundefinedundefinedundefinedundefined
**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.
**用户意图与交易类型的映射:**
| 用户表述 | 交易类型 | 转出 | 转入 |
|-----------|-----------|------|-----|
| "用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节。undefinedundefined
**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`).
**必需的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`)。{"ok": true, "data": { ... }}{"ok": false, "error": "ERROR_CODE", "error_message": "Human-readable message"}{"ok": true, "data": { ... }}{"ok": false, "error": "ERROR_CODE", "error_message": "易读错误信息"}ok: truecountdownRATE_LIMITEDok: truecountdownRATE_LIMITEDerrorerrorerror| 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 |
okfalseerror| 错误代码 | 含义 | Agent响应 |
|---|---|---|
| | 告知用户通过终端设置环境变量 |
| API返回非200状态码或 | 报告:“交易失败:{error_message}” |
| 命令行参数错误 | 显示 |
| API拒绝了报价请求 | 将 |
| 订单确认失败 | 报告并建议:“通过‘显示近期交易’查看订单状态” |
| 密钥已被撤销或不存在 | “未找到API密钥 — 它可能已被撤销。” |
| 请求过多(HTTP 429) | “已达到速率限制 — 请等待60秒后再尝试。” |
| 意外错误 | 报告原始 |
okfalseerror_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 |
errorerror_messageQUOTATION_FAILEDEXECUTION_FAILEDAPI_ERRORerror_message | 含义 | 解决方法 |
|---|---|---|
| 余额不足 | 检查余额,减少交易金额 |
| 货币代码未被识别 | 通过币种搜索验证 |
| 报价过期或已被使用 | 请求新的报价 |
| 报价引擎错误 | 稍后重试 |
| 不符合Prime权益资格 | 不使用Prime权益继续操作 |
| 账户未被批准进行交易 | 联系客服 |
| 账户的该功能被限制 | 将 |
| 已有订单在处理中 | 等待或取消现有订单 |
| 法币买币功能未启用 | 该账户功能不可用 |
| 币兑法币功能未启用 | 该账户功能不可用 |
| 银行转账功能未启用 | 该账户功能不可用 |
| 缺少必需参数 | 脚本错误 — 请报告 |
| 交易创建失败 | 重试或联系客服 |
| API密钥已被撤销或过期 | 生成新的API密钥,更新环境变量 |
| 密钥不存在或属于其他用户 | 验证 |
errorerror_messagenpx tsx $SKILL_DIR/scripts/account.ts resolve-source purchasenpx tsx $SKILL_DIR/scripts/account.ts resolve-source saleexchangedata.statusSELECTEDdata.currencyAMBIGUOUSdata.optionsEMPTYnpx tsx $SKILL_DIR/scripts/account.ts balance [TOKEN]data.availabledata.balancefrom_amountnpx tsx $SKILL_DIR/scripts/account.ts resolve-source purchasenpx tsx $SKILL_DIR/scripts/account.ts resolve-source saleexchangedata.statusSELECTEDdata.currencyAMBIGUOUSdata.optionsEMPTYnpx tsx $SKILL_DIR/scripts/account.ts balance [TOKEN]data.availabledata.balancefrom_amountnpx tsx $SKILL_DIR/scripts/trade.ts quote <type> '<json-params>'data.iddata.from_amountdata.to_amountdata.countdownmemory.confirmation_requiredtruecountdownnpx tsx $SKILL_DIR/scripts/trade.ts confirm <type> <data.id>idnpx tsx $SKILL_DIR/scripts/trade.ts quote <type> '<json-params>'data.iddata.from_amountdata.to_amountdata.countdownmemory.confirmation_requiredtruecountdownnpx tsx $SKILL_DIR/scripts/trade.ts confirm <type> <data.id>idmemory.confirmation_requiredfalsememory.confirmation_requiredtrue{{memory.*}}confirmation_requiredtruememory.confirmation_requiredfalsememory.confirmation_requiredtrue{{memory.*}}confirmation_requiredtrueokok: trueokfalseerrorokok: trueokfalseerrornpx tsx $SKILL_DIR/scripts/trade.ts historydatanpx tsx $SKILL_DIR/scripts/account.ts trading-limitnpx tsx $SKILL_DIR/scripts/account.ts balances fiatnpx tsx $SKILL_DIR/scripts/account.ts balances cryptonpx tsx $SKILL_DIR/scripts/account.ts balances allnpx tsx $SKILL_DIR/scripts/trade.ts historydatanpx tsx $SKILL_DIR/scripts/account.ts trading-limitnpx tsx $SKILL_DIR/scripts/account.ts balances fiatnpx tsx $SKILL_DIR/scripts/account.ts balances cryptonpx tsx $SKILL_DIR/scripts/account.ts balances allmemory.confirmation_requirednpx tsx $SKILL_DIR/scripts/account.ts revoke-keyok: trueAPI_KEY_NOT_FOUNDmemory.confirmation_requirednpx tsx $SKILL_DIR/scripts/account.ts revoke-keyok: trueAPI_KEY_NOT_FOUND