/okx:okx-cex-tradefrom okx
This skill should be used when the user asks to 'buy BTC', 'sell ETH', 'place a limit order', 'place a market order', 'cancel my order', 'amend my order', 'long BTC perp', 'short ETH swap', 'open a position', 'close a position', 'set take profit', 'set stop loss', 'add a trailing stop', 'set leverage', 'check my orders', 'order status', 'fill history', 'trade history', 'buy a call', 'sell a put', 'buy call option', 'sell put option', 'option chain', 'implied volatility', 'IV', 'option Greeks', 'delta', 'gamma', 'theta', 'vega', 'delta hedge', 'option order', 'option position', 'option fills', or any request to place/cancel/amend spot, perpetual swap, delivery futures, or options orders on OKX CEX. Covers spot trading, swap/perpetual contracts, delivery futures, options (calls/puts, Greeks, IV), and conditional (TP/SL/trailing) algo orders. Requires API credentials. Do NOT use for market data (use okx-cex-market), account balance/positions (use okx-cex-portfolio), or grid/DCA bots (use okx-cex-bot).
Ships in okx. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Spot, perpetual swap, delivery futures, and options order management on OKX exchange. Place, cancel, amend, and monitor orders; query option chains and Greeks; set take-profit/stop-loss and trailing stops; manage leverage and positions. Requires API credentials.
okx CLI:
npm install -g @okx_ai/okx-trade-cli
okx config init
Or set environment variables:
export OKX_API_KEY=your_key
export OKX_SECRET_KEY=your_secret
export OKX_PASSPHRASE=your_passphrase
okx --profile demo spot orders
Run this check before any authenticated command.
okx config show # verify configuration status (output is masked)
okx config init, and wait for setup to complete before retrying.--profile is required for all authenticated commands. Never add a profile implicitly.
| Value | Mode | Funds |
|---|---|---|
live | 实盘 | Real funds |
demo | 模拟盘 | Simulated funds |
Resolution rules:
live; "test" / "模拟" / "demo" → demo) → use it and inform the user: "Using --profile live (实盘)" or "Using --profile demo (模拟盘)""Continuing with --profile live (实盘) from earlier""Live (实盘) or Demo (模拟盘)?" — wait for answer before proceedingIf any command returns a 401 / authentication error:
~/.okx/config.toml
Update the fields api_key, secret_key, passphrase under the relevant profile.
Do NOT paste the new credentials into chat.okx config show to verify (output is masked)Profile is the single control for 实盘/模拟盘 switching — exactly two options:
--profile | Mode | Funds |
|---|---|---|
live | 实盘 | Real money — irreversible |
demo | 模拟盘 | Simulated — no real funds |
okx --profile live spot place ... # 实盘 — real funds
okx --profile demo spot place ... # 模拟盘 — simulated funds
Rules:
--profile is required on every authenticated command — determined in "Credential & Profile Check" Step B[profile: live] or [profile: demo]--demo flag for mode switching — use --profile insteadUser: "Buy 0.01 BTC"
Agent: "Live (实盘) or Demo (模拟盘)?"
User: "Demo"
Agent runs: okx --profile demo spot place --instId BTC-USDT --side buy --ordType market --sz 0.01
Agent replies: "Order placed: 7890123456 (OK) — simulated, no real funds used. [profile: demo]"
okx-cex-marketokx-cex-portfoliookx-cex-trade (this skill)okx-cex-bot# Market buy 0.01 BTC (spot)
okx spot place --instId BTC-USDT --side buy --ordType market --sz 0.01
# Limit sell 0.01 BTC at $100,000 (spot)
okx spot place --instId BTC-USDT --side sell --ordType limit --sz 0.01 --px 100000
# Long 1 contract BTC perp (cross margin)
okx swap place --instId BTC-USDT-SWAP --side buy --ordType market --sz 1 \
--tdMode cross --posSide long
# Close BTC perp long position entirely at market
okx swap close --instId BTC-USDT-SWAP --mgnMode cross --posSide long
# Set 10x leverage on BTC perp (cross)
okx swap leverage --instId BTC-USDT-SWAP --lever 10 --mgnMode cross
# Set TP/SL on a spot BTC position (sell when price hits $105k, SL at $88k)
okx spot algo place --instId BTC-USDT --side sell --ordType oco --sz 0.01 \
--tpTriggerPx 105000 --tpOrdPx -1 \
--slTriggerPx 88000 --slOrdPx -1
# Place trailing stop on BTC perp long (callback 2%)
okx swap algo trail --instId BTC-USDT-SWAP --side sell --sz 1 \
--tdMode cross --posSide long --callbackRatio 0.02
# View open spot orders
okx spot orders
# View open swap positions
okx swap positions
# Cancel a spot order
okx spot cancel --instId BTC-USDT --ordId <ordId>
| # | Command | Type | Description |
|---|---|---|---|
| 1 | okx spot place | WRITE | Place spot order (market/limit/post_only/fok/ioc) |
| 2 | okx spot cancel | WRITE | Cancel spot order |
| 3 | okx spot amend | WRITE | Amend spot order price or size |
| 4 | okx spot algo place | WRITE | Place spot TP/SL algo order |
| 5 | okx spot algo amend | WRITE | Amend spot TP/SL levels |
| 6 | okx spot algo cancel | WRITE | Cancel spot algo order |
| 7 | okx spot orders | READ | List open or historical spot orders |
| 8 | okx spot get | READ | Single spot order details |
| 9 | okx spot fills | READ | Spot trade fill history |
| 10 | okx spot algo orders | READ | List spot TP/SL algo orders |
| # | Command | Type | Description |
|---|---|---|---|
| 11 | okx swap place | WRITE | Place perpetual swap order |
| 12 | okx swap cancel | WRITE | Cancel swap order |
| 13 | okx swap amend | WRITE | Amend swap order price or size |
| 14 | okx swap close | WRITE | Close entire position at market |
| 15 | okx swap leverage | WRITE | Set leverage for an instrument |
| 16 | okx swap algo place | WRITE | Place swap TP/SL algo order |
| 17 | okx swap algo trail | WRITE | Place swap trailing stop order |
| 18 | okx swap algo amend | WRITE | Amend swap algo order |
| 19 | okx swap algo cancel | WRITE | Cancel swap algo order |
| 20 | okx swap positions | READ | Open perpetual swap positions |
| 21 | okx swap orders | READ | List open or historical swap orders |
| 22 | okx swap get | READ | Single swap order details |
| 23 | okx swap fills | READ | Swap trade fill history |
| 24 | okx swap get-leverage | READ | Current leverage settings |
| 25 | okx swap algo orders | READ | List swap algo orders |
| # | Command | Type | Description |
|---|---|---|---|
| 26 | okx futures place | WRITE | Place delivery futures order |
| 27 | okx futures cancel | WRITE | Cancel delivery futures order |
| 28 | okx futures orders | READ | List delivery futures orders |
| 29 | okx futures positions | READ | Open delivery futures positions |
| 30 | okx futures fills | READ | Delivery futures fill history |
| 31 | okx futures get | READ | Single delivery futures order details |
| # | Command | Type | Description |
|---|---|---|---|
| 32 | okx option instruments | READ | Option chain: list available contracts for an underlying |
| 33 | okx option greeks | READ | Implied volatility + Greeks (delta/gamma/theta/vega) by underlying |
| 34 | okx option place | WRITE | Place option order (call or put, buyer or seller) |
| 35 | okx option cancel | WRITE | Cancel unfilled option order |
| 36 | okx option amend | WRITE | Amend option order price or size |
| 37 | okx option batch-cancel | WRITE | Batch cancel up to 20 option orders |
| 38 | okx option orders | READ | List option orders (live / history / archive) |
| 39 | okx option get | READ | Single option order details |
| 40 | okx option positions | READ | Open option positions with live Greeks |
| 41 | okx option fills | READ | Option trade fill history |
User: "Buy $500 worth of ETH at market"
1. okx-cex-market okx market ticker ETH-USDT → get current price to estimate sz
2. okx-cex-portfolio okx account balance USDT → confirm available funds ≥ $500
↓ user approves
3. okx-cex-trade okx spot place --instId ETH-USDT --side buy --ordType market --sz <sz>
4. okx-cex-trade okx spot fills --instId ETH-USDT → confirm fill price and size
User: "Long 5 contracts BTC perp at market, TP at $105k, SL at $88k"
1. okx-cex-portfolio okx account balance USDT → confirm margin available
2. okx-cex-portfolio okx account max-size --instId BTC-USDT-SWAP --tdMode cross → confirm size ok
↓ user approves
3. okx-cex-trade okx swap place --instId BTC-USDT-SWAP --side buy \
--ordType market --sz 5 --tdMode cross --posSide long
4. okx-cex-trade okx swap algo place --instId BTC-USDT-SWAP --side sell \
--ordType oco --sz 5 --tdMode cross --posSide long \
--tpTriggerPx 105000 --tpOrdPx -1 \
--slTriggerPx 88000 --slOrdPx -1
5. okx-cex-trade okx swap positions → confirm position opened
User: "Set BTC perp to 5x leverage then go long 10 contracts"
1. okx-cex-trade okx swap get-leverage --instId BTC-USDT-SWAP --mgnMode cross → check current lever
↓ user approves change
2. okx-cex-trade okx swap leverage --instId BTC-USDT-SWAP --lever 5 --mgnMode cross
3. okx-cex-trade okx swap place --instId BTC-USDT-SWAP --side buy \
--ordType market --sz 10 --tdMode cross --posSide long
4. okx-cex-trade okx swap positions → confirm position + leverage
User: "Set a 3% trailing stop on my BTC perp long"
1. okx-cex-trade okx swap positions → confirm size of open long
2. okx-cex-market okx market ticker BTC-USDT-SWAP → current price reference
↓ user approves
3. okx-cex-trade okx swap algo trail --instId BTC-USDT-SWAP --side sell \
--sz <pos_size> --tdMode cross --posSide long --callbackRatio 0.03
4. okx-cex-trade okx swap algo orders --instId BTC-USDT-SWAP → confirm trail order placed
User: "Cancel all my open BTC spot orders"
1. okx-cex-trade okx spot orders → list open orders
2. okx-cex-trade (for each ordId) okx spot cancel --instId BTC-USDT --ordId <id>
3. okx-cex-trade okx spot orders → confirm all cancelled
User: "Buy 2 BTC call options at strike 95000 expiring end of March"
1. okx-cex-trade okx option instruments --uly BTC-USD --expTime 250328
→ find exact instId (e.g. BTC-USD-250328-95000-C)
2. okx-cex-trade okx option greeks --uly BTC-USD --expTime 250328
→ check IV, delta, and markPx to assess fair value
3. okx-cex-portfolio okx account balance → confirm enough USDT/BTC for premium
↓ user approves
4. okx-cex-trade okx option place --instId BTC-USD-250328-95000-C \
--side buy --ordType limit --tdMode cash --sz 2 --px 0.005
5. okx-cex-trade okx option orders → confirm order is live
User: "What's my total delta exposure from options?"
1. okx-cex-trade okx option positions → live positions with per-contract Greeks
2. okx-cex-market okx market ticker BTC-USD → current spot price for context
Before any authenticated command:
Determine profile (required):
live (实盘) or demo (模拟盘) — exactly these two values"Using --profile live (实盘)""Continuing with --profile live (实盘) from earlier""Live (实盘) or Demo (模拟盘)?" — wait for answerIf no credentials configured: guide user to run okx config init, stop all trading actions
After every command result: append [profile: live] or [profile: demo] to the response
Spot (instId format: BTC-USDT):
okx spot place/cancel/amendokx spot algo place/amend/cancelokx spot orders/get/fills/algo ordersSwap/Perpetual (instId format: BTC-USDT-SWAP):
okx swap place/cancel/amendokx swap closeokx swap leverage / okx swap get-leverageokx swap algo place/amend/cancelokx swap algo trailokx swap positions/orders/get/fills/get-leverage/algo ordersFutures/Delivery (instId format: BTC-USDT-250328):
okx futures place/cancelokx futures orders/positions/fills/getOptions (instId format: BTC-USD-250328-95000-C or ...-P):
okx option instruments --uly BTC-USDokx option greeks --uly BTC-USDokx option place/cancel/amendokx option batch-cancel --orders '[...]'okx option orders/get/positions/fillscash for buyers (full premium upfront, no liquidation risk); cross or isolated for sellers (margin required)Read commands (orders, positions, fills, get, get-leverage, algo orders): run immediately; note the profile used.
--history flag: defaults to active/open; use --history only if user explicitly asks for history--ordType for algo: conditional = single TP or SL; oco = both TP and SL together--tdMode for swap/futures: cross or isolated; spot always uses cash (set automatically)--posSide for hedge mode: long or short; omit in net modeWrite commands (place, cancel, amend, close, leverage, algo): two confirmations required:
--profile live (实盘) or --profile demo (模拟盘)--instId, --side, --ordType, --sz; price (--px) required for limit orders--instId, --side, --sz, --tdMode; confirm --posSide if in hedge mode--instId, --mgnMode, --posSide; closes the entire position at market--tpOrdPx -1 for market execution at trigger--callbackRatio (e.g., 0.02 = 2%) or --callbackSpread (fixed price spread)spot place: run okx spot orders to confirm order is live or okx spot fills if market orderswap place: run okx swap orders or okx swap positions to confirmswap close: run okx swap positions to confirm position size is 0okx spot algo orders or okx swap algo orders to confirm algo is activeokx spot orders / okx swap orders to confirm order is gone--ordType | Description | Requires --px |
|---|---|---|
market | Fill immediately at best price | No |
limit | Fill at specified price or better | Yes |
post_only | Limit order; cancelled if it would be a taker | Yes |
fok | Fill entire order immediately or cancel | Yes |
ioc | Fill what's available immediately, cancel rest | Yes |
conditional | Algo: single TP or SL trigger | No (set trigger px) |
oco | Algo: TP + SL together (one cancels other) | No (set both trigger px) |
move_order_stop | Trailing stop (swap only) | No (set callback) |
okx spot place --instId <id> --side <buy|sell> --ordType <type> --sz <n> \
[--px <price>] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
--instId | Yes | - | Spot instrument (e.g., BTC-USDT) |
--side | Yes | - | buy or sell |
--ordType | Yes | - | market, limit, post_only, fok, ioc |
--sz | Yes | - | Order size in base currency (e.g., BTC amount) |
--px | Cond. | - | Price — required for limit, post_only, fok, ioc |
okx spot cancel --instId <id> --ordId <id> [--json]
okx spot amend --instId <id> [--ordId <id>] [--clOrdId <id>] \
[--newSz <n>] [--newPx <p>] [--json]
Must provide at least one of --newSz or --newPx.
okx spot algo place --instId <id> --side <buy|sell> --ordType <oco|conditional> --sz <n> \
[--tpTriggerPx <p>] [--tpOrdPx <p|-1>] \
[--slTriggerPx <p>] [--slOrdPx <p|-1>] \
[--json]
| Param | Required | Default | Description |
|---|---|---|---|
--tpTriggerPx | Cond. | - | Take-profit trigger price |
--tpOrdPx | Cond. | - | TP order price; use -1 for market execution |
--slTriggerPx | Cond. | - | Stop-loss trigger price |
--slOrdPx | Cond. | - | SL order price; use -1 for market execution |
For oco: provide both TP and SL params. For conditional: provide only TP or only SL.
okx spot algo amend --instId <id> --algoId <id> \
[--newSz <n>] [--newTpTriggerPx <p>] [--newTpOrdPx <p>] \
[--newSlTriggerPx <p>] [--newSlOrdPx <p>] [--json]
okx spot algo cancel --instId <id> --algoId <id> [--json]
okx spot orders [--instId <id>] [--history] [--json]
| Flag | Effect |
|---|---|
| (default) | Open/pending orders |
--history | Historical (filled, cancelled) orders |
okx spot get --instId <id> [--ordId <id>] [--clOrdId <id>] [--json]
Returns: ordId, instId, side, ordType, px, sz, fillSz, avgPx, state, cTime.
okx spot fills [--instId <id>] [--ordId <id>] [--json]
Returns: instId, side, fillPx, fillSz, fee, ts.
okx spot algo orders [--instId <id>] [--history] [--ordType <type>] [--json]
Returns: algoId, instId, type, side, sz, tpTrigger, slTrigger, state.
okx swap place --instId <id> --side <buy|sell> --ordType <type> --sz <n> \
--tdMode <cross|isolated> \
[--posSide <long|short>] [--px <price>] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
--instId | Yes | - | Swap instrument (e.g., BTC-USDT-SWAP) |
--side | Yes | - | buy or sell |
--ordType | Yes | - | market, limit, post_only, fok, ioc |
--sz | Yes | - | Number of contracts |
--tdMode | Yes | - | cross or isolated |
--posSide | Cond. | - | long or short — required in hedge mode |
--px | Cond. | - | Price — required for limit orders |
okx swap cancel --instId <id> --ordId <id> [--json]
okx swap amend --instId <id> [--ordId <id>] [--clOrdId <id>] \
[--newSz <n>] [--newPx <p>] [--json]
okx swap close --instId <id> --mgnMode <cross|isolated> \
[--posSide <long|short>] [--autoCxl] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
--instId | Yes | - | Swap instrument |
--mgnMode | Yes | - | cross or isolated |
--posSide | Cond. | - | long or short — required in hedge mode |
--autoCxl | No | false | Auto-cancel pending orders before closing |
Closes the entire position at market price.
okx swap leverage --instId <id> --lever <n> --mgnMode <cross|isolated> \
[--posSide <long|short>] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
--instId | Yes | - | Swap instrument |
--lever | Yes | - | Leverage multiplier (e.g., 10) |
--mgnMode | Yes | - | cross or isolated |
--posSide | Cond. | - | long or short — required for isolated mode in hedge mode |
okx swap get-leverage --instId <id> --mgnMode <cross|isolated> [--json]
Returns table: instId, mgnMode, posSide, lever.
okx swap algo place --instId <id> --side <buy|sell> --ordType <oco|conditional> --sz <n> \
--tdMode <cross|isolated> \
[--posSide <long|short>] [--reduceOnly] \
[--tpTriggerPx <p>] [--tpOrdPx <p|-1>] \
[--slTriggerPx <p>] [--slOrdPx <p|-1>] \
[--json]
--reduceOnly: close-only; will not open a new position if one doesn't exist.
okx swap algo trail --instId <id> --side <buy|sell> --sz <n> \
--tdMode <cross|isolated> \
[--posSide <long|short>] [--reduceOnly] \
[--callbackRatio <ratio>] [--callbackSpread <spread>] \
[--activePx <price>] \
[--json]
| Param | Required | Default | Description |
|---|---|---|---|
--callbackRatio | Cond. | - | Trailing callback as a ratio (e.g., 0.02 = 2%); use this or --callbackSpread |
--callbackSpread | Cond. | - | Trailing callback as fixed price distance |
--activePx | No | - | Price at which trailing stop becomes active |
okx swap algo amend --instId <id> --algoId <id> \
[--newSz <n>] [--newTpTriggerPx <p>] [--newTpOrdPx <p>] \
[--newSlTriggerPx <p>] [--newSlOrdPx <p>] [--json]
okx swap algo cancel --instId <id> --algoId <id> [--json]
okx swap orders [--instId <id>] [--history] [--json]
okx swap get --instId <id> [--ordId <id>] [--clOrdId <id>] [--json]
Returns: ordId, instId, side, posSide, ordType, px, sz, fillSz, avgPx, state, cTime.
okx swap positions [<instId>] [--json]
Returns: instId, side, size, avgPx, upl, uplRatio, lever. Only non-zero positions.
okx swap fills [--instId <id>] [--ordId <id>] [--archive] [--json]
--archive: access older fills beyond the default window.
okx swap algo orders [--instId <id>] [--history] [--ordType <type>] [--json]
okx futures place --instId <id> --side <buy|sell> --ordType <type> --sz <n> \
--tdMode <cross|isolated> \
[--posSide <long|short>] [--px <price>] [--reduceOnly] [--json]
--instId format: BTC-USDT-250328 (delivery date suffix).
okx futures cancel --instId <id> --ordId <id> [--json]
okx futures orders [--instId <id>] [--status <open|history|archive>] [--json]
--status | Effect |
|---|---|
open | Active/pending orders (default) |
history | Recent completed/cancelled |
archive | Older history |
okx futures positions [<instId>] [--json]
Returns: instId, side, pos, avgPx, upl, lever.
okx futures fills [--instId <id>] [--ordId <id>] [--archive] [--json]
okx futures get --instId <id> [--ordId <id>] [--json]
okx option instruments --uly <underlying> [--expTime <YYMMDD>] [--json]
| Param | Required | Description |
|---|---|---|
--uly | Yes | Underlying, e.g. BTC-USD or ETH-USD |
--expTime | No | Filter by expiry date, e.g. 250328 |
Returns: instId, uly, expTime, stk (strike), optType (C/P), state.
Run this before placing any option order to get the exact instId.
okx option greeks --uly <underlying> [--expTime <YYMMDD>] [--json]
Returns IV (markVol) and BS Greeks (deltaBS, gammaBS, thetaBS, vegaBS) plus markPx for each contract.
okx option place --instId <id> --side <buy|sell> --ordType <type> \
--tdMode <cash|cross|isolated> --sz <n> \
[--px <price>] [--reduceOnly] [--clOrdId <id>] [--json]
| Param | Required | Default | Description |
|---|---|---|---|
--instId | Yes | - | e.g. BTC-USD-250328-95000-C (call) or ...-P (put) |
--side | Yes | - | buy or sell |
--ordType | Yes | - | market, limit, post_only, fok, ioc |
--tdMode | Yes | - | cash = buyer (full premium); cross/isolated = seller (margin) |
--sz | Yes | - | Number of contracts |
--px | Cond. | - | Required for limit, post_only, fok, ioc |
--reduceOnly | No | false | Close-only; do not open a new position |
tdMode rules:
side=buy): always use cash — pay full premium, no margin call riskside=sell): use cross or isolated — margin required, liquidation riskokx option cancel --instId <id> [--ordId <id>] [--clOrdId <id>] [--json]
okx option amend --instId <id> [--ordId <id>] [--clOrdId <id>] \
[--newSz <n>] [--newPx <p>] [--json]
Must provide at least one of --newSz or --newPx.
okx option batch-cancel --orders '<JSON>' [--json]
--orders is a JSON array of up to 20 objects, each {"instId":"...","ordId":"..."}:
okx option batch-cancel --orders '[{"instId":"BTC-USD-250328-95000-C","ordId":"123"},{"instId":"BTC-USD-250328-90000-P","ordId":"456"}]'
okx option orders [--instId <id>] [--uly <underlying>] [--history] [--archive] [--json]
| Flag | Effect |
|---|---|
| (default) | Live/pending orders |
--history | Historical (7d) |
--archive | Older archive (3mo) |
okx option get --instId <id> [--ordId <id>] [--clOrdId <id>] [--json]
Returns: ordId, instId, side, ordType, px, sz, fillSz, avgPx, state, cTime.
okx option positions [--instId <id>] [--uly <underlying>] [--json]
Returns: instId, posSide, pos, avgPx, upl, deltaPA, gammaPA, thetaPA, vegaPA. Only non-zero positions shown.
okx option fills [--instId <id>] [--ordId <id>] [--archive] [--json]
--archive: access fills beyond the default 3-day window (up to 3 months).
| Tool | Description |
|---|---|
spot_place_order | Place spot order |
spot_cancel_order | Cancel spot order |
spot_amend_order | Amend spot order |
spot_place_algo_order | Place spot TP/SL algo |
spot_amend_algo_order | Amend spot algo |
spot_cancel_algo_order | Cancel spot algo |
spot_get_orders | List spot orders |
spot_get_order | Get single spot order |
spot_get_fills | Spot fill history |
spot_get_algo_orders | List spot algo orders |
swap_place_order | Place swap order |
swap_cancel_order | Cancel swap order |
swap_amend_order | Amend swap order |
swap_close_position | Close swap position |
swap_set_leverage | Set swap leverage |
swap_place_algo_order | Place swap TP/SL algo |
swap_place_move_stop_order | Place swap trailing stop |
swap_amend_algo_order | Amend swap algo |
swap_cancel_algo_orders | Cancel swap algo |
swap_get_positions | Swap positions |
swap_get_orders | List swap orders |
swap_get_order | Get single swap order |
swap_get_fills | Swap fill history |
swap_get_leverage | Get swap leverage |
swap_get_algo_orders | List swap algo orders |
futures_place_order | Place futures order |
futures_cancel_order | Cancel futures order |
futures_get_orders | List futures orders |
futures_get_positions | Futures positions |
futures_get_fills | Futures fill history |
futures_get_order | Get single futures order |
option_get_instruments | Option chain (list available contracts) |
option_get_greeks | IV and Greeks by underlying |
option_place_order | Place option order |
option_cancel_order | Cancel option order |
option_amend_order | Amend option order |
option_batch_cancel | Batch cancel up to 20 option orders |
option_get_orders | List option orders |
option_get_order | Get single option order |
option_get_positions | Option positions with live Greeks |
option_get_fills | Option fill history |
"Buy 0.05 BTC at market"
okx spot place --instId BTC-USDT --side buy --ordType market --sz 0.05
# → Order placed: 7890123456 (OK)
"Set a limit sell for 0.1 ETH at $3500"
okx spot place --instId ETH-USDT --side sell --ordType limit --sz 0.1 --px 3500
# → Order placed: 7890123457 (OK)
"Show my open spot orders"
okx spot orders
# → table: ordId, instId, side, type, price, size, filled, state
"Long 10 contracts BTC perp at market (cross margin)"
okx swap place --instId BTC-USDT-SWAP --side buy --ordType market --sz 10 \
--tdMode cross --posSide long
# → Order placed: 7890123458 (OK)
"Set take profit at $105k and stop loss at $88k on BTC perp long"
okx swap algo place --instId BTC-USDT-SWAP --side sell --ordType oco --sz 10 \
--tdMode cross --posSide long \
--tpTriggerPx 105000 --tpOrdPx -1 \
--slTriggerPx 88000 --slOrdPx -1
# → Algo order placed: ALGO456789 (OK)
"Close my ETH perp position"
okx swap close --instId ETH-USDT-SWAP --mgnMode cross --posSide long
# → Position closed: ETH-USDT-SWAP long
"Set BTC perp leverage to 5x (cross)"
okx swap leverage --instId BTC-USDT-SWAP --lever 5 --mgnMode cross
# → Leverage set: 5x BTC-USDT-SWAP
"Place a 2% trailing stop on my BTC perp long"
okx swap algo trail --instId BTC-USDT-SWAP --side sell --sz 10 \
--tdMode cross --posSide long --callbackRatio 0.02
# → Trailing stop placed: TRAIL123 (OK)
"Show my open swap positions"
okx swap positions
# → table: instId, side, size, avgPx, upl, uplRatio, lever
"What are my recent fill trades for BTC spot?"
okx spot fills --instId BTC-USDT
# → table: instId, side, fillPx, fillSz, fee, ts
"Show me the BTC option chain expiring March 28"
okx option instruments --uly BTC-USD --expTime 250328
# → table: instId, expTime, stk, optType (C/P), state
"What's the IV and delta for BTC options expiring March 28?"
okx option greeks --uly BTC-USD --expTime 250328
# → table: instId, delta, gamma, theta, vega, iv (markVol), markPx
"Buy 1 BTC call at strike 95000 expiring March 28, limit at 0.005 BTC"
okx option place --instId BTC-USD-250328-95000-C \
--side buy --ordType limit --tdMode cash --sz 1 --px 0.005
# → Order placed: 7890123460 (OK)
"Show my open option positions"
okx option positions
# → table: instId, posSide, pos, avgPx, upl, delta, gamma, theta, vega
--sz is in base currency (e.g., BTC amount), not USDTokx-cex-portfolio account balance before placingmarket orders don't need --px; limit / post_only / fok / ioc dotpTriggerPx and slTriggerPx; price -1 means market execution at triggerfills shows executed trades; orders --history shows all orders including cancelledlong_short_mode); omit in net mode. Check okx account config for posModecross for cross-margin, isolated for isolated marginswap close closes the entire position; to partial close, use swap place with a reduce-only algo--callbackRatio (relative, e.g., 0.02) or --callbackSpread (absolute price), not both--side opposite to position (e.g., long position → sell algo)BTC-USDT-250328 for March 28, 2025 expiryswap close — use futures cancel + futures place for adjustments{uly}-{YYMMDD}-{strike}-{C|P} — e.g. BTC-USD-250328-95000-C; always run okx option instruments --uly BTC-USD first to confirm the exact contract existscash (full premium paid upfront, no liquidation); sellers use cross or isolated (margin required, liquidation risk)--px is quoted in BTC (e.g. 0.005 = 0.005 BTC premium per contract)swap algo / spot algo commands do not apply to option positions; manage risk by cancelling/amending option orders directlyokx option positions returns live portfolio Greeks (deltaPA, gammaPA, etc.) from the account's position-level calculation, while okx option greeks returns BS model Greeks per contract~/.okx/config.toml or env vars--profile <name> is required for all authenticated commands; see "Credential & Profile Check" section[profile: <name>] tag for audit reference--json returns raw OKX API v5 responsenet vs long_short_mode) affects whether --posSide is required--sz is base currency; swap/futures --sz is number of contractsWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ulpi-io/plugin-marketplace --plugin okx9 skills in this plugin
/okx-cex-botThis skill should be used when the user asks to 'start a grid bot', 'create a grid bot', 'stop the grid bot', 'show my grid bots', 'grid bot status', 'grid bot P&L', 'create a DCA bot', 'start a DCA bot', 'set up a martingale bot', 'show my DCA bots', 'stop the DCA bot', 'DCA P&L', or any request involving creating, stopping, querying, or monitoring grid or DCA (Dollar Cost Averaging / Martingale) bots on OKX CEX. Grid covers both spot and contract variants. DCA is contract-only (leveraged Martingale on futures/swaps). Requires API credentials. Do NOT use for regular spot/swap/futures orders (use okx-cex-trade), market data (use okx-cex-market), or account balance/portfolio (use okx-cex-portfolio)./okx-cex-marketThis skill should be used when the user asks for 'price of BTC', 'ETH ticker', 'show me the orderbook', 'market depth', 'BTC candles', 'OHLCV chart data', 'funding rate', 'open interest', 'mark price', 'index price', 'recent trades', 'price limit', 'list instruments', 'what instruments are available', or any request to query public market data on OKX CEX. All commands are read-only and do NOT require API credentials. Do NOT use for account balance/positions (use okx-cex-portfolio), placing/cancelling orders (use okx-cex-trade), or grid/DCA bots (use okx-cex-bot).Other plugins' skills for the same job