okx/agent-skills/okx-cex-portfolio
Claude Code and agent skill by okx/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
This skill should be used when the user asks about 'account balance', 'how much USDT do I have', 'my funding account', 'show my positions', 'open positions', 'position P&L', 'unrealized PnL', 'closed positions', 'position history', 'realized PnL', 'account bills', 'transaction history', 'trading fees', 'fee tier', 'account config', 'max order size', 'how much can I buy', 'withdrawable amount', 'transfer funds', 'move USDT to trading account', or 'switch position mode'. Also use for '总资产', 'full balance', 'all assets', 'total holdings', 'net worth', 'how much do I have in total', 'show all my balances', 'all account balances', 'asset overview', 'aggregated balance', 'asset snapshot', '资产快照'. Requires API credentials. Do NOT use for market prices (use okx-cex-market), placing/cancelling orders (use okx-cex-trade), or grid/DCA bots (use okx-cex-bot).
Install
npx vskill@latest install okx/agent-skills/okx-cex-portfolioSKILL.md
OKX CEX Portfolio & Account CLI
Account balance, positions, P&L, bills, fees, and fund transfers on OKX exchange. Requires API credentials.
Preflight
Before running any command, follow `../_shared/preflight.md`. Use metadata.version from this file's frontmatter as the reference for Step 2.
Prerequisites
- Install
okxCLI:
``bash npm install -g @okx_ai/okx-trade-cli ``
- Configure credentials:
``bash okx config init # select site -> follow browser OAuth flow ``
- Test with demo mode (simulated trading, no real funds):
``bash okx --demo account balance ``
Security: NEVER accept credentials in chat. Guide users tookx config initfor setup.
Credential & Profile Check
Run this check before any authenticated command. The auth method is detected during preflight Step 2 and remembered for the session.
Step A — Verify credentials
Check both sources (see preflight Step 2 for the decision table). okx auth status --json alone is insufficient — its apiKey field is always false and does NOT reflect the TOML config.
Branch in this order — first match wins:
config showhas any profile with a non-emptyapi_key— API Key mode. Proceed to Step B.- No API-key profile AND
auth statusreturns"status": "logged_in"— OAuth mode. Proceed to Step B. - No API-key profile AND
auth statusreturns"status": "pending"— login in progress, wait. - No API-key profile AND
auth statusreturns"status": "not_logged_in"— stop all operations, loadokx-cex-authskill and follow login steps, wait for completion.
Step B — Confirm trading mode
Resolution rules:
- Current message intent is clear (e.g. "real" / "实盘" / "live" → live; "test" / "模拟" / "demo" → demo) → use it and inform the user
- Current message has no explicit declaration → check conversation context for a previous choice:
- Found → reuse it, inform user
- Not found → ask:
"Live (实盘) or Demo (模拟盘)?"— wait for answer before proceeding
How to apply the mode depends on auth method (detected in Step A):
| Auth method | Live (实盘) | Demo (模拟盘) | |
|---|---|---|---|
| API Key | --profile <live-profile> | --profile <demo-profile> | |
| OAuth | (no flag needed, live is default) | --demo |
- API Key users: run
okx config show --jsonto discover available profile names and theirdemosettings. Use--profile <name>to select the correct one. - OAuth users: omit flags for live trading; add
--demofor simulated trading. Do not use--profileto switch modes.
Handling Authentication Errors
Authentication error (error contains "401", "Session expired", or "Run okx auth login first"):
- Stop immediately — do not retry the same command
- Inform the user: "Authentication failed. Your session may have expired."
- Load
okx-cex-authskill and follow the re-authentication steps - After successful re-authentication, retry the original command
Demo vs Live Mode
| Mode | Funds | API Key param | OAuth param | |
|---|---|---|---|---|
| 实盘 (live) | Real funds | --profile <live-profile> | (default, no flag) | |
| 模拟盘 (demo) | Simulated funds | --profile <demo-profile> | --demo |
Rules:
- Read commands (balance, positions, bills, etc.): always state which mode was used
- Write commands (
transfer,set-position-mode): mode must be confirmed before execution (see "Credential & Profile Check" Step B); transfer especially — wrong mode means wrong account - Every response after a command must append:
[mode: live]or[mode: demo]
Skill Routing
- For market data (prices, charts, depth, funding rates) → use
okx-cex-market - For account balance, P&L, positions, fees, transfers → use
okx-cex-portfolio(this skill) - For regular spot/swap/futures/algo orders → use
okx-cex-trade - For grid and DCA trading bots → use
okx-cex-bot
Quickstart
Command Index
Read Commands
| # | Command | Type | Description | |||||
|---|---|---|---|---|---|---|---|---|
| 1 | okx account balance-all [ccy] | READ | One-shot snapshot: trading + funding (+ valuation) in one call | |||||
| 2 | okx account balance [ccy] | READ | Trading account equity, available, frozen | |||||
| 3a | okx account asset-balance [ccy] | READ | Funding account balance (per-currency list) | |||||
| 3b | okx account asset-balance [ccy] --valuation [--valuationCcy <ccy>] | READ | Same + total asset valuation across trading/funding/earn; denomination defaults to USDT, override with --valuationCcy BTC | |||||
| 4 | okx account positions [--instType <type>] [--instId <id>] | READ | Open contract/swap positions. When the user names a product ("my swap positions", "futures positions", "option positions"), pass --instType <type> (SWAP \ | FUTURES \ | OPTION \ | MARGIN \ | EVENTS) — or use that product's own command (okx swap positions, okx futures positions, okx option positions). Only omit the filter when the user genuinely wants everything: an unfiltered list is larger and leaves the product filtering to the model, which is where mistakes happen | |
| 5 | okx account positions-history | READ | Closed positions + realized PnL | |||||
| 6 | okx account bills | READ | Account ledger (deposits, withdrawals, trades) | |||||
| 7 | okx account fees --instType <type> | READ | My trading fee tier (maker/taker) | |||||
| 8 | okx account config | READ | Account level, position mode, UID | |||||
| 9 | okx account max-size --instId <id> --tdMode <mode> | READ | Max buy/sell size at current price | |||||
| 10 | okx account max-avail-size --instId <id> --tdMode <mode> | READ | Available size for next order | |||||
| 11 | okx account max-withdrawal [ccy] | READ | Max withdrawable per currency |
Write Commands
| # | Command | Type | Description | |
|---|---|---|---|---|
| 12 | okx account set-position-mode <mode> | WRITE | Switch net/hedge position mode | |
| 13 | okx account transfer | WRITE | Transfer funds between accounts |
Cross-Skill Workflows
Pre-trade balance check
User: "I want to buy 0.1 BTC — do I have enough USDT?"
Pre-bot balance check
User: "I want to start a BTC grid bot with 1000 USDT"
Net worth quick view
User: "What's my total balance?" / "总资产多少?"
Review open positions and P&L
User: "Show me my current positions and how they're performing"
Transfer and trade
User: "Move 500 USDT from my funding account to trade BTC"
Check max position size before entering
User: "How much BTC can I buy with cross margin?"
Operation Flow
Step 0 — Credential & Profile Check
Before any authenticated command: see Credential & Profile Check. Determine auth method and trading mode before executing.
After every command result: append [mode: live] or [mode: demo] to the response
Step 1: Identify account action
- Check all balances at once →
okx account balance-all(trading + funding + valuation in one call; recommended for "总资产 / net worth / all balances") - Check balance →
okx account balance(trading equity only) orokx account asset-balance(funding balances) orokx account asset-balance --valuation(total across all accounts in USDT) - View open positions →
okx account positions - View closed positions + PnL →
okx account positions-history - View transaction history →
okx account bills - Check fee tier →
okx account fees - Check account settings →
okx account config - Calculate order size →
okx account max-sizeorokx account max-avail-size - Check withdrawal limit →
okx account max-withdrawal - Transfer funds →
okx account transfer - Change position mode →
okx account set-position-mode
Step 2: Run read commands immediately — confirm profile (Step 0) then writes
Read commands (1–10): run immediately, no confirmation needed.
ccyfilter: use currency symbol likeUSDT,BTC,ETH--instTypefor fees/positions:SPOT,SWAP,FUTURES,OPTION--archivefor bills: access older records beyond the default window--tdModefor max-size:cash(spot),cross, orisolated
Write commands (11–12): confirm once before executing.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/okx-cex-portfolio/SKILL.md
Popularity
- Repository stars
- 43
- Repository forks
- 6
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 17 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/okx/agent-skills/okx-cex-portfolio)