okx-cex-bot

okx/agent-skills · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/okx/agent-skills --skill okx-cex-bot
0 commentsdiscussion
summary

Native OKX grid and DCA trading bot management with server-side execution.

  • Create and manage spot grid bots (price range, grid count, investment amount) and contract grid bots (long/short/neutral with leverage) — both run entirely on OKX servers
  • Contract DCA (Dollar Cost Averaging / Martingale) bots with configurable safety orders, price steps, volume multipliers, take-profit, and stop-loss
  • Monitor active bots, retrieve P&L, view individual fills and cycles, and stop bots with c
skill.md

OKX CEX Bot Trading

Grid and DCA (Spot & Contract Martingale) bot 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

Check credentials, then set up if missing:

okx config show          # shows configured profiles (api_key shows last 4 chars)
okx config init          # interactive wizard if not configured

Security: NEVER accept API credentials in chat. Guide users to okx config init or edit ~/.okx/config.toml directly.

Credential & Profile Check

Run before every authenticated command.

Step A — Verify credentials

okx config show

If no configuration → stop, guide user to okx config init, wait for completion.

Step B — Determine profile (required)

--profile Mode Funds
live 实盘 Real money
demo 模拟盘 Simulated, safe for testing

Resolution:

  1. User intent is clear ("real"/"实盘"/"live" → live; "test"/"模拟"/"demo" → demo) → use it, inform user
  2. No explicit declaration → check conversation context for previous profile → use it if found
  3. Nothing found → ask: "Live (实盘) or Demo (模拟盘)?" — wait before proceeding

After every command: append [profile: live] or [profile: demo]

Handling 401 Errors

Stop immediately. Guide user to update ~/.okx/config.toml with their editor. Verify with okx config show before retrying.

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 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 stop WRITE Stop a grid bot
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 details READ DCA bot details + PnL
okx bot dca sub-orders READ DCA cycles and orders within a cycle

Operation Flow

Step 1 — Identify bot type and action

Parse user request → determine module (Grid / DCA) and action (create / stop / list / details).

Step 2 — Execute

READ commands (orders, details, sub-orders): run immediately after profile confirmation.

WRITE commands (create, stop): confirm key parameters with user once before executing.

Step 3 — Verify after writes

  • After create → run the corresponding orders command to confirm active
  • After stop → run orders --history to confirm stopped

Key Rules

  • 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.
  • 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.
  • 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.
  • When operating on existing bots, always list first to get correct IDs, unless the user provides them explicitly.
  • TP/SL constraints: tpTriggerPx/tpRatio and slTriggerPx/slRatio are mutually exclusive pairs.

CLI Command Reference

Grid Bot — Create

okx bot grid create --instId <id> --algoOrdType <type> \
  --maxPx <px> --minPx <px> --gridNum <n> \
  [--runType <1|2>] \
  [--quoteSz <n>] [--baseSz <n>] \
  [--direction <long|short|neutral>] [--lever <n>] [--sz <n>] \
  [--basePos] [--no-basePos] \
  [--tpTriggerPx <px>] [--slTriggerPx <px>] [--tpRatio <ratio>] [--slRatio <ratio>] \
  [--algoClOrdId <id>] [--json]
Param Required Default Description
--instId Yes - Instrument (e.g., BTC-USDT for spot, BTC-USDT-SWAP for USDT-M contract, BTC-USD-SWAP for coin-M contract)
--algoOrdType Yes - grid (spot grid) or contract_grid (contract grid, including coin-margined)
--maxPx Yes - Upper price boundary
--minPx Yes - Lower price boundary
--gridNum Yes - Grid levels (2–100)
--runType No 1 1=arithmetic spacing, 2=geometric spacing
--quoteSz Cond. - USDT investment — spot grid only (provide quoteSz or baseSz)
--baseSz Cond. - Base currency investment — spot grid only
--direction Cond. - long, short, or neutral — required for contract grid
--lever Cond. - Leverage (e.g., 5) — contract grid only
--sz Cond. - Investment margin in USDT (USDT-M) or coin (coin-M) — contract grid only
--basePos / --no-basePos No true Open a base position at creation — contract grid only (ignored for neutral). Use --no-basePos to disable
--tpTriggerPx No - Take-profit trigger price (mutually exclusive with --tpRatio)
--slTriggerPx No - Stop-loss trigger price (mutually exclusive with --slRatio)
--tpRatio No - Take-profit ratio — contract grid only (mutually exclusive with --tpTriggerPx)
--slRatio No - Stop-loss ratio — contract grid only (mutually exclusive with --slTriggerPx)
--algoClOrdId No - Client-defined algo order ID (1-32 alphanumeric). Unique per user, enables idempotent creation

