[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GT5DQ3SHBQHBAD6MZB7TGG":3,"skill-same:01M6GT5DQ3SHBQHBAD6MZB7TGG":116},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":41,"linkOnly":42,"markdownContent":43,"markdownBody":44,"frontMatter":45,"refName":59,"commitSha":60,"skillDirectory":61,"forksCount":62,"repositoryHtmlUrl":63,"repositoryHomepageUrl":6,"ownerHtmlUrl":64,"ownerBlogUrl":65,"ownerDescription":66,"updatedAt":67,"install":68,"resources":81},"01M6GT5DQ3SHBQHBAD6MZB7TGG","okx-cex-bot",null,"Manage Grid bots (spot\u002Fcontract\u002Fcoin-margined), DCA Martingale bots (Spot DCA 现货马丁 \u002F Contract DCA 合约马丁), Smart Portfolio bots (智能组合, auto-rebalancing multi-asset portfolio), and Recurring Buy strategies (定投, periodic fixed-amount multi-coin buys) on OKX. Covers create, stop, pause, amend, monitor P&L, TP\u002FSL, margin\u002Finvestment adjustment, AI-recommended parameters, and recommended zone backtest. Requires API credentials. Not for regular orders (okx-cex-trade), market data (okx-cex-market), or account info (okx-cex-portfolio).","jiayaoqijia\u002Fcryptoskill","jiayaoqijia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1453879?v=4","01M6GMYTX7Q7S504VC6E756ENR","YQ","01M6GMYV1QKJ1CC75MTTGT9PR0",81,"MIT","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002FSKILL.md",[],[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"okx","cex","okx cex bot","bot","market data","stop","investment","orders","asset","data","install","node","portfolio","cli","credentials","info","create","dca","api","auto","bots","2026-11-10 10:12:30",false,"---\nname: okx-cex-bot\ndescription: Manage Grid bots (spot\u002Fcontract\u002Fcoin-margined), DCA Martingale bots (Spot DCA 现货马丁 \u002F Contract DCA 合约马丁), Smart Portfolio bots (智能组合, auto-rebalancing multi-asset portfolio), and Recurring Buy strategies (定投, periodic fixed-amount multi-coin buys) on OKX. Covers create, stop, pause, amend, monitor P&L, TP\u002FSL, margin\u002Finvestment adjustment, AI-recommended parameters, and recommended zone backtest. Requires API credentials. Not for regular orders (okx-cex-trade), market data (okx-cex-market), or account info (okx-cex-portfolio).\nlicense: MIT\nmetadata:\n  author: okx\n  version: \"1.5.1\"\n  homepage: \"https:\u002F\u002Fwww.okx.com\"\n  agent:\n    emoji: \"🤖\"\n    requires:\n      bins: [\"okx\"]\n    install:\n      - id: npm\n        kind: node\n        package: \"@okx_ai\u002Fokx-trade-cli@1.5.1\"\n        bins: [\"okx\"]\n        label: \"Install okx CLI (npm)\"\n---\n\n# OKX CEX Bot Trading\n\nGrid, DCA (Spot & Contract Martingale), Smart Portfolio and Recurring Buy (定投) management on OKX. All bots are **native OKX server-side** — they run on OKX and do not require a local process.\n\n## Preflight\n\nBefore running any command, follow [`..\u002F_shared\u002Fpreflight.md`](..\u002F_shared\u002Fpreflight.md).\nUse `metadata.version` from this file's frontmatter as the reference for Step 2.\n\n## Prerequisites\n\n```bash\nnpm install -g @okx_ai\u002Fokx-trade-cli\nokx config init   # select site -> follow browser OAuth flow\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 before every authenticated command.** The auth method is detected during [preflight](..\u002F_shared\u002Fpreflight.md) Step 2 and remembered for the session.\n\n### Step A — Verify credentials\n\nRun **both** commands — the `apiKey` field from `okx auth status --json` is the auth-binary's internal state and is always `false` regardless of whether `~\u002F.okx\u002Fconfig.toml` has an API-key profile. `okx config show --json` is the only authoritative source for API-key presence.\n\n```bash\nokx config show --json      # reveals API-key profiles (TOML config)\nokx auth status --json      # reveals OAuth session state (auth-binary state)\n```\n\nApply **in this order** — first match wins:\n\n- `config show --json` has any profile with a non-empty `api_key` field → **API Key mode**. Proceed to Step B.\n- No API-key profile **AND** `auth status --json` returns `\"status\":\"logged_in\"` → **OAuth mode**. Proceed to Step B.\n- No API-key profile **AND** `\"status\":\"pending\"` — login is in progress, wait for it to complete.\n- No API-key profile **AND** `\"status\":\"not_logged_in\"` — stop, load `okx-cex-auth` skill and follow login steps, wait for completion.\n\n### Step B — Confirm trading mode\n\nResolution:\n1. User intent is clear (\"real\"\u002F\"实盘\"\u002F\"live\" → live; \"test\"\u002F\"模拟\"\u002F\"demo\" → demo) → use it, inform user\n2. No explicit declaration → check conversation context for previous choice → reuse if found\n3. Nothing found → ask: \"Live (实盘) or Demo (模拟盘)?\" — wait 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 \u003Clive-profile>` | `--profile \u003Cdemo-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.\n- **OAuth users**: omit flags for live; add `--demo` for simulated trading.\n\n**After every command**: append `[mode: live]` or `[mode: demo]`\n\n### Handling 401 Errors\n\n**Authentication error** (error contains \"401\", \"Session expired\", or \"Run `okx auth login` first\"):\n1. Stop immediately\n2. Load `okx-cex-auth` skill and follow re-authentication steps\n3. Retry original command (a 401 means nothing was executed; after a timeout or other uncertain error on a Recurring Buy write, see Key Rules instead)\n\n## Skill Routing\n\n| Need | Skill |\n|---|---|\n| Market data, prices, depth | `okx-cex-market` |\n| Account balance, positions, fees | `okx-cex-portfolio` |\n| Regular spot\u002Fswap\u002Ffutures orders | `okx-cex-trade` |\n| **Grid \u002F DCA \u002F Smart Portfolio \u002F Recurring Buy bots** | **`okx-cex-bot` (this skill)** |\n\n## Command Index\n\n### Grid Bot\n\n| Command | Type | Description |\n|---|---|---|\n| `okx bot grid create` | WRITE | Create a grid bot (spot or contract) |\n| `okx bot grid amend` | WRITE | Amend price range, grid count, or TP\u002FSL of a running grid bot |\n| `okx bot grid stop` | WRITE | Stop a grid bot |\n| `okx bot grid positions` | READ | Query open contract-grid positions (liquidation price, margin ratio, unrealized PnL) |\n| `okx bot grid liquidate-price` | READ | Estimate liquidation price for a contract-grid bot |\n| `okx bot grid close-position` | WRITE | Close remaining position after bot stopped with stopType=2 |\n| `okx bot grid orders` | READ | List active or history grid bots |\n| `okx bot grid details` | READ | Grid bot details + PnL |\n| `okx bot grid sub-orders` | READ | Individual grid fills or pending orders |\n\n### DCA Bot (Spot & Contract)\n\n| Command | Type | Description |\n|---|---|---|\n| `okx bot dca create` | WRITE | Create a DCA (Martingale) bot (spot or contract) |\n| `okx bot dca stop` | WRITE | Stop a DCA bot (spot or contract) |\n| `okx bot dca orders` | READ | List active or history DCA bots (default: contract_dca) |\n| `okx bot dca positions` | READ | DCA bot position info (avgPx, upl, liqPx, ...) |\n| `okx bot dca details` | READ | **Deprecated** - use `okx bot dca positions` (same endpoint) |\n| `okx bot dca sub-orders` | READ | DCA cycles and orders within a cycle |\n| `okx bot dca add-margin` | WRITE | Add margin to a running contract DCA bot |\n| `okx bot dca reduce-margin` | WRITE | Reduce margin on a running contract DCA bot |\n| `okx bot dca update-tp` | WRITE | Update take-profit price on a running contract DCA bot |\n\n### Smart Portfolio Bot\n\n> **Note**: Load with `--modules bot.smartportfolio` or `bot.all` (not in default modules).\n\n| Command | Type | Description |\n|---|---|---|\n| `okx bot smart-portfolio create` | WRITE | Create a Smart Portfolio bot (2–10 assets, ratios summing to 1.0, deltaRatio threshold) |\n| `okx bot smart-portfolio stop` | WRITE | Stop a running Smart Portfolio bot |\n| `okx bot smart-portfolio orders` | READ | List Smart Portfolio bots (default: running; add --history for stopped) |\n| `okx bot smart-portfolio details` | READ | Get Smart Portfolio bot details and current allocation |\n| `okx bot smart-portfolio amend-rebalance` | WRITE | Update rebalance threshold and interval (both --deltaRatio and --interval required) |\n| `okx bot smart-portfolio instant-rebalance` | WRITE | Trigger an immediate rebalance |\n| `okx bot smart-portfolio recommend-zones` | READ | Browse OKX-recommended portfolio zone configurations |\n| `okx bot smart-portfolio zones-backtest` | READ | Get historical backtest results for a recommended zone |\n\n### Recurring Buy (定投)\n\n> **Note**: CLI-only (`okx bot recurring ...`); no `--modules` flag is needed.\n\n| Command | Type | Description |\n|---|---|---|\n| `okx bot recurring create` | WRITE | Create a Recurring Buy strategy (coins + ratios, period, time, amount per cycle, `--tdMode` required) |\n| `okx bot recurring orders` | READ | List strategies (default: running\u002Fpaused; add --history for stopped) |\n| `okx bot recurring details` | READ | Strategy details with per-coin holdings, average price and PnL |\n| `okx bot recurring sub-orders` | READ | Buy orders executed by a strategy |\n| `okx bot recurring pause` | WRITE | Pause a strategy |\n| `okx bot recurring restart` | WRITE | Restart a paused strategy |\n| `okx bot recurring stop` | WRITE | Stop a strategy (permanent) |\n| `okx bot recurring amend-name` | WRITE | Rename a strategy |\n| `okx bot recurring amend-price-range` | WRITE | Change the per-coin buy price range |\n| `okx bot recurring amend-amount` | WRITE | Change the amount invested per cycle |\n| `okx bot recurring amend-time` | WRITE | Change period\u002Fday\u002Ftime\u002Ftime zone |\n| `okx bot recurring add-investment` | WRITE | Add an extra one-off investment |\n\n## Operation Flow\n\n### Step 1 — Identify bot type and action\n\nParse user request → determine module (Grid \u002F DCA \u002F Smart Portfolio \u002F Recurring Buy) and action (create \u002F stop \u002F list \u002F details).\n\n**DCA and Recurring Buy are different products — route by the user's wording:**\n- \"DCA\" \u002F 马丁 \u002F Martingale, or safety-order \u002F buy-the-dip wording → `okx bot dca` (the Martingale bot with safety orders).\n- \"recurring\" \u002F \"Recurring Buy\" \u002F 定投, or a clear periodic fixed-amount request with no safety-order wording (e.g. \"每周买 100 USDT 的 BTC\") → `okx bot recurring`; name \"Recurring Buy \u002F 定投\" in the confirmation summary.\n- Ambiguous — \"DCA\" used for periodic fixed-amount buying, both words together, mixed wording, or no clear match → ask which product they mean, once. Never treat one as the other.\n\n### Step 2 — Execute\n\n**READ commands** (orders, details, sub-orders): run immediately after profile confirmation.\n\n**WRITE commands** (create, amend, stop; for Recurring Buy also pause, restart, add-investment): confirm key parameters with user once before executing.\n\n**Write-operation confirmation checklist — Recurring Buy**:\n- `recurring create`: confirm coins and ratios, period + day\u002Fhour + time + `--timeZone`, `--amt`, `--investmentCcy` and `--tdMode`. Run `okx account config` first, read `acctLv` and follow `{baseDir}\u002Freferences\u002Frecurring-commands.md`: `1` → `cash`; `2` → **ask the user** `cash` (spot) or `cross` (real leverage — state the risk), `cash` if no preference; `3` and `4` → `cross` only (executed as spot), never `cash` (on `4` the server answers success but does not trade). State the choice in the summary, never guess `acctLv` (ask if unreadable or not `1`–`4`), and always pass `--tdMode`.\n- `recurring pause` \u002F `restart`: confirm `algoId` and the strategy name, and read `details` first (`pause` needs `state` `running`, `restart` needs `pause`; otherwise tell the user instead of running it). Say that pause stops scheduled purchases and restart resumes them (do not say whether cycles missed while paused are bought later), and wait for an explicit yes. Afterwards check `details` (`nextInvestTime`) — `(OK)` is not proof.\n- `recurring stop` \u002F `add-investment`: real money and irreversible — confirm `algoId` (from `recurring orders`) and, for add-investment, the amount; before add-investment note `investmentAmt` from `details` and the newest `sub-orders` entry.\n- `recurring amend-*`: confirm `algoId` and the new values; negative time zones use `--timeZone=-5`. **`amend-time --recurringTimeType 2` (and `create --recurringTimeType 2`) buys immediately and is not idempotent** — say so, get an explicit yes, then check `sub-orders` and `details`.\n\n### Step 3 — Verify after writes\n\n- After create → run the corresponding `orders` command to confirm active\n- After amend → run `details --algoId \u003Cid>` to confirm updated config (Recurring Buy `amend-time` type 2: also `recurring sub-orders`)\n- After Grid\u002FDCA stop → run `orders --history` to confirm stopped\n- After Smart Portfolio stop → run `smart-portfolio orders --history` to confirm stopped\n- After Recurring Buy stop → run `recurring orders --history` to confirm stopped; after pause\u002Frestart\u002Famend → run `recurring details --algoId \u003Cid>`\n- After Recurring Buy add-investment → run `recurring sub-orders --algoId \u003Cid>` for the new buy order (normally `ordType` `manual_add_order`) and compare `investmentAmt` in `details` with the value read before (if it did not rise, rely on `sub-orders`; `(OK)` alone is not proof)\n\n## Key Rules\n\n- **Never auto-transfer funds.** If balance is insufficient for bot creation, report the shortfall (current available vs required) and ask the user how to proceed: (1) transfer funds manually, (2) reduce size, or (3) cancel.\n- **Never retry a failed or uncertain Recurring Buy write yourself; the user decides.** After an error — especially a timeout, a dropped connection, a 5xx, or a `create` that fails with \"returned no algoId\" — the write may still have happened, and the lists can lag, so finding nothing is not proof either. Do not act on a \"retry later\" hint. Check (`orders` and `--history` for `create`; `sub-orders` and `details` for `add-investment` and `amend-time --recurringTimeType 2`; `details` otherwise), wait a moment and check once more, tell the user what you found, and re-run only after they explicitly ask or agree. For `create`, `add-investment` and `amend-time --recurringTimeType 2`, warn that a retry may duplicate the strategy or buy again.\n- **`algoId`** is the bot's algo order ID (from create or list output). It is NOT a normal `ordId`. Never fabricate — always obtain from a prior command.\n- **`algoOrdType`** for grid must match the bot's actual type. Always use the value from `bot grid orders` — do not infer from user description alone. Mismatch causes error `50016`.\n- When operating on existing bots, **always list first** to get correct IDs, unless the user provides them explicitly.\n- **TP\u002FSL constraints**: `tpTriggerPx`\u002F`tpRatio` and `slTriggerPx`\u002F`slRatio` are mutually exclusive pairs.\n\n## CLI Command Reference\n\nFor Grid Bot command syntax, parameter tables, Quickstart examples, and edge cases,\nread `{baseDir}\u002Freferences\u002Fgrid-commands.md`.\n\nFor DCA Bot command syntax, parameter tables, Quickstart examples, and edge cases,\nread `{baseDir}\u002Freferences\u002Fdca-commands.md`.\n\nFor Smart Portfolio Bot command syntax, parameter tables, and examples,\nread `{baseDir}\u002Freferences\u002Fsmart-portfolio-commands.md`.\n\nFor Recurring Buy command syntax, the `acctLv` → `tdMode` selection rule, parameter tables, and edge cases,\nread `{baseDir}\u002Freferences\u002Frecurring-commands.md`.\n\nFor cross-skill workflow examples (chaining `okx-cex-market`\u002F`okx-cex-portfolio` with bot\ncreation), read `{baseDir}\u002Freferences\u002Fworkflows.md`.\n\n## Communication Guidelines\n\n- **Grid\u002FDCA**: use \"bot\" not \"strategy\" (e.g., \"grid bot\", \"DCA bot\")\n- **DCA**: always say \"DCA\" or \"Martingale\" — DCA supports both Spot DCA and Contract DCA\n- **Recurring Buy**: say \"Recurring Buy\" \u002F 定投 — never call it DCA (except when asking the user to choose between the two products)\n- **Chinese**: Grid = \"网格\", Spot DCA = \"现货马丁\", Contract DCA = \"合约马丁\", Smart Portfolio = \"智能组合\", Recurring Buy = \"定投\"\n- Use natural language for parameters — \"What price range?\" not \"Enter minPx and maxPx\"\n- If the user already provides values, map directly — don't re-ask\n\n> `{base}` and `{quote}`: extract from `instId` by splitting on `-`. E.g., `BTC-USDT-SWAP` → base=BTC, quote=USDT.\n\n## Global Notes\n\n- All bots run on OKX servers — stopping the CLI does not affect them\n- Auth method and trading mode are determined in \"Credential & Profile Check\"; see that section for parameter rules\n- `--json` returns the raw OKX API v5 response by default. Add `--env` to wrap the output as `{\"env\": \"\u003Clive|demo>\", \"profile\": \"\u003Cname>\", \"data\": \u003Cresponse>}`\n- Rate limit: 20 requests per 2 seconds per UID\n- Grid `--gridNum` range: 2–100\n","# OKX CEX Bot Trading\n\nGrid, DCA (Spot & Contract Martingale), Smart Portfolio and Recurring Buy (定投) management on OKX. All bots are **native OKX server-side** — they run on OKX and do not require a local process.\n\n## Preflight\n\nBefore running any command, follow [`..\u002F_shared\u002Fpreflight.md`](..\u002F_shared\u002Fpreflight.md).\nUse `metadata.version` from this file's frontmatter as the reference for Step 2.\n\n## Prerequisites\n\n```bash\nnpm install -g @okx_ai\u002Fokx-trade-cli\nokx config init   # select site -> follow browser OAuth flow\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 before every authenticated command.** The auth method is detected during [preflight](..\u002F_shared\u002Fpreflight.md) Step 2 and remembered for the session.\n\n### Step A — Verify credentials\n\nRun **both** commands — the `apiKey` field from `okx auth status --json` is the auth-binary's internal state and is always `false` regardless of whether `~\u002F.okx\u002Fconfig.toml` has an API-key profile. `okx config show --json` is the only authoritative source for API-key presence.\n\n```bash\nokx config show --json      # reveals API-key profiles (TOML config)\nokx auth status --json      # reveals OAuth session state (auth-binary state)\n```\n\nApply **in this order** — first match wins:\n\n- `config show --json` has any profile with a non-empty `api_key` field → **API Key mode**. Proceed to Step B.\n- No API-key profile **AND** `auth status --json` returns `\"status\":\"logged_in\"` → **OAuth mode**. Proceed to Step B.\n- No API-key profile **AND** `\"status\":\"pending\"` — login is in progress, wait for it to complete.\n- No API-key profile **AND** `\"status\":\"not_logged_in\"` — stop, load `okx-cex-auth` skill and follow login steps, wait for completion.\n\n### Step B — Confirm trading mode\n\nResolution:\n1. User intent is clear (\"real\"\u002F\"实盘\"\u002F\"live\" → live; \"test\"\u002F\"模拟\"\u002F\"demo\" → demo) → use it, inform user\n2. No explicit declaration → check conversation context for previous choice → reuse if found\n3. Nothing found → ask: \"Live (实盘) or Demo (模拟盘)?\" — wait 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 \u003Clive-profile>` | `--profile \u003Cdemo-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.\n- **OAuth users**: omit flags for live; add `--demo` for simulated trading.\n\n**After every command**: append `[mode: live]` or `[mode: demo]`\n\n### Handling 401 Errors\n\n**Authentication error** (error contains \"401\", \"Session expired\", or \"Run `okx auth login` first\"):\n1. Stop immediately\n2. Load `okx-cex-auth` skill and follow re-authentication steps\n3. Retry original command (a 401 means nothing was executed; after a timeout or other uncertain error on a Recurring Buy write, see Key Rules instead)\n\n## Skill Routing\n\n| Need | Skill |\n|---|---|\n| Market data, prices, depth | `okx-cex-market` |\n| Account balance, positions, fees | `okx-cex-portfolio` |\n| Regular spot\u002Fswap\u002Ffutures orders | `okx-cex-trade` |\n| **Grid \u002F DCA \u002F Smart Portfolio \u002F Recurring Buy bots** | **`okx-cex-bot` (this skill)** |\n\n## Command Index\n\n### Grid Bot\n\n| Command | Type | Description |\n|---|---|---|\n| `okx bot grid create` | WRITE | Create a grid bot (spot or contract) |\n| `okx bot grid amend` | WRITE | Amend price range, grid count, or TP\u002FSL of a running grid bot |\n| `okx bot grid stop` | WRITE | Stop a grid bot |\n| `okx bot grid positions` | READ | Query open contract-grid positions (liquidation price, margin ratio, unrealized PnL) |\n| `okx bot grid liquidate-price` | READ | Estimate liquidation price for a contract-grid bot |\n| `okx bot grid close-position` | WRITE | Close remaining position after bot stopped with stopType=2 |\n| `okx bot grid orders` | READ | List active or history grid bots |\n| `okx bot grid details` | READ | Grid bot details + PnL |\n| `okx bot grid sub-orders` | READ | Individual grid fills or pending orders |\n\n### DCA Bot (Spot & Contract)\n\n| Command | Type | Description |\n|---|---|---|\n| `okx bot dca create` | WRITE | Create a DCA (Martingale) bot (spot or contract) |\n| `okx bot dca stop` | WRITE | Stop a DCA bot (spot or contract) |\n| `okx bot dca orders` | READ | List active or history DCA bots (default: contract_dca) |\n| `okx bot dca positions` | READ | DCA bot position info (avgPx, upl, liqPx, ...) |\n| `okx bot dca details` | READ | **Deprecated** - use `okx bot dca positions` (same endpoint) |\n| `okx bot dca sub-orders` | READ | DCA cycles and orders within a cycle |\n| `okx bot dca add-margin` | WRITE | Add margin to a running contract DCA bot |\n| `okx bot dca reduce-margin` | WRITE | Reduce margin on a running contract DCA bot |\n| `okx bot dca update-tp` | WRITE | Update take-profit price on a running contract DCA bot |\n\n### Smart Portfolio Bot\n\n> **Note**: Load with `--modules bot.smartportfolio` or `bot.all` (not in default modules).\n\n| Command | Type | Description |\n|---|---|---|\n| `okx bot smart-portfolio create` | WRITE | Create a Smart Portfolio bot (2–10 assets, ratios summing to 1.0, deltaRatio threshold) |\n| `okx bot smart-portfolio stop` | WRITE | Stop a running Smart Portfolio bot |\n| `okx bot smart-portfolio orders` | READ | List Smart Portfolio bots (default: running; add --history for stopped) |\n| `okx bot smart-portfolio details` | READ | Get Smart Portfolio bot details and current allocation |\n| `okx bot smart-portfolio amend-rebalance` | WRITE | Update rebalance threshold and interval (both --deltaRatio and --interval required) |\n| `okx bot smart-portfolio instant-rebalance` | WRITE | Trigger an immediate rebalance |\n| `okx bot smart-portfolio recommend-zones` | READ | Browse OKX-recommended portfolio zone configurations |\n| `okx bot smart-portfolio zones-backtest` | READ | Get historical backtest results for a recommended zone |\n\n### Recurring Buy (定投)\n\n> **Note**: CLI-only (`okx bot recurring ...`); no `--modules` flag is needed.\n\n| Command | Type | Description |\n|---|---|---|\n| `okx bot recurring create` | WRITE | Create a Recurring Buy strategy (coins + ratios, period, time, amount per cycle, `--tdMode` required) |\n| `okx bot recurring orders` | READ | List strategies (default: running\u002Fpaused; add --history for stopped) |\n| `okx bot recurring details` | READ | Strategy details with per-coin holdings, average price and PnL |\n| `okx bot recurring sub-orders` | READ | Buy orders executed by a strategy |\n| `okx bot recurring pause` | WRITE | Pause a strategy |\n| `okx bot recurring restart` | WRITE | Restart a paused strategy |\n| `okx bot recurring stop` | WRITE | Stop a strategy (permanent) |\n| `okx bot recurring amend-name` | WRITE | Rename a strategy |\n| `okx bot recurring amend-price-range` | WRITE | Change the per-coin buy price range |\n| `okx bot recurring amend-amount` | WRITE | Change the amount invested per cycle |\n| `okx bot recurring amend-time` | WRITE | Change period\u002Fday\u002Ftime\u002Ftime zone |\n| `okx bot recurring add-investment` | WRITE | Add an extra one-off investment |\n\n## Operation Flow\n\n### Step 1 — Identify bot type and action\n\nParse user request → determine module (Grid \u002F DCA \u002F Smart Portfolio \u002F Recurring Buy) and action (create \u002F stop \u002F list \u002F details).\n\n**DCA and Recurring Buy are different products — route by the user's wording:**\n- \"DCA\" \u002F 马丁 \u002F Martingale, or safety-order \u002F buy-the-dip wording → `okx bot dca` (the Martingale bot with safety orders).\n- \"recurring\" \u002F \"Recurring Buy\" \u002F 定投, or a clear periodic fixed-amount request with no safety-order wording (e.g. \"每周买 100 USDT 的 BTC\") → `okx bot recurring`; name \"Recurring Buy \u002F 定投\" in the confirmation summary.\n- Ambiguous — \"DCA\" used for periodic fixed-amount buying, both words together, mixed wording, or no clear match → ask which product they mean, once. Never treat one as the other.\n\n### Step 2 — Execute\n\n**READ commands** (orders, details, sub-orders): run immediately after profile confirmation.\n\n**WRITE commands** (create, amend, stop; for Recurring Buy also pause, restart, add-investment): confirm key parameters with user once before executing.\n\n**Write-operation confirmation checklist — Recurring Buy**:\n- `recurring create`: confirm coins and ratios, period + day\u002Fhour + time + `--timeZone`, `--amt`, `--investmentCcy` and `--tdMode`. Run `okx account config` first, read `acctLv` and follow `{baseDir}\u002Freferences\u002Frecurring-commands.md`: `1` → `cash`; `2` → **ask the user** `cash` (spot) or `cross` (real leverage — state the risk), `cash` if no preference; `3` and `4` → `cross` only (executed as spot), never `cash` (on `4` the server answers success but does not trade). State the choice in the summary, never guess `acctLv` (ask if unreadable or not `1`–`4`), and always pass `--tdMode`.\n- `recurring pause` \u002F `restart`: confirm `algoId` and the strategy name, and read `details` first (`pause` needs `state` `running`, `restart` needs `pause`; otherwise tell the user instead of running it). Say that pause stops scheduled purchases and restart resumes them (do not say whether cycles missed while paused are bought later), and wait for an explicit yes. Afterwards check `details` (`nextInvestTime`) — `(OK)` is not proof.\n- `recurring stop` \u002F `add-investment`: real money and irreversible — confirm `algoId` (from `recurring orders`) and, for add-investment, the amount; before add-investment note `investmentAmt` from `details` and the newest `sub-orders` entry.\n- `recurring amend-*`: confirm `algoId` and the new values; negative time zones use `--timeZone=-5`. **`amend-time --recurringTimeType 2` (and `create --recurringTimeType 2`) buys immediately and is not idempotent** — say so, get an explicit yes, then check `sub-orders` and `details`.\n\n### Step 3 — Verify after writes\n\n- After create → run the corresponding `orders` command to confirm active\n- After amend → run `details --algoId \u003Cid>` to confirm updated config (Recurring Buy `amend-time` type 2: also `recurring sub-orders`)\n- After Grid\u002FDCA stop → run `orders --history` to confirm stopped\n- After Smart Portfolio stop → run `smart-portfolio orders --history` to confirm stopped\n- After Recurring Buy stop → run `recurring orders --history` to confirm stopped; after pause\u002Frestart\u002Famend → run `recurring details --algoId \u003Cid>`\n- After Recurring Buy add-investment → run `recurring sub-orders --algoId \u003Cid>` for the new buy order (normally `ordType` `manual_add_order`) and compare `investmentAmt` in `details` with the value read before (if it did not rise, rely on `sub-orders`; `(OK)` alone is not proof)\n\n## Key Rules\n\n- **Never auto-transfer funds.** If balance is insufficient for bot creation, report the shortfall (current available vs required) and ask the user how to proceed: (1) transfer funds manually, (2) reduce size, or (3) cancel.\n- **Never retry a failed or uncertain Recurring Buy write yourself; the user decides.** After an error — especially a timeout, a dropped connection, a 5xx, or a `create` that fails with \"returned no algoId\" — the write may still have happened, and the lists can lag, so finding nothing is not proof either. Do not act on a \"retry later\" hint. Check (`orders` and `--history` for `create`; `sub-orders` and `details` for `add-investment` and `amend-time --recurringTimeType 2`; `details` otherwise), wait a moment and check once more, tell the user what you found, and re-run only after they explicitly ask or agree. For `create`, `add-investment` and `amend-time --recurringTimeType 2`, warn that a retry may duplicate the strategy or buy again.\n- **`algoId`** is the bot's algo order ID (from create or list output). It is NOT a normal `ordId`. Never fabricate — always obtain from a prior command.\n- **`algoOrdType`** for grid must match the bot's actual type. Always use the value from `bot grid orders` — do not infer from user description alone. Mismatch causes error `50016`.\n- When operating on existing bots, **always list first** to get correct IDs, unless the user provides them explicitly.\n- **TP\u002FSL constraints**: `tpTriggerPx`\u002F`tpRatio` and `slTriggerPx`\u002F`slRatio` are mutually exclusive pairs.\n\n## CLI Command Reference\n\nFor Grid Bot command syntax, parameter tables, Quickstart examples, and edge cases,\nread `{baseDir}\u002Freferences\u002Fgrid-commands.md`.\n\nFor DCA Bot command syntax, parameter tables, Quickstart examples, and edge cases,\nread `{baseDir}\u002Freferences\u002Fdca-commands.md`.\n\nFor Smart Portfolio Bot command syntax, parameter tables, and examples,\nread `{baseDir}\u002Freferences\u002Fsmart-portfolio-commands.md`.\n\nFor Recurring Buy command syntax, the `acctLv` → `tdMode` selection rule, parameter tables, and edge cases,\nread `{baseDir}\u002Freferences\u002Frecurring-commands.md`.\n\nFor cross-skill workflow examples (chaining `okx-cex-market`\u002F`okx-cex-portfolio` with bot\ncreation), read `{baseDir}\u002Freferences\u002Fworkflows.md`.\n\n## Communication Guidelines\n\n- **Grid\u002FDCA**: use \"bot\" not \"strategy\" (e.g., \"grid bot\", \"DCA bot\")\n- **DCA**: always say \"DCA\" or \"Martingale\" — DCA supports both Spot DCA and Contract DCA\n- **Recurring Buy**: say \"Recurring Buy\" \u002F 定投 — never call it DCA (except when asking the user to choose between the two products)\n- **Chinese**: Grid = \"网格\", Spot DCA = \"现货马丁\", Contract DCA = \"合约马丁\", Smart Portfolio = \"智能组合\", Recurring Buy = \"定投\"\n- Use natural language for parameters — \"What price range?\" not \"Enter minPx and maxPx\"\n- If the user already provides values, map directly — don't re-ask\n\n> `{base}` and `{quote}`: extract from `instId` by splitting on `-`. E.g., `BTC-USDT-SWAP` → base=BTC, quote=USDT.\n\n## Global Notes\n\n- All bots run on OKX servers — stopping the CLI does not affect them\n- Auth method and trading mode are determined in \"Credential & Profile Check\"; see that section for parameter rules\n- `--json` returns the raw OKX API v5 response by default. Add `--env` to wrap the output as `{\"env\": \"\u003Clive|demo>\", \"profile\": \"\u003Cname>\", \"data\": \u003Cresponse>}`\n- Rate limit: 20 requests per 2 seconds per UID\n- Grid `--gridNum` range: 2–100\n",{"name":5,"license":15,"metadata":46,"description":7},{"agent":47,"author":20,"version":57,"homepage":58},{"emoji":48,"install":49,"requires":55},"🤖",[50],{"id":51,"bins":52,"kind":31,"label":53,"package":54},"npm",[20],"Install okx CLI (npm)","@okx_ai\u002Fokx-trade-cli@1.5.1",{"bins":56},[20],"1.5.1","https:\u002F\u002Fwww.okx.com","main","4aff87e77e63c1886a978b82902814d015f55a4f","skills\u002Fexchanges\u002Fokx-official-cex-bot",17,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia","https:\u002F\u002Feth2030.com","Hardcore infra. Building @alt-research and applied cryptography.","2026-11-15 02:28:10",{"source":8,"skillName":5,"commands":69,"prompt":79,"zipAvailable":80},[70,73,76],{"tool":71,"command":72},"npx","npx skills add jiayaoqijia\u002Fcryptoskill --skill okx-cex-bot",{"tool":74,"command":75},"bunx","bunx skills add jiayaoqijia\u002Fcryptoskill --skill okx-cex-bot",{"tool":77,"command":78},"pnpm","pnpm dlx skills add jiayaoqijia\u002Fcryptoskill --skill okx-cex-bot","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002FSKILL.md",true,[82,86,92,96,100,104,108,112],{"path":83,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":16},"LICENSE","许可证",1060,{"path":87,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fdca-commands.md","REFERENCE","参考文档",11754,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002Freferences\u002Fdca-commands.md",{"path":93,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Fgrid-commands.md",12425,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002Freferences\u002Fgrid-commands.md",{"path":97,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":98,"sourceHtmlUrl":99},"references\u002Frecurring-commands.md",11228,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002Freferences\u002Frecurring-commands.md",{"path":101,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fsmart-portfolio-commands.md",4378,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002Freferences\u002Fsmart-portfolio-commands.md",{"path":105,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":106,"sourceHtmlUrl":107},"references\u002Fworkflows.md",7241,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002Freferences\u002Fworkflows.md",{"path":109,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":110,"sourceHtmlUrl":111},"SOURCE.md",149,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002FSOURCE.md",{"path":113,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":114,"sourceHtmlUrl":115},"TRUST.auto.yaml",2266,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fexchanges\u002Fokx-official-cex-bot\u002FTRUST.auto.yaml",[117,126,134,142,150,157],{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":121,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":125},"01M7DTKCERMV0RNX3HZJP4CZ26","troves","Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say \"Troves\" explicitly.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-troves\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-troves\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":130,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":125},"01M7DTK6CJSMGC8KCQHGNYFZBD","trade","Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say \"swap\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-trade\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-trade\u002FSKILL.md",[],[],{"skillNo":135,"name":136,"nameZh":6,"description":137,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":138,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":125},"01M7DTJZ6A0X4PAW3Y8W4J9K64","staking","Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say \"stake\" explicitly.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-staking\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-staking\u002FSKILL.md",[],[],{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":146,"sourceHtmlUrl":147,"categories":148,"keywords":149,"publishedAt":125},"01M7DTJSDZJKCDMW7GHRF4BRH5","send","Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say \"pay 10 STRK to 0x...\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-send\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-send\u002FSKILL.md",[],[],{"skillNo":151,"name":32,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":153,"sourceHtmlUrl":154,"categories":155,"keywords":156,"publishedAt":125},"01M7DTJG1E480D51ZQ7WKDQ26K","View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks \"what do I have\", \"show me everything\", \"how much am I worth\", \"my positions\", \"my investments\", \"rebalance my portfolio\", \"I want 50% ETH\", \"optimize my holdings\", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say \"portfolio\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-portfolio\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-portfolio\u002FSKILL.md",[],[],{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":161,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":125},"01M7DTJ7M8TE9R2N36HFBZDGVD","multi-swap","Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions \"two swaps\", \"three swaps\", \"swap X and Y at the same time\", or wants to convert multiple tokens in a single call.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-multi-swap\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-multi-swap\u002FSKILL.md",[],[]]