okx-cex-earn
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOKX CEX Earn CLI
OKX CEX 赚币 CLI工具
Prerequisites
前提条件
- Install CLI:
okxbashnpm install -g @okx_ai/okx-trade-cli - Configure credentials:
bash
okx config add-profile AK=<your_api_key> SK=<your_secret_key> PP=<your_passphrase> name=live # or interactive wizard: okx config init - Verify:
okx --profile live earn savings balance
- 安装CLI:
okxbashnpm install -g @okx_ai/okx-trade-cli - 配置凭证:
bash
okx config add-profile AK=<your_api_key> SK=<your_secret_key> PP=<your_passphrase> name=live # 或使用交互式向导: okx config init - 验证:
okx --profile live earn savings balance
Credential & Profile Check
凭证与配置文件检查
Run before any authenticated command.
okx config show- Error or no configuration → stop, guide user to run , wait for completion.
okx config init - Credentials configured → proceed.
OKX Earn does not support demo mode. Always use silently — don't mention it unless there's an error.
--profile liveOn 401 errors: stop immediately, tell the user their credentials may be invalid or expired, guide them to update (do NOT ask them to paste credentials into chat), then verify with and retry.
~/.okx/config.tomlokx config show在执行任何需要认证的命令之前,请先运行。
okx config show- 出现错误或无配置 → 停止操作,引导用户运行,等待配置完成。
okx config init - 已配置凭证 → 继续操作。
OKX赚币不支持演示模式。请默认使用参数——除非出现错误,否则无需提及该参数。
--profile live**遇到401错误时:**立即停止操作,告知用户其凭证可能无效或已过期,引导他们更新(请勿要求用户在聊天中粘贴凭证),然后使用验证并重试。
~/.okx/config.tomlokx config showSkill Routing
技能路由
| User intent | Route to skill |
|---|---|
| Market prices, tickers, candles | |
| Spot / swap / futures / options orders | |
| Account balance, positions, transfers | |
| Grid / DCA trading bots | |
| Simple Earn, On-chain Earn, or Dual Investment (双币赢) | This skill |
| 用户意图 | 路由至技能 |
|---|---|
| 市场价格、行情、K线 | |
| 现货/永续/期货/期权订单 | |
| 账户余额、持仓、转账 | |
| 网格/DCA交易机器人 | |
| 活期赚币、链上赚币或双币赢 | 本技能 |
Command Index
命令索引
earn savings — Simple Earn (7 commands)
earn savings — 活期赚币(7个命令)
| Command | Type | Auth | Description |
|---|---|---|---|
| READ | Required | Savings balance (all or specific currency) |
| WRITE | Required | Subscribe funds to Simple Earn |
| WRITE | Required | Redeem funds from Simple Earn |
| WRITE | Required | Set minimum lending rate |
| READ | Required | Lending records with earnings detail |
| READ | Required | Market lending rate summary |
| READ | Required | Historical lending rates |
For full command syntax, rate field semantics, and confirmation templates, read .
{baseDir}/references/savings-commands.md| 命令 | 类型 | 认证要求 | 描述 |
|---|---|---|---|
| 读取 | 必填 | 储蓄余额(全部或特定币种) |
| 写入 | 必填 | 申购活期赚币产品 |
| 写入 | 必填 | 赎回活期赚币产品 |
| 写入 | 必填 | 设置最低借贷利率 |
| 读取 | 必填 | 借贷记录及收益详情 |
| 读取 | 必填 | 市场借贷利率汇总 |
| 读取 | 必填 | 借贷利率历史数据 |
如需完整命令语法、利率字段语义及确认模板,请参阅。
{baseDir}/references/savings-commands.mdearn dcd — Dual Investment / 双币赢 (10 commands)
earn dcd — 双币赢(DCD/双币赢,10个命令)
| Command | Type | Auth | Description |
|---|---|---|---|
| READ | Required | Available DCD currency pairs |
| READ | Required | Active products with filters |
| READ | Required | Request real-time quote (TTL 30s) |
| WRITE | Required | Execute an existing quote |
| WRITE | Required | Quote + execute in one step (AI preferred) |
| READ | Required | Quick state check for a single order |
| READ | Required | Full order list / history |
| READ | Required | Early redemption preview (TTL 15s) |
| WRITE | Required | Re-quote + execute redemption (AI preferred) |
| WRITE | Required | Execute redemption with existing quoteId (low-level) |
DCD does not support demo/simulated trading mode. Always use.--profile live
For full command syntax, product concepts, and error codes, read .
{baseDir}/references/dcd-commands.md| 命令 | 类型 | 认证要求 | 描述 |
|---|---|---|---|
| 读取 | 必填 | 可用DCD币种对 |
| 读取 | 必填 | 在售产品(支持筛选) |
| 读取 | 必填 | 请求实时报价(有效期30秒) |
| 写入 | 必填 | 执行已有报价 |
| 写入 | 必填 | 报价+申购一步完成(AI推荐使用) |
| 读取 | 必填 | 单个订单状态快速查询 |
| 读取 | 必填 | 全部订单列表/历史记录 |
| 读取 | 必填 | 提前赎回预览(有效期15秒) |
| 写入 | 必填 | 重新报价+执行赎回(AI推荐使用) |
| 写入 | 必填 | 使用已有quoteId执行赎回(底层命令) |
DCD 不支持演示/模拟交易模式。请始终使用参数。--profile live
如需完整命令语法、产品概念及错误码说明,请参阅。
{baseDir}/references/dcd-commands.mdearn onchain — On-chain Earn (6 commands)
earn onchain — 链上赚币(6个命令)
| Command | Type | Auth | Description |
|---|---|---|---|
| READ | Required | Available staking/DeFi products |
| WRITE | Required | Subscribe to on-chain product |
| WRITE | Required | Redeem on-chain investment |
| WRITE | Required | Cancel pending on-chain order |
| READ | Required | Active on-chain orders |
| READ | Required | Historical on-chain orders |
For full command syntax and parameters, read .
{baseDir}/references/onchain-commands.md| 命令 | 类型 | 认证要求 | 描述 |
|---|---|---|---|
| 读取 | 必填 | 可用质押/DeFi产品 |
| 写入 | 必填 | 申购链上赚币产品 |
| 写入 | 必填 | 赎回链上投资产品 |
| 写入 | 必填 | 取消待处理的链上订单 |
| 读取 | 必填 | 活跃链上订单 |
| 读取 | 必填 | 链上订单历史记录 |
如需完整命令语法及参数说明,请参阅。
{baseDir}/references/onchain-commands.mdOperation Flow
操作流程
Step 0 — Credential & Profile Check
步骤0 — 凭证与配置文件检查
Before any authenticated command: see Credential & Profile Check. Always use silently.
--profile live在执行任何需要认证的命令之前:请参阅凭证与配置文件检查。请默认使用参数。
--profile liveStep 1 — Identify earn intent
步骤1 — 识别赚币意图
Simple Earn / On-chain Earn:
- Query balance / history / rates → READ command, proceed directly.
- Subscribe / redeem / set-rate / on-chain purchase → WRITE command, go to Step 2.
When user asks to view "earn positions" or "赚币持仓" (regardless of whether they mention DCD explicitly), query all three simultaneously:
bash
okx --profile live earn savings balance --json # Simple Earn
okx --profile live earn onchain orders --json # On-chain Earn
okx --profile live earn dcd orders --json # Dual Investment (双币赢)Only present sections that have actual holdings. For DCD: translate state codes using the table in .
{baseDir}/references/dcd-commands.mdDual Investment (DCD / 双币赢):
- Browse products / pairs → READ; when user specifies a currency, read (DCD browse flow) for the mandatory parallel pre-fetch before rendering the product table
{baseDir}/references/workflows.md - Subscribe (quote-and-buy) → WRITE → see (DCD subscribe flow)
{baseDir}/references/workflows.md - Early redeem → WRITE → see (DCD early redeem flow)
{baseDir}/references/workflows.md
For multi-step workflows (idle fund analysis, subscribe + verify, redeem + transfer, on-chain subscribe), read .
{baseDir}/references/workflows.md活期赚币/链上赚币:
- 查询余额/历史记录/利率 → 使用读取命令,直接执行。
- 申购/赎回/设置利率/链上申购 → 使用写入命令,进入步骤2。
当用户要求查看"赚币持仓"或"赚币持仓"时(无论是否明确提及DCD),请同时查询三类产品:
bash
okx --profile live earn savings balance --json # 活期赚币
okx --profile live earn onchain orders --json # 链上赚币
okx --profile live earn dcd orders --json # 双币赢仅展示有实际持仓的部分。对于DCD:请使用中的表格翻译状态码。
{baseDir}/references/dcd-commands.md双币赢(DCD/双币赢):
- 浏览产品/币种对 → 读取操作;当用户指定币种时,请在渲染产品表格前参阅(DCD浏览流程)进行强制并行预获取
{baseDir}/references/workflows.md - 申购(quote-and-buy) → 写入操作 → 参阅(DCD申购流程)
{baseDir}/references/workflows.md - 提前赎回 → 写入操作 → 参阅(DCD提前赎回流程)
{baseDir}/references/workflows.md
对于多步骤流程(闲置资金分析、申购+验证、赎回+转账、链上申购),请参阅。
{baseDir}/references/workflows.mdStep 2 — Confirm write operation
步骤2 — 确认写入操作
For all WRITE commands, present a summary and wait for explicit confirmation.
"just do it" / "直接搞" is NOT valid confirmation — the user must see the summary first.
For Simple Earn confirmation dialog format, read . For On-chain confirmation, read .
{baseDir}/references/savings-commands.md{baseDir}/references/onchain-commands.md对于所有写入命令,请展示操作摘要并等待用户明确确认。
"直接操作" / "直接搞" 不属于有效确认——用户必须先看到操作摘要。
活期赚币确认对话框格式请参阅。链上赚币确认格式请参阅。
{baseDir}/references/savings-commands.md{baseDir}/references/onchain-commands.mdStep 3 — Execute and verify
步骤3 — 执行与验证
After any purchase, verify based on product type:
- DCD succeeded → run
quote-and-buy, show only the matching order.earn dcd orders --json - On-chain purchase (response contains ) → run
ordId, show only the matching order.earn onchain orders --json - Simple Earn purchase (no in response) → run
ordId.earn savings balance --ccy <ccy> --json
Simple Earn purchase: Run in parallel — and . For output format, read .
earn savings balance --ccy <ccy>earn savings rate-history --ccy <ccy> --limit 1 --json{baseDir}/references/savings-commands.mdSimple Earn redeem: Run to confirm updated balance. Inform user funds returned to funding account.
earn savings balance --ccy <ccy>On-chain redeem: Query to confirm state. Show as estimated arrival time.
earn onchain ordersestSettlementTimeOn-chain cancel: Query after submission:
earn onchain orders- Order gone from list → inform user: cancellation complete, funds returned to funding account.
- (cancelling) → inform user: cancellation in progress, funds will return to funding account shortly.
state: 3
完成任何申购操作后,请根据产品类型进行验证:
- DCD 成功后 → 执行
quote-and-buy,仅展示匹配的订单。earn dcd orders --json - 链上赚币申购成功后(响应包含) → 执行
ordId,仅展示匹配的订单。earn onchain orders --json - 活期赚币申购成功后(响应无) → 执行
ordId。earn savings balance --ccy <ccy> --json
活期赚币申购: 并行执行以下命令 — 和 。输出格式请参阅。
earn savings balance --ccy <ccy>earn savings rate-history --ccy <ccy> --limit 1 --json{baseDir}/references/savings-commands.md活期赚币赎回: 执行确认余额更新。告知用户资金已返回资金账户。
earn savings balance --ccy <ccy>链上赚币赎回: 查询确认状态。将展示为预计到账时间。
earn onchain ordersestSettlementTime链上赚币取消订单: 提交取消请求后查询:
earn onchain orders- 订单已从列表中消失 → 告知用户:取消完成,资金将返回资金账户。
- (取消中) → 告知用户:取消操作进行中,资金将很快返回资金账户。
state: 3
Global Notes
全局注意事项
- Security: Never ask users to paste API keys or secrets into chat.
- Output: Always pass to list/query commands and render results as a Markdown table — never paste raw terminal output.
--json - Network errors: If commands fail with a connection error, prompt user to check VPN:
curl -I https://www.okx.com - Language: Always respond in the user's language.
For number/time formatting and response structure conventions, read .
{baseDir}/references/templates.md- **安全:**切勿要求用户在聊天中粘贴API密钥或机密信息。
- **输出:**对列表/查询命令始终添加参数,并将结果渲染为Markdown表格——切勿粘贴原始终端输出。
--json - **网络错误:**如果命令因连接错误失败,提示用户检查VPN:
curl -I https://www.okx.com - **语言:**始终使用用户的语言回复。
有关数字/时间格式和响应结构约定,请参阅。
{baseDir}/references/templates.md