okx-cex-trade

Places, amends, and cancels spot, swap, futures, options, and event contract orders on OKX via CLI.

Updated Aug 18, 2026
One-click install
npx skills add https://github.com/wandreandrade2018-maker/claude-config --skill okx-cex-trade-wandreandrade2018-maker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: okx-cex-trade
Source: https://github.com/wandreandrade2018-maker/claude-config/tree/main/.agents/skills/okx-cex-trade
Command: npx skills add https://github.com/wandreandrade2018-maker/claude-config --skill okx-cex-trade-wandreandrade2018-maker

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @okx_ai/okx-trade-cli, and includes references (resource) components.

What problem does it solve? Executing and managing trades on the OKX exchange normally requires manual work in the web UI or writing custom API integrations. This Skill lets an AI agent place, amend, cancel, and monitor orders across spot, perpetual swap, delivery futures, options, and event contracts through the okx CLI, with built-in safeguards for credentials, demo/live mode, and order sizing. ## Core Features & Use Cases - Multi-instrument order management: Place market/limit orders, set leverage, close positions, and query orders, fills, and positions for spot, swap, futures, and options instruments. - Conditional and algo orders: Attach take-profit/stop-loss, trailing stops, and advanced algo types (trigger, chase, iceberg, TWAP) with self-trade prevention and auto-cancel-on-close options. - Options and event contracts: Query option chains and Greeks, trade calls/puts with buyer/seller margin modes, and trade binary prediction-market event contracts (Yes/No, Up/Down). - Use Case: A user says "long BTC perp with 500 USDT margin at 10x and set a stop loss at 88000" — the Skill verifies credentials and contract face value, confirms sizing mode, places the swap order with attached SL, and verifies the position afterward. ## Quick Start Ask the agent to buy 0.01 BTC at market price on OKX spot in demo mode.

Frequently Asked Questions about okx-cex-trade

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I place a market or limit order on OKX from the command line?

Use okx spot place with --instId, --side, --ordType, and --sz; limit orders also require --px. For derivatives use okx swap place or okx futures place with --tdMode cross or isolated, and --posSide in hedge mode.

How do I set a take profit and stop loss on an OKX position?

Attach TP/SL directly when placing an order with --tpTriggerPx, --tpOrdPx=-1, --slTriggerPx, and --slOrdPx=-1, or place a standalone algo order via okx swap algo place with ordType oco (both TP and SL) or conditional (one side).

Does the okx CLI support demo trading before using real funds?

Yes. OAuth users add --demo to any command for simulated trading, while API-key users select a demo profile with --profile. The Skill requires confirming live or demo mode before any authenticated command.

How do I specify order size in USDT instead of contracts on OKX swaps?

Pass the USDT amount as --sz with --tgtCcy quote_ccy for notional value or --tgtCcy margin for margin cost, and the system converts to contracts automatically using the instrument's ctVal and current leverage.

Why does setting leverage on OKX fail with an error about cancelling orders or bots?

Pending algo orders or active grid bots on that instrument block leverage changes under cross margin. Query okx swap algo orders --status pending first, then check bot grid-orders; the Skill reports findings but never cancels orders or stops bots without explicit user confirmation.

Can I trade OKX event contracts and prediction markets with this Skill?

Yes. Discover markets with okx event browse or okx event series, get tradeable instrument IDs from okx event markets, then place Yes/No or Up/Down orders with okx event place. Prices range 0.01-0.99 and reflect market-implied probability.