okx-cex-portfolio▌
okx/agent-skills · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Account balance, positions, P&L, bills, fees, and fund transfers on OKX exchange.
- ›Read and manage trading and funding account balances, open/closed positions, realized and unrealized P&L, transaction history, and fee tiers via CLI commands
- ›Requires OKX API credentials configured locally; supports both live (实盘) and demo (模拟盘) profiles with mandatory profile selection before each command
- ›Write operations (fund transfers, position mode switching) require explicit confirmation
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:npm install -g @okx_ai/okx-trade-cli - Configure credentials:
Or set environment variables:okx config initexport OKX_API_KEY=your_key export OKX_SECRET_KEY=your_secret export OKX_PASSPHRASE=your_passphrase - Test with demo mode:
okx --profile demo account balance
Credential & Profile Check
Run this check before any authenticated command.
Step A — Verify credentials
okx config show # verify configuration status (output is masked)
- If the command returns an error or shows no configuration: stop all operations, guide the user to run
okx config init, and wait for setup to complete before retrying. - If credentials are configured: proceed to Step B.
Step B — Confirm profile (required)
--profile is required for all authenticated commands. Never add a profile implicitly.
| Value | Mode | Funds |
|---|---|---|
live |
实盘 | Real funds |
demo |
模拟盘 | Simulated funds |
Resolution rules:
- Current message intent is clear (e.g. "real" / "实盘" / "live" →
live; "test" / "模拟" / "demo" →demo) → use it and inform the user:"Using --profile live (实盘)"or"Using --profile demo (模拟盘)" - Current message has no explicit declaration → check conversation context for a previous profile:
- Found → use it, inform user:
"Continuing with --profile live (实盘) from earlier" - Not found → ask:
"Live (实盘) or Demo (模拟盘)?"— wait for answer before proceeding
- Found → use it, inform user:
Handling 401 Authentication Errors
If any command returns a 401 / authentication error:
- Stop immediately — do not retry the same command
- Inform the user: "Authentication failed (401). Your API credentials may be invalid or expired."
- Guide the user to update credentials by editing the file directly with their local editor:
Update the fields~/.okx/config.tomlapi_key,secret_key,passphraseunder the relevant profile. Do NOT paste the new credentials into chat. - After the user confirms the file is updated, run
okx config showto verify (output is masked) - Only then retry the original operation
Demo vs Live Mode
Profile is the single control for 实盘/模拟盘 switching — exactly two options:
--profile |
Mode | Funds |
|---|---|---|
live |
实盘 | Real funds |
demo |
模拟盘 | Simulated funds |
okx --profile live account balance # 实盘
okx --profile demo account balance # 模拟盘 (simulated balance)
Rules:
- Read commands (balance, positions, bills, etc.): always state which profile was used
- Write commands (
transfer,set-position-mode): profile must be confirmed before execution (see "Credential & Profile Check" Step B); transfer especially — wrong profile means wrong account - Every response after a command must append:
[profile: live]or[profile: demo] - Do not use the
--demoflag — use--profileinstead
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
# Trading account balance (all currencies with balance > 0)
okx account balance
# Check USDT balance only
okx account balance USDT
# Funding account balance
okx account asset-balance
# All open positions
okx account positions
# Closed position history with realized PnL
okx account positions-history
# Recent account bills (last 100)
okx account bills
# My trading fee tier
okx account fees --instType SPOT
# Transfer 100 USDT from funding (18) to trading (6)
okx account transfer --ccy USDT --amt 100 --from 18 --to 6
Command Index
Read Commands
| # | Command | Type | Description |
|---|---|---|---|
| 1 | okx account balance [ccy] |
READ | Trading account equity, available, frozen |
| 2 | okx account asset-balance [ccy] [--valuation] |
READ | Funding account balance; --valuation adds earn/trading/funding valuation summary |
| 3 | okx account positions |
READ | Open contract/swap positions |
| 4 | okx account positions-history |
READ | Closed positions + realized PnL |
| 5 | okx account bills |
READ | Account ledger (deposits, withdrawals, trades) |
| 6 | okx account fees --instType <type> |
READ | My trading fee tier (maker/taker) |
| 7 | okx account config |
READ | Account level, position mode, UID |
| 8 | okx account max-size --instId <id> --tdMode <mode> |
READ | Max buy/sell size at current price |
| 9 | okx account max-avail-size --instId <id> --tdMode <mode> |
READ | Available size for next order |
| 10 | okx account max-withdrawal [ccy] |
READ | Max withdrawable per currency |
Write Commands
| # | Command | Type | Description |
|---|---|---|---|
| 11 | okx account set-position-mode <mode> |
WRITE | Switch net/hedge position mode |
| 12 | 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?"
1. okx-cex-portfolio okx account balance USDT → check available equity
2. okx-cex-market okx market ticker BTC-USDT → check current price
↓ user approves
3. okx-cex-trade okx spot place --instId BTC-USDT --side buy --ordType market --sz 0.1
Pre-bot balance check
User: "I want to start a BTC grid bot with 1000 USDT"
1. okx-cex-portfolio okx account balance USDT → confirm available funds ≥ 1000
2. okx-cex-market okx market candles BTC-USDT --bar 4H --limit 50 → determine price range
↓ user approves
3. okx-cex-bot okx bot grid create --instId BTC-USDT --algoOrdType grid \
--minPx 90000 --maxPx 100000 --gridNum 10 --quoteSz 1000
Review open positions and P&L
User: "Show me my current positions and how they're performing"
1. okx-cex-portfolio okx account positions → open positions with UPL
2. okx-cex-portfolio okx account positions-history → recently closed positions
3. okx-cex-market okx market ticker BTC-USDT-SWAP → check current price vs entry
Transfer and trade
User: "Move 500 USDT from my funding account to trade BTC"
1. okx-cex-portfolio okx account asset-balance USDT → confirm funding balance ≥ 500
↓ user approves
2. okx-cex-portfolio okx account transfer --ccy USDT --amt 500 --from 18 --to 6
3. okx-cex-portfolio okx account balance USDT → confirm trading balance updated
↓ ready to trade
4. okx-cex-trade okx spot place ...
Check max position size before entering
User: "How much BTC can I buy with cross margin?"
1. okx-cex-portfolio okx account balance → total equity
2. okx-cex-portfolio okx account max-size --instId BTC-USDT-SWAP --tdMode cross → max buy/sell size
3. okx-cex-market okx market ticker BTC-USDT-SWAP → current price reference
Operation Flow
Step 0 — Credential & Profile Check
Before any authenticated command:
Determine profile (required):
- Options:
live(实盘) ordemo(模拟盘) — exactly these two values
- Current message intent clear (e.g. "real"/"实盘"/"live" → live; "test"/"模拟"/"demo" → demo) → use it, inform user:
"Using --profile live (实盘)" - Current message has no explicit declaration → check conversation context for previous profile:
- Found → use it, inform user:
"Continuing with --profile live (实盘) from earlier" - Not found → ask:
"Live (实盘) or Demo (模拟盘)?"— wait for answer
- Found → use it, inform user:
If no credentials configured: guide user to run okx config init, stop all trading actions
After every command result: append [profile: live] or [profile: demo] to the response
Step 1: Identify account action
- Check balance →
okx account balance(trading) orokx account asset-balance(funding) - 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.
set-position-mode: confirm mode (net= one-directional,long_short_mode= hedge mode); switching may affect open positionstransfer: confirm--ccy,--amt,--from,--to(account types:6=trading,18=funding); verify source balance first
Step 3: Verify after writes
- After
set-position-mode: runokx account configto confirmposModeupdated - After
transfer: runokx account balanceandokx account asset-balanceto confirm balances updated
CLI Command Reference
Account Balance — Trading Account
okx account balance [ccy] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
ccy |
No | - | Filter to a single currency (e.g., USDT) |
Returns table: currency, equity, available, frozen. Only shows currencies with balance > 0.
Asset Balance — Funding Account
okx account asset-balance [ccy] [--valuation] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
ccy |
No | - | Filter to a single currency |
--valuation |
No | false | Also show total asset valuation across all account types (trading/funding/earn) |
Returns: ccy, bal, availBal, frozenBal. Only shows currencies with balance > 0.
With --valuation: additionally prints a valuation summary table with totalBal and per-account-type breakdown (classic/earn/funding).
Positions — Open Positions
okx account positions [--instType <type>] [--instId <id>] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
--instType |
No | - | Filter: SWAP, FUTURES, OPTION |
--instId |
No | - | Filter to specific instrument |
Returns: instId, instType, side (posSide), pos, avgPx, upl (unrealized PnL), lever. Only shows positions with size ≠ 0.
Positions History — Closed Positions
okx account positions-history [--instType <type>] [--instId <id>] [--limit <n>] [--json]
Returns: instId, direction, openAvgPx, closeAvgPx, realizedPnl, uTime.
Bills — Account Ledger
okx account bills [--archive] [--instType <type>] [--ccy <ccy>] [--limit <n>] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
--archive |
No | false | Access older records (archive endpoint) |
--instType |
No | - | Filter by instrument type |
--ccy |
No | - | Filter by currency |
--limit |
No | 100 | Number of records |
Returns: billId, instId, type, ccy, balChg, bal, ts.
Fees — Trading Fee Tier
okx account fees --instType <type> [--instId <id>] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
--instType |
Yes | - | SPOT, SWAP, FUTURES, OPTION |
--instId |
No | - | Specific instrument (optional) |
Returns: level, maker, taker, makerU, takerU, ts.
Config — Account Configuration
okx account config [--json]
Returns: uid, acctLv (account level), posMode (net/long_short_mode), autoLoan
How to use okx-cex-portfolio on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add okx-cex-portfolio
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches okx-cex-portfolio from GitHub repository okx/agent-skills and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate okx-cex-portfolio. Access the skill through slash commands (e.g., /okx-cex-portfolio) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★62 reviews- ★★★★★Noah Park· Dec 24, 2024
We added okx-cex-portfolio from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★William Rahman· Dec 8, 2024
okx-cex-portfolio fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★William Reddy· Nov 27, 2024
okx-cex-portfolio has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Ava Chawla· Nov 19, 2024
okx-cex-portfolio reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Mei Rao· Nov 15, 2024
Solid pick for teams standardizing on skills: okx-cex-portfolio is focused, and the summary matches what you get after install.
- ★★★★★Ava Bhatia· Oct 18, 2024
Solid pick for teams standardizing on skills: okx-cex-portfolio is focused, and the summary matches what you get after install.
- ★★★★★Nia Huang· Oct 10, 2024
Registry listing for okx-cex-portfolio matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Arjun Smith· Oct 6, 2024
okx-cex-portfolio has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Arjun Mehta· Sep 25, 2024
Keeps context tight: okx-cex-portfolio is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Carlos Johnson· Sep 21, 2024
okx-cex-portfolio reduced setup friction for our internal harness; good balance of opinion and flexibility.
showing 1-10 of 62