okx-cex-earn

Manages OKX Simple Earn (flexible savings/lending), On-chain Earn (staking/DeFi), and Dual Investment (DCD/双币赢) via the okx CLI. Use this skill whenever the user wants to check earn balances, subscribe or redeem earn products, view or set lending rates, monitor on-chain staking orders, or interact with dual investment structured products — even if phrased casually as 活期赚币, 赚币, 申购, 赎回, 链上赚币, 质押, 理财, 双币赢, 双币理财, 双币申购, 高卖, 低买, dual investment, DCD, buy low, sell high structured product, earn with target price, or 目标价. Also use when the user asks about idle funds and whether to earn on them.

23 stars

Best use case

okx-cex-earn is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Manages OKX Simple Earn (flexible savings/lending), On-chain Earn (staking/DeFi), and Dual Investment (DCD/双币赢) via the okx CLI. Use this skill whenever the user wants to check earn balances, subscribe or redeem earn products, view or set lending rates, monitor on-chain staking orders, or interact with dual investment structured products — even if phrased casually as 活期赚币, 赚币, 申购, 赎回, 链上赚币, 质押, 理财, 双币赢, 双币理财, 双币申购, 高卖, 低买, dual investment, DCD, buy low, sell high structured product, earn with target price, or 目标价. Also use when the user asks about idle funds and whether to earn on them.

Teams using okx-cex-earn should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/okx-official-cex-earn/SKILL.md --create-dirs "https://raw.githubusercontent.com/jiayaoqijia/cryptoskill/main/skills/exchanges/okx-official-cex-earn/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/okx-official-cex-earn/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How okx-cex-earn Compares

Feature / Agentokx-cex-earnStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Manages OKX Simple Earn (flexible savings/lending), On-chain Earn (staking/DeFi), and Dual Investment (DCD/双币赢) via the okx CLI. Use this skill whenever the user wants to check earn balances, subscribe or redeem earn products, view or set lending rates, monitor on-chain staking orders, or interact with dual investment structured products — even if phrased casually as 活期赚币, 赚币, 申购, 赎回, 链上赚币, 质押, 理财, 双币赢, 双币理财, 双币申购, 高卖, 低买, dual investment, DCD, buy low, sell high structured product, earn with target price, or 目标价. Also use when the user asks about idle funds and whether to earn on them.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# OKX CEX Earn CLI

## Prerequisites

1. Install `okx` CLI:
   ```bash
   npm install -g @okx_ai/okx-trade-cli
   ```
2. 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
   ```
3. Verify: `okx --profile live earn savings balance`

---

## Credential & Profile Check

Run `okx config show` before any authenticated command.

- Error or no configuration → **stop**, guide user to run `okx config init`, wait for completion.
- Credentials configured → proceed.

OKX Earn does not support demo mode. Always use `--profile live` silently — don't mention it unless there's an error.

**On 401 errors:** stop immediately, tell the user their credentials may be invalid or expired, guide them to update `~/.okx/config.toml` (do NOT ask them to paste credentials into chat), then verify with `okx config show` and retry.

---

## Skill Routing

| User intent | Route to skill |
|---|---|
| Market prices, tickers, candles | `okx-cex-market` |
| Spot / swap / futures / options orders | `okx-cex-trade` |
| Account balance, positions, transfers | `okx-cex-portfolio` |
| Grid / DCA trading bots | `okx-cex-bot` |
| Simple Earn, On-chain Earn, or Dual Investment (双币赢) | **This skill** |

---

## Command Index

### earn savings — Simple Earn (7 commands)

| Command | Type | Auth | Description |
|---|---|---|---|
| `earn savings balance [ccy]` | READ | Required | Savings balance (all or specific currency) |
| `earn savings purchase --ccy --amt` | WRITE | Required | Subscribe funds to Simple Earn |
| `earn savings redeem --ccy --amt` | WRITE | Required | Redeem funds from Simple Earn |
| `earn savings set-rate --ccy --rate` | WRITE | Required | Set minimum lending rate |
| `earn savings lending-history` | READ | Required | Lending records with earnings detail |
| `earn savings rate-summary [ccy]` | READ | Required | Market lending rate summary |
| `earn savings rate-history` | READ | Required | Historical lending rates |

For full command syntax, rate field semantics, and confirmation templates, read `{baseDir}/references/savings-commands.md`.

### earn dcd — Dual Investment / 双币赢 (10 commands)

| Command | Type | Auth | Description |
|---|---|---|---|
| `earn dcd pairs` | READ | Required | Available DCD currency pairs |
| `earn dcd products` | READ | Required | Active products with filters |
| `earn dcd quote --productId --sz --notionalCcy` | READ | Required | Request real-time quote (TTL 30s) |
| `earn dcd buy --quoteId` | WRITE | Required | Execute an existing quote |
| `earn dcd quote-and-buy --productId --sz --notionalCcy` | WRITE | Required | Quote + execute in one step (AI preferred) |
| `earn dcd order --ordId` | READ | Required | Quick state check for a single order |
| `earn dcd orders` | READ | Required | Full order list / history |
| `earn dcd redeem-quote --ordId` | READ | Required | Early redemption preview (TTL 15s) |
| `earn dcd redeem-execute --ordId` | WRITE | Required | Re-quote + execute redemption (AI preferred) |
| `earn dcd redeem --ordId --quoteId` | 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`.

### earn onchain — On-chain Earn (6 commands)

| Command | Type | Auth | Description |
|---|---|---|---|
| `earn onchain offers` | READ | Required | Available staking/DeFi products |
| `earn onchain purchase --productId --ccy --amt` | WRITE | Required | Subscribe to on-chain product |
| `earn onchain redeem --ordId --protocolType` | WRITE | Required | Redeem on-chain investment |
| `earn onchain cancel --ordId --protocolType` | WRITE | Required | Cancel pending on-chain order |
| `earn onchain orders` | READ | Required | Active on-chain orders |
| `earn onchain history` | READ | Required | Historical on-chain orders |

For full command syntax and parameters, read `{baseDir}/references/onchain-commands.md`.

---

## Operation Flow

### Step 0 — Credential & Profile Check

Before any authenticated command: see [Credential & Profile Check](#credential--profile-check). Always use `--profile live` silently.

### Step 1 — Identify earn intent

**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.md`.

**Dual Investment (DCD / 双币赢):**
- Browse products / pairs → READ; when user specifies a currency, read `{baseDir}/references/workflows.md` (DCD browse flow) for the mandatory parallel pre-fetch before rendering the product table
- Subscribe (quote-and-buy) → WRITE → see `{baseDir}/references/workflows.md` (DCD subscribe flow)
- Early redeem → WRITE → see `{baseDir}/references/workflows.md` (DCD early redeem flow)

For multi-step workflows (idle fund analysis, subscribe + verify, redeem + transfer, on-chain subscribe), read `{baseDir}/references/workflows.md`.

### Step 2 — Confirm write operation

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 `{baseDir}/references/savings-commands.md`. For On-chain confirmation, read `{baseDir}/references/onchain-commands.md`.

### Step 3 — Execute and verify

After any purchase, verify based on product type:
- **DCD** `quote-and-buy` succeeded → run `earn dcd orders --json`, show only the matching order.
- **On-chain** purchase (response contains `ordId`) → run `earn onchain orders --json`, show only the matching order.
- **Simple Earn** purchase (no `ordId` in response) → run `earn savings balance --ccy <ccy> --json`.

**Simple Earn purchase:** Run in parallel — `earn savings balance --ccy <ccy>` and `earn savings rate-history --ccy <ccy> --limit 1 --json`. For output format, read `{baseDir}/references/savings-commands.md`.

**Simple Earn redeem:** Run `earn savings balance --ccy <ccy>` to confirm updated balance. Inform user funds returned to funding account.

**On-chain redeem:** Query `earn onchain orders` to confirm state. Show `estSettlementTime` as estimated arrival time.

**On-chain cancel:** Query `earn onchain orders` after submission:
- Order gone from list → inform user: cancellation complete, funds returned to funding account.
- `state: 3` (cancelling) → inform user: cancellation in progress, funds will return to funding account shortly.

---

## Global Notes

- **Security:** Never ask users to paste API keys or secrets into chat.
- **Output:** Always pass `--json` to list/query commands and render results as a Markdown table — never paste raw terminal output.
- **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`.

Related Skills

earn

23
from jiayaoqijia/cryptoskill

KuCoin Earn products using the KuCoin API. Query Simple Earn and Structured Earn products. Authentication requires API Key, API Secret, and Passphrase.

recipe-earn-yield-compare

23
from jiayaoqijia/cryptoskill

Compare earn strategy yields across assets and lock types to find the best rate.

kraken-earn-staking

23
from jiayaoqijia/cryptoskill

Discover staking strategies, allocate funds, and track earn positions.

yearn-heyanon

23
from jiayaoqijia/cryptoskill

Safe execution layer for Yearn yield vaults with deposit validation, capacity checks, and approval handling.

yearn-heyanon-executor

23
from jiayaoqijia/cryptoskill

Safe execution layer for Yearn yield vaults that validates deposit parameters, checks vault capacity, and returns pre-validated calldata for AI agents.

yearn-heyanon-agent

23
from jiayaoqijia/cryptoskill

Safe execution layer for Yearn yield vaults with parameter validation and pre-validated calldata for AI agents.

8004-skill

23
from jiayaoqijia/cryptoskill

ERC-8004 Trustless Agents - Register and manage AI agent identities on TRON and BSC blockchains with on-chain reputation tracking

8004-MCP - Agent Registry Protocol

23
from jiayaoqijia/cryptoskill

Multi-chain MCP server for ERC-8004 Agent Registry. Query agents, reputation, and feedback across Solana + EVM chains.

supurr

23
from jiayaoqijia/cryptoskill

Backtest, deploy, and monitor trading bots on Hyperliquid. Supports Grid, DCA, and Spot-Perp Arbitrage strategies across Native Perps, Spot markets (USDC/USDH), and HIP-3 sub-DEXes.

senpi-skills

23
from jiayaoqijia/cryptoskill

Agent Skills for autonomous crypto trading on Hyperliquid — trailing stops, market scanning, position management, and more.

sdks

23
from jiayaoqijia/cryptoskill

Official Azex SDKs — TypeScript, Python, MCP Server, CLI for the crypto-native LLM API gateway

perp-cli

23
from jiayaoqijia/cryptoskill

Multi-DEX perpetual futures CLI + MCP server — Pacifica (Solana), Hyperliquid, Lighter (Ethereum). 18 MCP tools for AI-powered trading