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.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "okx-cex-earn" with this command: npx skills add okx/agent-skills/okx-agent-skills-okx-cex-earn

OKX CEX Earn CLI

Prerequisites

  1. Install okx CLI:
    npm install -g @okx_ai/okx-trade-cli
    
  2. Configure credentials:
    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 intentRoute to skill
Market prices, tickers, candlesokx-cex-market
Spot / swap / futures / options ordersokx-cex-trade
Account balance, positions, transfersokx-cex-portfolio
Grid / DCA trading botsokx-cex-bot
Simple Earn, On-chain Earn, or Dual Investment (双币赢)This skill

Command Index

earn savings — Simple Earn (7 commands)

CommandTypeAuthDescription
earn savings balance [ccy]READRequiredSavings balance (all or specific currency)
earn savings purchase --ccy --amtWRITERequiredSubscribe funds to Simple Earn
earn savings redeem --ccy --amtWRITERequiredRedeem funds from Simple Earn
earn savings set-rate --ccy --rateWRITERequiredSet minimum lending rate
earn savings lending-historyREADRequiredLending records with earnings detail
earn savings rate-summary [ccy]READRequiredMarket lending rate summary
earn savings rate-historyREADRequiredHistorical lending rates

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

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

CommandTypeAuthDescription
earn dcd pairsREADRequiredAvailable DCD currency pairs
earn dcd productsREADRequiredActive products with filters
earn dcd quote --productId --sz --notionalCcyREADRequiredRequest real-time quote (TTL 30s)
earn dcd buy --quoteIdWRITERequiredExecute an existing quote
earn dcd quote-and-buy --productId --sz --notionalCcyWRITERequiredQuote + execute in one step (AI preferred)
earn dcd order --ordIdREADRequiredQuick state check for a single order
earn dcd ordersREADRequiredFull order list / history
earn dcd redeem-quote --ordIdREADRequiredEarly redemption preview (TTL 15s)
earn dcd redeem-execute --ordIdWRITERequiredRe-quote + execute redemption (AI preferred)
earn dcd redeem --ordId --quoteIdWRITERequiredExecute 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)

CommandTypeAuthDescription
earn onchain offersREADRequiredAvailable staking/DeFi products
earn onchain purchase --productId --ccy --amtWRITERequiredSubscribe to on-chain product
earn onchain redeem --ordId --protocolTypeWRITERequiredRedeem on-chain investment
earn onchain cancel --ordId --protocolTypeWRITERequiredCancel pending on-chain order
earn onchain ordersREADRequiredActive on-chain orders
earn onchain historyREADRequiredHistorical 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. 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:

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.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

okx-cex-trade

No summary provided by upstream source.

Repository SourceNeeds Review
611-okx
Automation

okx-cex-market

No summary provided by upstream source.

Repository SourceNeeds Review
594-okx
Automation

okx-cex-portfolio

No summary provided by upstream source.

Repository SourceNeeds Review
566-okx
Automation

okx-cex-bot

No summary provided by upstream source.

Repository SourceNeeds Review
560-okx