skills/okx-cex-earn/SKILL.md
Manages OKX Simple Earn (flexible savings/lending), Flash Earn, On-chain Earn (staking/DeFi), Dual Investment (DCD/双币赢), and AutoEarn (自动赚币) via the okx CLI. Use this skill whenever the user wants to check earn balances, browse flash-earn projects, subscribe or redeem earn products, view or set lending rates, monitor on-chain staking orders, interact with dual investment structured products, or manage auto-earn — even if phrased casually as 活期赚币, 定期赚币, 闪赚, 赚币, 申购, 赎回, 链上赚币, 质押, 理财, 双币赢, 双币理财, 双币申购, 高卖, 低买, dual investment, DCD, flash earn, buy low, sell high structured product, earn with target price, 目标价, 自动赚币, auto earn, auto-earn, 自动借出, 自动质押, auto lend, auto staking, USDG earn, USDG 赚币, 闲置资金自动理财, fixed earn, fixed deposit, term deposit, 定期理财, 定期. Also use when the user asks about idle funds and whether to earn on them.
npx skillsauth add okx/agent-skills okx-cex-earnInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before running any command, follow ../_shared/preflight.md.
Use metadata.version from this file's frontmatter as the reference for Step 2.
okx CLI:
npm install -g @okx_ai/okx-trade-cli
okx config init # select site -> follow browser OAuth flow
okx earn savings balanceSecurity: NEVER accept credentials in chat. Guide users to
okx config initfor setup.
Run both commands before any authenticated command — the apiKey field from okx auth status --json is the auth-binary's internal state and is always false regardless of whether ~/.okx/config.toml has an API-key profile. okx config show --json is the only authoritative source for API-key presence. The auth method is detected during preflight Step 2 and remembered for the session.
okx config show --json # reveals API-key profiles (TOML config)
okx auth status --json # reveals OAuth session state (auth-binary state)
Apply in this order — first match wins:
config show --json has any profile with a non-empty api_key field → API Key mode. Proceed.auth status --json returns "status":"logged_in" → OAuth mode. Proceed."status":"pending" — login is in progress, wait for it to complete."status":"not_logged_in" — stop, load okx-cex-auth skill and follow login steps, wait for completion.OKX Earn does not support demo mode. Always use live mode silently — don't mention it unless there's an error.
--profile <live-profile> (the profile without demo=true).On authentication errors (401 / "Session expired" / "Run okx auth login first"): stop immediately, load okx-cex-auth skill and follow re-authentication steps, then retry.
| 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, Flash Earn, On-chain Earn, Dual Investment (双币赢), or AutoEarn (自动赚币) | This skill |
| Command | Type | Auth | Description |
|---|---|---|---|
| earn savings balance [ccy] | READ | Required | Savings balance (all or specific currency). Also fetch fixed-term orders for a complete picture. |
| earn savings purchase --ccy --amt [--rate] | 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 | User's personal lending records with earnings detail |
| earn savings rate-history | READ | Required | Simple Earn lending rates and fixed-term offers (require auth) |
| earn savings fixed-orders [--ccy] [--state] | READ | Required | Query fixed-term (定期) orders. States: pending/earning/expired/settled/cancelled |
| earn savings fixed-purchase --ccy --amt --term [--confirm] | WRITE | Required | Subscribe to Simple Earn Fixed (定期). Without --confirm: preview only |
| earn savings fixed-redeem <reqId> | WRITE | Required | Redeem a fixed-term order (full amount). Only pending state orders can be redeemed early |
For full command syntax, rate field semantics, and confirmation templates, read {baseDir}/references/savings-commands.md.
| 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-and-buy --productId --sz --notionalCcy | WRITE | Required | Atomic subscribe: quote + execute in one step |
| 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-execute --ordId | WRITE | Required | Two-step early redemption: preview then execute |
DCD does not support demo/simulated trading mode. Always use live mode (API Key:
--profile <live-profile>; OAuth: no flag needed).
For full command syntax, product concepts, and error codes, read {baseDir}/references/dcd-commands.md.
| 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.
| Command | Type | Auth | Description |
|---|---|---|---|
| earn auto-earn status [CCY] | READ | Required | Query currencies supporting auto-earn and their status |
| earn auto-earn on <CCY> | WRITE | Required | Enable auto-earn for a currency |
| earn auto-earn off <CCY> | WRITE | Required | Disable auto-earn for a currency |
24h restriction: Cannot disable within 24 hours of enabling (API hard limit). Always warn user before enabling.
For full command syntax, earnType inference rules, and MCP tool reference, read {baseDir}/references/autoearn-commands.md.
| Command | Type | Auth | Description |
|---|---|---|---|
| earn flash-earn projects [--status <0\|100\|0,100>] | READ | Required | Browse Flash Earn projects by status. 0=upcoming, 100=in-progress, default is both |
Before any authenticated command: see Credential & Profile Check. Always use live mode silently.
Simple Earn Flexible (活期):
Simple Earn Fixed (定期):
{baseDir}/references/savings-commands.md for pre-execution checklists and confirmation templates.{baseDir}/references/workflows.md.On-chain Earn:
AutoEarn (自动赚币):
{baseDir}/references/autoearn-commands.md for confirmation templates and earnType inference.Flash Earn (闪赚):
--status 0 for upcoming projects, --status 100 for in-progress projects, or omit the flag to view both.When user asks to view "earn positions" or "赚币持仓" (regardless of whether they mention DCD explicitly), query all position-bearing sub-modules simultaneously (Flash Earn is query-only, no positions):
okx earn savings balance --json # Simple Earn Flexible (活期)
okx earn savings fixed-orders --json # Simple Earn Fixed (定期)
okx earn onchain orders --json # On-chain Earn
okx 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 / 双币赢):
{baseDir}/references/workflows.md (DCD browse flow) for the mandatory parallel pre-fetch before rendering the product table{baseDir}/references/workflows.md (DCD subscribe flow){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.
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.
After any purchase, verify based on product type:
quote-and-buy succeeded → run earn dcd orders --json, show only the matching order.ordId) → run earn onchain orders --json, show only the matching order.ordId in response) → run earn savings balance --ccy <ccy> --json.earn savings fixed-orders --ccy <ccy> --state pending --json, show the new order.Simple Earn Flexible 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 Flexible redeem: Run earn savings balance --ccy <ccy> to confirm updated balance. Inform user funds returned to funding account.
Simple Earn Fixed purchase: Run earn savings fixed-orders --ccy <ccy> --state pending --json to confirm the order was created. Show order details including APR, term, and expected expiry date.
Simple Earn Fixed redeem: Run earn savings fixed-orders --json to confirm the order state changed to cancelled. Inform user full principal returned to funding account — no interest earned for early cancellation.
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:
state: 3 (cancelling) → inform user: cancellation in progress, funds will return to funding account shortly.--json to list/query commands and render results as a Markdown table — never paste raw terminal output.curl -I https://www.okx.comFor number/time formatting and response structure conventions, read {baseDir}/references/templates.md.
development
Smart Money analytics on OKX: leaderboard traders, position tracking, trade records, closed-position history, aggregated consensus signals, and signal history. Use this skill when the user asks about 聪明钱, smart money, 牛人榜, leaderboard, top traders, 交易员排行, trader ranking, trader positions, trader PnL, 交易员持仓, 交易员收益, 历史平仓, closed positions, realized PnL track record, trade history, 成交记录, smart money signal, 聪明钱信号, long/short ratio, 多空比, capital flow, 资金流向, position conviction, 仓位强度, entry price distribution, smart money overview, 聪明钱总览, signal history, 信号历史, trader search, 搜索交易员, who is trading BTC, 谁在交易BTC, recommend traders, 推荐交易员, best traders, top performers.
tools
Use this skill when the user wants to 'login/log in/sign in', 'authenticate', 'authorize', 'connect OKX account', 'set up credentials', 'first time setup', 'configure okx', '登录', '授权', '认证', '连接账户', '首次配置'. Also when any OKX CLI command fails with an auth error: 'Run okx auth login first', 'Session expired', 'not authenticated', 'requires_auth', '401 Unauthorized', 'token expired/not found', 'StorageNotFoundError', '会话过期', '未认证', '需要登录'. Also when the user asks about login status or the login was interrupted. Also when the user wants to install/update/check/remove the okx-auth binary — 'install/update/remove auth', 'download okx-auth', '安装/更新/卸载认证', 'auth binary status', 'Failed to spawn okx-auth'. Also use before using okx-cex-trade/portfolio/earn/bot for the first time. Do NOT use for market data queries (use okx-cex-market).
development
Use this skill when the user asks about: 'any crypto news', 'latest news', 'market update', 'daily briefing', 'BTC news', 'ETH news', 'news on SOL', 'search SEC ETF', 'regulation news', 'Bitcoin halving', 'is BTC bullish or bearish', 'coin sentiment', 'sentiment trend', 'trending coins', 'top bullish coins', 'bearish sentiment', 'social buzz', 'market mood', 'fear and greed', 'full article', 'read more', 'economic calendar', '经济日历', 'macro data', '宏观数据', 'NFP', 'nonfarm', '非农', 'CPI', 'GDP', 'FOMC', '利率决议', 'interest rate decision', 'PMI', 'unemployment rate', '失业率', 'economic events', '经济事件', or any request for crypto news, market intelligence, sentiment analysis, social trend data, or macro-economic calendar. Requires API credentials. Do NOT use for market prices/candles (okx-cex-market), placing orders (okx-cex-trade), or account info (okx-cex-portfolio).
development
Use when the user asks to 'buy BTC', 'sell ETH', 'place a limit order', 'place a market order', 'cancel my order', 'amend my order', 'long BTC perp', 'short ETH swap', 'open a position', 'close a position', 'set take profit', 'limit take profit', 'immediate TP', 'set stop loss', 'self-trade prevention', 'stpMode', 'auto-cancel on close', 'trailing stop', 'pending order', 'chase order', 'iceberg', 'TWAP', 'split order', 'large order', 'set leverage', 'check my orders', 'fill history', 'buy a call', 'sell a put', 'option chain', 'implied volatility', 'IV', 'Greeks', 'delta', 'gamma', 'event contract', 'buy Yes', 'buy No', 'buy Up', 'buy Down', 'prediction market', or any request to place, cancel, or amend spot, swap, futures, options, or event contract orders on OKX CEX. Covers conditional (TP/SL/trailing) algo orders. Requires API credentials. Do NOT use for market data (okx-cex-market), account balance (okx-cex-portfolio), or bots (okx-cex-bot).