Grid Bot — Stop

okx bot grid stop --algoId <id> --algoOrdType <type> --instId <id> \
  [--stopType <1|2|3|5|6>] [--json]

--algoId and --algoOrdType must come from bot grid orders output. The algoOrdType must match the bot's actual type — do not guess.

--stopType Behavior
1 Stop + sell/close all positions at market (default)
2 Stop + keep current assets as-is
3 Stop + close at limit prices
5 Stop + partial close
6 Stop without selling (smart arbitrage)

Grid Bot — List Orders

okx bot grid orders --algoOrdType <type> [--instId <id>] [--algoId <id>] [--history] [--json]
Param Required Default Description
--algoOrdType Yes - grid (spot), contract_grid (contract), or moon_grid (moon)
--instId No - Filter by instrument
--algoId No - Filter by algo order ID. NOT a normal trade order ID
--history No false Show completed/stopped bots instead of active

Grid Bot — Details

okx bot grid details --algoOrdType <type> --algoId <id> [--json]

Returns: bot config, current PnL (pnlRatio), grid range, number of grids, state, position info.


Grid Bot — Sub-Orders

okx bot grid sub-orders --algoOrdType <type> --algoId <id> [--live] [--json]
Flag Effect
(default) Filled sub-orders (executed grid trades)
--live Pending grid orders currently on the book

DCA Bot — Create (Spot & Contract)

okx bot dca create --algoOrdType <spot_dca|contract_dca> --instId <id> --direction <long|short> \
  --initOrdAmt <n> --maxSafetyOrds <n> --tpPct <ratio> \
  [--lever <n>] [--safetyOrdAmt <n>] [--pxSteps <ratio>] [--pxStepsMult <mult>] [--volMult <mult>] \
  [--slPct <ratio>] [--slMode <limit|market>] [--allowReinvest] \
  [--triggerStrategy <instant|price|rsi>] [--triggerPx <price>] \
  [--triggerCond <cross_up|cross_down>] [--thold <threshold>] [--timeframe <timeframe>] [--timePeriod <period>] \
  [--algoClOrdId <id>] [--reserveFunds <true|false>] [--tradeQuoteCcy <ccy>] [--json]
Param Required Default Description
--algoOrdType Yes - spot_dca (Spot DCA) or contract_dca (Contract DCA)
--instId Yes - Instrument (e.g., BTC-USDT for spot, BTC-USDT-SWAP for contract)
--lever Cond. - Leverage multiplier (e.g., 3). Required for contract_dca
--direction Yes - long or short. spot_dca must be long
--initOrdAmt Yes - Initial order amount (quote currency)
--maxSafetyOrds Yes - Max safety orders, integer [0, 100] (e.g., 3; 0 = no DCA)
--safetyOrdAmt Cond. - Safety order amount (quote currency). Required when maxSafetyOrds > 0
--
how to use okx-cex-bot

How to use okx-cex-bot on Cursor

AI-first code editor with Composer

1

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-bot
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/okx/agent-skills --skill okx-cex-bot

The skills CLI fetches okx-cex-bot from GitHub repository okx/agent-skills and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/okx-cex-bot

Reload or restart Cursor to activate okx-cex-bot. Access the skill through slash commands (e.g., /okx-cex-bot) 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

GET_STARTED →

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. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 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

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.662 reviews
  • Hassan Anderson· Dec 20, 2024

    Keeps context tight: okx-cex-bot is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Kofi Bhatia· Dec 16, 2024

    Useful defaults in okx-cex-bot — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Mei Huang· Dec 16, 2024

    I recommend okx-cex-bot for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Pratham Ware· Dec 4, 2024

    okx-cex-bot is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Sakshi Patil· Nov 23, 2024

    Keeps context tight: okx-cex-bot is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Chinedu Ramirez· Nov 11, 2024

    okx-cex-bot is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Kiara Jackson· Nov 7, 2024

    I recommend okx-cex-bot for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.

  • Nia Gupta· Nov 7, 2024

    Solid pick for teams standardizing on skills: okx-cex-bot is focused, and the summary matches what you get after install.

  • Harper Rahman· Nov 7, 2024

    Useful defaults in okx-cex-bot — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Kofi Brown· Oct 26, 2024

    We added okx-cex-bot from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

showing 1-10 of 62

1 / 7