
Okx Cex Portfolio
Query OKX funding and trading balances, open positions, P&L, bills, fees, limits, and internal transfers through the okx CLI with API credentials.
Overview
OKX CEX Portfolio is an agent skill for the Operate phase that exposes OKX account balances, positions, P&L, bills, fees, limits, and transfers via the okx CLI when API credentials are configured.
Install
npx skills add https://github.com/okx/agent-skills --skill okx-cex-portfolioWhat is this skill?
- Balances across funding and trading accounts including total-asset and full-holdings style queries (English and Chinese
- Open and closed positions with unrealized and realized P&L plus position history
- Account bills, fee tier, and account configuration including max order size and withdrawable amounts
- Fund transfers between accounts (e.g. move USDT into trading) and position-mode switches
- Explicit routing: use okx-cex-market for prices, okx-cex-trade for orders, okx-cex-bot for grid/DCA—requires okx CLI via
- Skill metadata version 1.3.2
- Install package @okx_ai/okx-trade-cli@1.3.2
Adoption & trust: 6.9k installs on skills.sh; 134 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You cannot safely answer “how much do I have,” “what are my positions,” or “move USDT to trading” from chat without calling OKX account APIs through a consistent CLI workflow.
Who is it for?
Builders running OKX with API keys who want the agent to inspect balances, positions, history, and internal transfers without opening the exchange UI.
Skip if: Users without API credentials, anyone who only needs spot quotes or charts (okx-cex-market), order placement or cancels (okx-cex-trade), or grid/DCA bots (okx-cex-bot).
When should I use this skill?
User asks about account balance, positions, P&L, bills, fees, account config, withdrawable amount, transfers, position mode, or total/full balance wording (including 总资产)—with API credentials; not for market prices,
What do I get? / Deliverables
The agent returns authoritative portfolio and account data from OKX and can perform documented transfers or mode switches while deferring prices, orders, and bots to the matching OKX skills.
- CLI-backed account balance and position snapshots
- Transfer or position-mode actions when explicitly requested
Recommended Skills
Journey fit
Portfolio and account state are day-two operations after you are live on OKX—reconciling holdings, risk, and fund placement across accounts. Infra covers exchange connectivity, credential-backed tooling, and account topology (funding vs trading, withdrawable amounts, transfers)—not placing orders or reading public market data.
How it compares
Account and portfolio read layer for OKX— not a market-data skill and not a trade-execution skill.
Common Questions / FAQ
Who is okx-cex-portfolio for?
Solo builders and small teams who automate or assist trading workflows on OKX and need the agent to read balances, positions, P&L, fees, and move funds between accounts using the official okx CLI.
When should I use okx-cex-portfolio?
Use it during Operate when reconciling holdings, checking open or closed positions, reviewing bills and fee tier, confirming max buy or withdrawable size, or transferring USDT between funding and trading accounts—and whenever users ask in English or Chinese for total assets or fu
Is okx-cex-portfolio safe to install?
It requires exchange API secrets and shell/network access via the okx CLI; review the Security Audits panel on this Prism page and scope API keys to least privilege before installing.
SKILL.md
READMESKILL.md - Okx Cex Portfolio
# 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`](../_shared/preflight.md). Use `metadata.version` from this file's frontmatter as the reference for Step 2. ## Prerequisites 1. Install `okx` CLI: ```bash npm install -g @okx_ai/okx-trade-cli ``` 2. Configure credentials: ```bash okx config init # select site -> follow browser OAuth flow ``` 3. Test with demo mode (simulated trading, no real funds): ```bash okx --demo account balance ``` > **Security**: NEVER accept credentials in chat. Guide users to `okx config init` for setup. ## Credential & Profile Check **Run this check before any authenticated command.** The auth method is detected during [preflight](../_shared/preflight.md) Step 2 and remembered for the session. ### Step A — Verify credentials Check **both** sources (see [preflight Step 2](../_shared/preflight.md#step-2--detect-auth-method-once-per-session) for the decision table). `okx auth status --json` alone is insufficient — its `apiKey` field is always `false` and does NOT reflect the TOML config. ```bash okx config show --json # authoritative for API-key presence okx auth status --json # authoritative for OAuth session state ``` Branch in this order — first match wins: - `config show` has any profile with a non-empty `api_key` — **API Key mode**. Proceed to Step B. - No API-key profile **AND** `auth status` returns `"status": "logged_in"` — **OAuth mode**. Proceed to Step B. - No API-key profile **AND** `auth status` returns `"status": "pending"` — login in progress, wait. - No API-key profile **AND** `auth status` returns `"status": "not_logged_in"` — **stop all operations**, load `okx-cex-auth` skill and follow login steps, wait for completion. ### Step B — Confirm trading mode **Resolution rules:** 1. Current message intent is clear (e.g. "real" / "实盘" / "live" → live; "test" / "模拟" / "demo" → demo) → use it and inform the user 2. 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 --json` to discover available profile names and their `demo` settings. Use `--profile <name>` to select the correct one. - **OAuth users**: omit flags for live trading; add `--demo` for simulated trading. Do **not** use