okx-cex-bot
БесплатноБез исполняемых скриптовНе проверенManage Grid bots (spot/contract/coin-margined), DCA Martingale bots (Spot DCA 现货马丁 / Contract DCA 合约马丁), Smart Portfolio bots (智能组合, auto-rebalancing…
Об этом скилле
OKX CEX Bot Trading
Grid, 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.
Preflight
Before running any command, follow ../_shared/preflight.md.
Use metadata.version from this file's frontmatter as the reference for Step 2.
Prerequisites
npm install -g @okx_ai/okx-trade-cli
okx config init # select site -> follow browser OAuth flow
Security: NEVER accept credentials in chat. Guide users to
okx config initfor setup.
Credential & Profile Check
Run before every authenticated command. The auth method is detected during preflight Step 2 and remembered for the session.
Step A — Verify credentials
Run both commands — the apiKey field from okx auth status --json is the auth-binary's internal state and is always false regardless of whether ~/.okx/config.toml has an API-key profile. okx config show --json is the only authoritative source for API-key presence.
okx config show --json # reveals API-key profiles (TOML config)
okx auth status --json # reveals OAuth session state (auth-binary state)
Apply in this order — first match wins:
config show --jsonhas any profile with a non-emptyapi_keyfield → API Key mode. Proceed to Step B.- No API-key profile AND
auth status --jsonreturns"status":"logged_in"→ OAuth mode. Proceed to Step B. - No API-key profile AND
"status":"pending"— login is in progress, wait for it to complete. - No API-key profile AND
"status":"not_logged_in"— stop, loadokx-cex-authskill and follow login steps, wait for completion.
Step B — Confirm trading mode
Resolution:
- User intent is clear ("real"/"实盘"/"live" → live; "test"/"模拟"/"demo" → demo) → use it, inform user
- No explicit declaration → check conversation context for previous choice → reuse if found
- Nothing found → ask: "Live (实盘) or Demo (模拟盘)?" — wait before proceeding
How to apply the mode depends on auth method (detected in Step A):
| Auth method | Live (实盘) | Demo (模拟盘) |
|---|---|---|
| API Key | --profile <live-profile> |
--profile <demo-profile> |
| OAuth | (no flag needed, live is default) | --demo |
- API Key users: run
okx config show --jsonto discover available profile names and theirdemosettings. - OAuth users: omit flags for live; add
--demofor simulated trading.
After every command: append [mode: live] or [mode: demo]
Handling 401 Errors
Authentication error (error contains "401", "Session expired", or "Run okx auth login first"):
- Stop immediately
- Load
okx-cex-authskill and follow re-authentication steps - 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)
Skill Routing
| Need | Skill |
|---|---|
| Market data, prices, depth | okx-cex-market |
| Account balance, positions, fees | okx-cex-portfolio |
| Regular spot/swap/futures orders | okx-cex-trade |
| Grid / DCA / Smart Portfolio / Recurring Buy bots | okx-cex-bot (this skill) |
Command Index
Grid Bot
| Command | Type | Description |
|---|---|---|
okx bot grid create |
WRITE | Create a grid bot (spot or contract) |
okx bot grid amend |
WRITE | Amend price range, grid count, or TP/SL of a running grid bot |
okx bot grid stop |
WRITE | Stop a grid bot |
okx bot grid positions |
READ | Query open contract-grid positions (liquidation price, margin ratio, unrealized PnL) |
okx bot grid liquidate-price |
READ | Estimate liquidation price for a contract-grid bot |
okx bot grid close-position |
WRITE | Close remaining position after bot stopped with stopType=2 |
okx bot grid orders |
READ | List active or history grid bots |
okx bot grid details |
READ | Grid bot details + PnL |
okx bot grid sub-orders |
READ | Individual grid fills or pending orders |
DCA Bot (Spot & Contract)
| Command | Type | Description |
|---|---|---|
okx bot dca create |
WRITE | Create a DCA (Martingale) bot (spot or contract) |
okx bot dca stop |
WRITE | Stop a DCA bot (spot or contract) |
okx bot dca orders |
READ | List active or history DCA bots (default: contract_dca) |
okx bot dca positions |
READ | DCA bot position info (avgPx, upl, liqPx, ...) |
okx bot dca details |
READ | Deprecated - use okx bot dca positions (same endpoint) |
okx bot dca sub-orders |
READ | DCA cycles and orders within a cycle |
okx bot dca add-margin |
WRITE | Add margin to a running contract DCA bot |
okx bot dca reduce-margin |
WRITE | Reduce margin on a running contract DCA bot |
okx bot dca update-tp |
WRITE | Update take-profit price on a running contract DCA bot |
Smart Portfolio Bot
Note: Load wi
Установить okx-cex-bot в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл okx-cex-bot?
Manage Grid bots (spot/contract/coin-margined), DCA Martingale bots (Spot DCA 现货马丁 / Contract DCA 合约马丁), Smart Portfolio bots (智能组合, auto-rebalancing multi-asset portfolio; pause/resume rebalancing, add funds, edit coins and weights), and Recurring Buy strategies (定投, periodic fixed-amount multi-coin buys) on OKX. Covers create, stop, pause, amend, monitor P&L, TP/SL, margin/investment 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).
Как установить скилл okx-cex-bot?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл okx-cex-bot запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic