{"skill":{"slug":"okx-cex-portfolio","displayName":"okx-cex-portfolio","summary":"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',...","description":"---\nname: okx-cex-portfolio\ndescription: \"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).\"\nlicense: MIT\nmetadata:\n  author: okx\n  version: \"1.3.7\"\n  homepage: \"https://www.okx.com\"\n  agent:\n    requires:\n      bins: [\"okx\"]\n    install:\n      - id: npm\n        kind: node\n        package: \"@okx_ai/okx-trade-cli@1.3.7\"\n        bins: [\"okx\"]\n        label: \"Install okx CLI (npm)\"\n---\n\n# OKX CEX Portfolio & Account CLI\n\nAccount balance, positions, P&L, bills, fees, and fund transfers on OKX exchange. **Requires API credentials.**\n\n## Preflight\n\nBefore running any command, follow [`../_shared/preflight.md`](../_shared/preflight.md).\nUse `metadata.version` from this file's frontmatter as the reference for Step 2.\n\n## Prerequisites\n\n1. Install `okx` CLI:\n   ```bash\n   npm install -g @okx_ai/okx-trade-cli\n   ```\n2. Configure credentials:\n   ```bash\n   okx config init   # select site -> follow browser OAuth flow\n   ```\n3. Test with demo mode (simulated trading, no real funds):\n   ```bash\n   okx --demo account balance\n   ```\n\n> **Security**: NEVER accept credentials in chat. Guide users to `okx config init` for setup.\n\n## Credential & Profile Check\n\n**Run this check before any authenticated command.** The auth method is detected during [preflight](../_shared/preflight.md) Step 2 and remembered for the session.\n\n### Step A — Verify credentials\n\nCheck **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.\n\n```bash\nokx config show --json      # authoritative for API-key presence\nokx auth status --json      # authoritative for OAuth session state\n```\n\nBranch in this order — first match wins:\n\n- `config show` has any profile with a non-empty `api_key` — **API Key mode**. Proceed to Step B.\n- No API-key profile **AND** `auth status` returns `\"status\": \"logged_in\"` — **OAuth mode**. Proceed to Step B.\n- No API-key profile **AND** `auth status` returns `\"status\": \"pending\"` — login in progress, wait.\n- 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.\n\n### Step B — Confirm trading mode\n\n**Resolution rules:**\n1. Current message intent is clear (e.g. \"real\" / \"实盘\" / \"live\" → live; \"test\" / \"模拟\" / \"demo\" → demo) → use it and inform the user\n2. Current message has no explicit declaration → check conversation context for a previous choice:\n   - Found → reuse it, inform user\n   - Not found → ask: `\"Live (实盘) or Demo (模拟盘)?\"` — wait for answer before proceeding\n\n**How to apply the mode depends on auth method (detected in Step A):**\n\n| Auth method | Live (实盘) | Demo (模拟盘) |\n|---|---|---|\n| **API Key** | `--profile <live-profile>` | `--profile <demo-profile>` |\n| **OAuth** | *(no flag needed, live is default)* | `--demo` |\n\n- **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.\n- **OAuth users**: omit flags for live trading; add `--demo` for simulated trading. Do **not** use `--profile` to switch modes.\n\n### Handling Authentication Errors\n\n**Authentication error** (error contains \"401\", \"Session expired\", or \"Run `okx auth login` first\"):\n1. **Stop immediately** — do not retry the same command\n2. Inform the user: \"Authentication failed. Your session may have expired.\"\n3. Load `okx-cex-auth` skill and follow the re-authentication steps\n4. After successful re-authentication, retry the original command\n\n## Demo vs Live Mode\n\n| Mode | Funds | API Key param | OAuth param |\n|---|---|---|---|\n| 实盘 (live) | Real funds | `--profile <live-profile>` | *(default, no flag)* |\n| 模拟盘 (demo) | Simulated funds | `--profile <demo-profile>` | `--demo` |\n\n```bash\n# API Key user\nokx --profile okx-prod  account balance     # 实盘\nokx --profile okx-demo  account balance     # 模拟盘\n\n# OAuth user\nokx account balance                          # 实盘 (default)\nokx --demo account balance                   # 模拟盘\n```\n\n**Rules:**\n- **Read commands** (balance, positions, bills, etc.): always state which mode was used\n- **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\n- Every response after a command must append: `[mode: live]` or `[mode: demo]`\n\n## Skill Routing\n\n- For market data (prices, charts, depth, funding rates) → use `okx-cex-market`\n- For account balance, P&L, positions, fees, transfers → use `okx-cex-portfolio` (this skill)\n- For regular spot/swap/futures/algo orders → use `okx-cex-trade`\n- For grid and DCA trading bots → use `okx-cex-bot`\n\n## Quickstart\n\n```bash\n# One-shot full asset snapshot (recommended first command)\nokx account balance-all\nokx account balance-all --no-valuation\nokx account balance-all --valuationCcy BTC\n\n# Trading account balance (all currencies with balance > 0)\nokx account balance\n\n# Check USDT balance only\nokx account balance USDT\n\n# Funding account balance\nokx account asset-balance\n\n# All open positions\nokx account positions\n\n# Closed position history with realized PnL\nokx account positions-history\n\n# Recent account bills (last 100)\nokx account bills\n\n# My trading fee tier\nokx account fees --instType SPOT\n\n# Transfer 100 USDT from funding (6) to trading (18)\nokx account transfer --ccy USDT --amt 100 --from 6 --to 18\n```\n\n## Command Index\n\n### Read Commands\n\n| # | Command | Type | Description |\n|---|---|---|---|\n| 1 | `okx account balance-all [ccy]` | READ | One-shot snapshot: trading + funding (+ valuation) in one call |\n| 2 | `okx account balance [ccy]` | READ | Trading account equity, available, frozen |\n| 3a | `okx account asset-balance [ccy]` | READ | Funding account balance (per-currency list) |\n| 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` |\n| 4 | `okx account positions` | READ | Open contract/swap positions |\n| 5 | `okx account positions-history` | READ | Closed positions + realized PnL |\n| 6 | `okx account bills` | READ | Account ledger (deposits, withdrawals, trades) |\n| 7 | `okx account fees --instType <type>` | READ | My trading fee tier (maker/taker) |\n| 8 | `okx account config` | READ | Account level, position mode, UID |\n| 9 | `okx account max-size --instId <id> --tdMode <mode>` | READ | Max buy/sell size at current price |\n| 10 | `okx account max-avail-size --instId <id> --tdMode <mode>` | READ | Available size for next order |\n| 11 | `okx account max-withdrawal [ccy]` | READ | Max withdrawable per currency |\n\n### Write Commands\n\n| # | Command | Type | Description |\n|---|---|---|---|\n| 12 | `okx account set-position-mode <mode>` | WRITE | Switch net/hedge position mode |\n| 13 | `okx account transfer` | WRITE | Transfer funds between accounts |\n\n## Cross-Skill Workflows\n\n### Pre-trade balance check\n> User: \"I want to buy 0.1 BTC — do I have enough USDT?\"\n\n```\n1. okx-cex-portfolio okx account balance-all                 → one-shot trading + funding + valuation snapshot\n   → check trading.details (available in trading account)\n   → if trading balance < needed: check funding.details — may need to transfer\n2. okx-cex-market    okx market ticker BTC-USDT              → check current price\n        ↓ user approves\n3. okx-cex-trade     okx spot place --instId BTC-USDT --side buy --ordType market --sz 0.1\n```\n\n### Pre-bot balance check\n> User: \"I want to start a BTC grid bot with 1000 USDT\"\n\n```\n1. okx-cex-portfolio okx account balance-all                 → one-shot trading + funding + valuation snapshot\n   → check trading.details ≥ 1000 (funds must be in trading account for grid bot)\n   → if funding.details has the USDT instead: use account transfer first\n2. okx-cex-market    okx market candles BTC-USDT --bar 4H --limit 50  → determine price range\n        ↓ user approves\n3. okx-cex-bot       okx bot grid create --instId BTC-USDT --algoOrdType grid \\\n                       --minPx 90000 --maxPx 100000 --gridNum 10 --quoteSz 1000\n```\n\n### Net worth quick view\n> User: \"What's my total balance?\" / \"总资产多少?\"\n\n```\n1. okx-cex-portfolio okx account balance-all                 → returns {trading, funding, valuation, meta}\n   → valuation.totalBal = total net worth in USDT\n   → trading.totalEq = trading account equity\n   → funding.details = per-currency funding balances\n   → meta.partialFailure = true if any section failed (still returns available data)\n```\n\n### Review open positions and P&L\n> User: \"Show me my current positions and how they're performing\"\n\n```\n1. okx-cex-portfolio okx account positions                  → open positions with UPL\n2. okx-cex-portfolio okx account positions-history          → recently closed positions\n3. okx-cex-market    okx market ticker BTC-USDT-SWAP        → check current price vs entry\n```\n\n### Transfer and trade\n> User: \"Move 500 USDT from my funding account to trade BTC\"\n\n```\n1. okx-cex-portfolio okx account asset-balance USDT         → confirm funding balance ≥ 500\n        ↓ user approves\n2. okx-cex-portfolio okx account transfer --ccy USDT --amt 500 --from 6 --to 18\n3. okx-cex-portfolio okx account balance USDT               → confirm trading balance updated\n        ↓ ready to trade\n4. okx-cex-trade     okx spot place ...\n```\n\n### Check max position size before entering\n> User: \"How much BTC can I buy with cross margin?\"\n\n```\n1. okx-cex-portfolio okx account balance                    → total equity\n2. okx-cex-portfolio okx account max-size --instId BTC-USDT-SWAP --tdMode cross  → max buy/sell size\n3. okx-cex-market    okx market ticker BTC-USDT-SWAP        → current price reference\n```\n\n## Operation Flow\n\n### Step 0 — Credential & Profile Check\n\nBefore any authenticated command: see [Credential & Profile Check](#credential--profile-check). Determine auth method and trading mode before executing.\n\n**After every command result:** append `[mode: live]` or `[mode: demo]` to the response\n\n### Step 1: Identify account action\n\n- Check all balances at once → `okx account balance-all` (trading + funding + valuation in one call; recommended for \"总资产 / net worth / all balances\")\n- Check balance → `okx account balance` (trading equity only) or `okx account asset-balance` (funding balances) or `okx account asset-balance --valuation` (total across all accounts in USDT)\n- View open positions → `okx account positions`\n- View closed positions + PnL → `okx account positions-history`\n- View transaction history → `okx account bills`\n- Check fee tier → `okx account fees`\n- Check account settings → `okx account config`\n- Calculate order size → `okx account max-size` or `okx account max-avail-size`\n- Check withdrawal limit → `okx account max-withdrawal`\n- Transfer funds → `okx account transfer`\n- Change position mode → `okx account set-position-mode`\n\n### Step 2: Run read commands immediately — confirm profile (Step 0) then writes\n\n**Read commands** (1–10): run immediately, no confirmation needed.\n\n- `ccy` filter: use currency symbol like `USDT`, `BTC`, `ETH`\n- `--instType` for fees/positions: `SPOT`, `SWAP`, `FUTURES`, `OPTION`\n- `--archive` for bills: access older records beyond the default window\n- `--tdMode` for max-size: `cash` (spot), `cross`, or `isolated`\n\n**Write commands** (11–12): confirm once before executing.\n\n- `set-position-mode`: confirm mode (`net` = one-directional, `long_short_mode` = hedge mode); switching may affect open positions\n- `transfer`: confirm `--ccy`, `--amt`, `--from`, `--to` (account types: `6`=funding, `18`=trading); verify source balance first\n\n### Step 3: Verify after writes\n\n- After `set-position-mode`: run `okx account config` to confirm `posMode` updated\n- After `transfer`: run `okx account balance` and `okx account asset-balance` to confirm balances updated\n\n## CLI Command Reference\n\n### Balance All — One-Shot Aggregate Snapshot\n\n```bash\nokx account balance-all [ccy] [--accounts trading,funding] [--no-valuation] [--no-aggregate] [--valuationCcy <ccy>] [--json]\n```\n\n| Param | Required | Default | Description |\n|---|---|---|---|\n| `ccy` | No | - | Filter by currency (comma-separated). Applied to trading + funding queries only. |\n| `--accounts` | No | `trading,funding` | Comma-separated accounts to query |\n| `--no-valuation` | No | - | Skip cross-account valuation (default: valuation included) |\n| `--no-aggregate` | No | - | Force the direct parallel path instead of the server aggregate. Use when you need the per-account valuation breakdown, or a non-USD `--valuationCcy` (the aggregate path denominates valuation in USD). |\n| `--valuationCcy` | No | `USDT` | Denomination currency for valuation |\n\nThis command calls a server-side aggregate endpoint first and automatically falls back to direct parallel queries when it is unavailable; the output contract is identical either way.\n\nReturns `{ trading, funding, valuation, meta }`. Each section has `available: boolean`:\n- `trading`: `totalEq`, `adjEq`, `details[]` (per-currency)\n- `funding`: `details[]` (per-currency `ccy`, `bal`, `availBal`, `frozenBal`)\n- `valuation`: `valuationCcy`, `totalBal`, `details[]` (per-account breakdown is only populated on the parallel path; use `--no-aggregate` to force it)\n- `meta`: `requestedAt` (ISO 8601), `elapsedMs`, `partialFailure`, `source` (`aggregate` or `fallback`), `site`\n\nWhen `--json` is NOT set: prints `[PARTIAL]` banner if `meta.partialFailure=true`, followed by three sections (Trading / Funding / Valuation), then a `[source: ...]` footer showing which path served the data. Failed sections show `[ERROR: <msg>]`.\n\n---\n\n### Account Balance — Trading Account\n\n```bash\nokx account balance [ccy] [--json]\n```\n\n| Param | Required | Default | Description |\n|---|---|---|---|\n| `ccy` | No | - | Filter to a single currency (e.g., `USDT`) |\n\nReturns table: `currency`, `equity`, `available`, `frozen`. Only shows currencies with balance > 0.\n\n---\n\n### Asset Balance — Funding Account\n\n```bash\nokx account asset-balance [ccy] [--valuation] [--valuationCcy <ccy>] [--json]\n```\n\n| Param | Required | Default | Description |\n|---|---|---|---|\n| `ccy` | No | - | Filter to a specific currency (e.g., `USDT`); does not affect valuation denomination |\n| `--valuation` | No | false | Also show total asset valuation across all account types (trading/funding/earn) |\n| `--valuationCcy` | No | `USDT` | Currency in which to denominate the total asset valuation (e.g., `USDT`, `BTC`). Only used when `--valuation` is set. |\n\nReturns: `ccy`, `bal`, `availBal`, `frozenBal`. Only shows currencies with balance > 0.\n\nWith `--valuation`: additionally prints a valuation summary table with `totalBal` and per-account-type breakdown (`classic`/`earn`/`funding`/`trading`). The numbers are denominated in `--valuationCcy` (default `USDT`).\n\n**Important**: `ccy` (balance filter) and `--valuationCcy` (valuation denomination) are independent parameters — `ccy=BTC` filters the balance list to BTC rows but does NOT change the valuation currency; set `--valuationCcy BTC` explicitly for BTC-denominated totals.\n\n---\n\n### Positions — Open Positions\n\n```bash\nokx account positions [--instType <type>] [--instId <id>] [--json]\n```\n\n| Param | Required | Default | Description |\n|---|---|---|---|\n| `--instType` | No | - | Filter: `SWAP`, `FUTURES`, `OPTION` |\n| `--instId` | No | - | Filter to specific instrument |\n\nReturns: `instId`, `instType`, `side` (posSide), `pos`, `avgPx`, `upl` (unrealized PnL), `lever`. Only shows positions with size ≠ 0.\n\n---\n\n### Positions History — Closed Positions\n\n```bash\nokx account positions-history [--instType <type>] [--instId <id>] [--limit <n>] [--json]\n```\n\nReturns: `instId`, `direction`, `openAvgPx`, `closeAvgPx`, `realizedPnl`, `uTime`.\n\n---\n\n### Bills — Account Ledger\n\n```bash\nokx account bills [--archive] [--instType <type>] [--ccy <ccy>] [--limit <n>] [--json]\n```\n\n| Param | Required | Default | Description |\n|---|---|---|---|\n| `--archive` | No | false | Access older records (archive endpoint) |\n| `--instType` | No | - | Filter by instrument type |\n| `--ccy` | No | - | Filter by currency |\n| `--limit` | No | 100 | Number of records |\n\nReturns: `billId`, `instId`, `type`, `ccy`, `balChg`, `bal`, `ts`.\n\n---\n\n### Fees — Trading Fee Tier\n\n```bash\nokx account fees --instType <type> [--instId <id>] [--json]\n```\n\n| Param | Required | Default | Description |\n|---|---|---|---|\n| `--instType` | Yes | - | `SPOT`, `SWAP`, `FUTURES`, `OPTION` |\n| `--instId` | No | - | Specific instrument (optional) |\n\nReturns: `level`, `maker`, `taker`, `makerU`, `takerU`, `ts`.\n\n---\n\n### Config — Account Configuration\n\n```bash\nokx account config [--json]\n```\n\nReturns: `uid`, `acctLv` (account level), `posMode` (net/long_short_mode), `autoLoan`, `greeksType`, `level`, `levelTmp`.\n\n---\n\n### Max Size — Maximum Order Size\n\n```bash\nokx account max-size --instId <id> --tdMode <mode> [--px <price>] [--json]\n```\n\n| Param | Required | Default | Description |\n|---|---|---|---|\n| `--instId` | Yes | - | Instrument ID |\n| `--tdMode` | Yes | - | `cash` (spot), `cross`, or `isolated` |\n| `--px` | No | - | Reference price (uses mark price if omitted) |\n\nReturns: `instId`, `maxBuy`, `maxSell`.\n\n---\n\n### Max Available Size\n\n```bash\nokx account max-avail-size --instId <id> --tdMode <mode> [--json]\n```\n\nReturns: `instId`, `availBuy`, `availSell` — the immediately available size for the next order.\n\n---\n\n### Max Withdrawal\n\n```bash\nokx account max-withdrawal [ccy] [--json]\n```\n\nReturns table: `ccy`, `maxWd`, `maxWdEx` (with borrowing). Shows all currencies if no filter.\n\n---\n\n### Set Position Mode\n\n```bash\nokx account set-position-mode <net|long_short_mode> [--json]\n```\n\n| Value | Behavior |\n|---|---|\n| `net` | One-directional (default) — long and short net out |\n| `long_short_mode` | Hedge mode — long and short can coexist |\n\n> **Warning**: Switching modes when positions are open may cause unexpected behavior. Check `okx account positions` first.\n\n---\n\n### Transfer Funds\n\n```bash\nokx account transfer --ccy <ccy> --amt <n> --from <acctType> --to <acctType> \\\n  [--transferType <type>] [--subAcct <name>] [--json]\n```\n\n| Param | Required | Default | Description |\n|---|---|---|---|\n| `--ccy` | Yes | - | Currency to transfer (e.g., `USDT`) |\n| `--amt` | Yes | - | Amount to transfer |\n| `--from` | Yes | - | Source account type: `6`=funding, `18`=trading |\n| `--to` | Yes | - | Destination account type: `6`=funding, `18`=trading |\n| `--transferType` | No | `0` | `0`=within account, `1`=to sub-account, `2`=from sub-account |\n| `--subAcct` | No | - | Sub-account name (required for sub-account transfers) |\n\nReturns: `transId`, `ccy`, `amt`.\n\n---\n\n## MCP Tool Reference\n\n| Tool | Description |\n|---|---|\n| `account_get_balance_all` | One-shot snapshot of trading + funding (+ valuation), served by a server-side aggregate endpoint with automatic fallback to parallel queries. Use `showValuation=true` (default) to include cross-account totals; `valuationCcy='USDT'` by default. Set `preferParallel=true` to force the parallel path (per-account valuation breakdown / non-USD valuation). Prefer over calling `account_get_balance` + `account_get_asset_balance` separately. |\n| `account_get_balance` | Trading account balance |\n| `account_get_asset_balance` | Funding account balance. Use `showValuation=true` to include total asset valuation across trading/funding/earn accounts. Use `valuationCcy` (default `\"USDT\"`) to set the denomination for the valuation total — e.g. `valuationCcy=\"BTC\"` returns the total in BTC. |\n| `account_get_positions` | Open positions |\n| `account_get_positions_history` | Closed position history |\n| `account_get_bills` | Account bills (recent) |\n| `account_get_bills_archive` | Account bills (archive) |\n| `account_get_trade_fee` | Trading fee tier |\n| `account_get_config` | Account configuration |\n| `account_get_max_size` | Max order size |\n| `account_get_max_avail_size` | Max available size |\n| `account_get_max_withdrawal` | Max withdrawable |\n| `account_set_position_mode` | Set position mode |\n| `account_transfer` | Transfer between accounts |\n\n---\n\n## Input / Output Examples\n\n**\"How much USDT do I have?\"**\n```bash\nokx account balance USDT\n# → currency: USDT | equity: 5000.00 | available: 4500.00 | frozen: 500.00\n```\n\n**\"Show all my open positions\"**\n```bash\nokx account positions\n# → table: instId, instType, side, pos, avgPx, upl, lever\n```\n\n**\"What's my trading history and realized PnL?\"**\n```bash\nokx account positions-history\n# → table: instId, direction, openAvgPx, closeAvgPx, realizedPnl, uTime\n```\n\n**\"Show my recent account activity\"**\n```bash\nokx account bills --limit 20\n# → table: billId, instId, type, ccy, balChg, bal, ts\n```\n\n**\"What are my trading fees for SWAP?\"**\n```bash\nokx account fees --instType SWAP\n# → level: VIP1 | maker: -0.0001 | taker: 0.0005\n```\n\n**\"How much BTC can I buy in cross margin?\"**\n```bash\nokx account max-size --instId BTC-USDT-SWAP --tdMode cross\n# → instId: BTC-USDT-SWAP | maxBuy: 12.5 | maxSell: 12.5\n```\n\n**\"Transfer 200 USDT from funding to trading\"**\n```bash\nokx account transfer --ccy USDT --amt 200 --from 6 --to 18\n# → Transfer: TXN123456 (USDT 200)\n```\n\n**\"Check my account config\"**\n```bash\nokx account config\n# → uid: 123456789 | acctLv: 2 | posMode: net | autoLoan: false\n```\n\n## Where Can the Money Live?\n\nOKX splits assets across multiple sub-accounts. The `--valuation` breakdown maps directly:\n\n| Account type | `details` key | Used for | Check with |\n|---|---|---|---|\n| Trading (unified) | `trading` | Spot, margin, swap, futures, options | `okx account balance` or `details.trading` in `--valuation` |\n| Funding | `funding` | Deposits/withdrawals, idle funds | `okx account asset-balance` or `details.funding` in `--valuation` |\n| Earn | `earn` | Simple earn, staking, savings | `details.earn` in `--valuation` |\n| Classic | `classic` | Classic account (legacy, less common) | `details.classic` in `--valuation` |\n\n**Typical flow when user says \"I have X USDT but can't trade\":**\n1. `okx account asset-balance --valuation` → look at each `details.*` field\n2. If `details.funding` is large and `details.trading` is small → the funds are in the funding account\n3. Transfer: `okx account transfer --ccy USDT --amt <n> --from 6 --to 18`\n4. Confirm: `okx account balance USDT` → equity should now reflect the transferred amount\n\n## Edge Cases\n\n- **No balance shown**: balance is filtered to > 0 — if nothing shows, all currencies have zero balance\n- **Positions command returns empty**: no open contracts; spot holdings are not shown here (use `account balance`)\n- **bills --archive**: required for transactions older than 7 days (default window); may be slower\n- **set-position-mode**: cannot switch to `net` if you have both long and short positions on the same instrument\n- **transfer --from/--to codes**: `6`=funding account, `18`=trading account; other values exist for sub-account flows\n- **max-size vs max-avail-size**: `max-size` is the theoretical maximum; `max-avail-size` accounts for existing orders and reserved margin\n- **Demo mode**: `okx --demo account balance` (OAuth) or `okx --profile <demo-profile> account balance` (API Key) shows simulated balances, not real funds\n\n## Global Notes\n\n- All write commands require valid credentials (OAuth session or API key in `~/.okx/config.toml`)\n- Auth method and trading mode are determined in \"Credential & Profile Check\"; see that section for parameter rules\n- Every command result includes a `[mode: live]` or `[mode: demo]` tag for audit reference\n- `--json` returns the raw OKX API v5 response by default. Add `--env` to wrap the output as `{\"env\": \"<live|demo>\", \"profile\": \"<name>\", \"data\": <response>}`\n- Rate limit: 10 requests per 2 seconds for account endpoints\n- Positions shown are for the unified trading account; funding account assets are separate\n- Account types: `6`=Funding Account (deposits/withdrawals), `18`=Unified Trading Account (spot + derivatives)\n","tags":{"latest":"1.3.8"},"stats":{"comments":0,"downloads":1410,"installsAllTime":5,"installsCurrent":5,"stars":0,"versions":15},"createdAt":1773113530686,"updatedAt":1781168175770},"latestVersion":{"version":"1.3.8","createdAt":1781168175770,"changelog":"**Expanded asset snapshot support and simplified documentation.**\n\n- Added support for aggregated balance queries: responds to prompts like \"asset snapshot\", \"资产快照\", and \"aggregated balance\".\n- Introduced and documented new `okx account balance-all` commands for comprehensive account snapshots.\n- Updated description and command index to reflect new snapshot and asset overview capabilities.\n- Removed unused documentation file (skill-card.md) for a cleaner repo.","license":"MIT-0"},"metadata":null,"owner":{"handle":"numpy0001","userId":"s178zmefrdp1qc0dd9ya8n367183pmvz","displayName":"numpy0001","image":"https://avatars.githubusercontent.com/u/140434355?v=4"},"moderation":null}