agentleFS
open-crab-aiopen-crab-ai/okx-plugin/skills/okx-trade/SKILL.md

okx-trade

Skill1 starsChanged 9 months agoApache-2.0View on GitHub

Use this skill when users want to place, cancel, or modify orders on OKX. Covers market/limit orders, batch orders, algo orders (TP/SL, trigger, trailing stop, TWAP), order history, fill details, easy convert, one-click repay, and order pre-check. For account balance/positions, use okx-account. For market data, use okx-market.

  • Reads credentials
  • Installs packages

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Confirm installed: Run which okx. If not found: npm install -g okx-trader-cli

    line 17
  2. Very specific:

    Check sCode per order in batch operations.

    line 200

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

OKX Trade CLI

30+ commands for order management: place/cancel/amend orders, batch operations, algo orders, fills, easy convert, and one-click repay.

Pre-flight Checks

  1. Confirm installed: Run which okx. If not found: npm install -g okx-trader-cli
  2. API credentials: Set OKX_API_KEY, OKX_SECRET_KEY, OKX_PASSPHRASE in .env

Skill Routing

  • For account balance/positions/config → use okx-account
  • For market data (prices, candles) → use okx-market
  • For public data (instruments, funding rate) → use okx-public
  • For grid/signal/DCA bots → use okx-trading-bot

Commands

Place Order

# Spot market buy
okx trade order --instId BTC-USDT --tdMode cash --side buy --ordType market --sz 100 --tgtCcy quote_ccy

# Spot limit buy
okx trade order --instId BTC-USDT --tdMode cash --side buy --ordType limit --sz 0.01 --px 60000

# Swap (perpetual) with leverage
okx trade order --instId BTC-USDT-SWAP --tdMode cross --side buy --ordType market --sz 1

# With TP/SL
okx trade order --instId BTC-USDT-SWAP --tdMode cross --side buy --ordType limit --sz 1 --px 60000 --tpTriggerPx 65000 --tpOrdPx 64900 --slTriggerPx 58000 --slOrdPx 57900

Batch Place Orders

okx trade batch-orders --data '[{"instId":"BTC-USDT","tdMode":"cash","side":"buy","ordType":"limit","sz":"0.01","px":"60000"},{"instId":"ETH-USDT","tdMode":"cash","side":"buy","ordType":"limit","sz":"0.1","px":"3000"}]'

Cancel Order

okx trade cancel-order --instId BTC-USDT --ordId 123456789
okx trade cancel-order --instId BTC-USDT --clOrdId myOrder001

Batch Cancel Orders

okx trade cancel-batch-orders --data '[{"instId":"BTC-USDT","ordId":"123"},{"instId":"ETH-USDT","ordId":"456"}]'

Amend Order

okx trade amend-order --instId BTC-USDT --ordId 123456789 --newSz 0.02
okx trade amend-order --instId BTC-USDT --ordId 123456789 --newPx 61000

Close Position

okx trade close-position --instId BTC-USDT-SWAP --mgnMode cross
okx trade close-position --instId BTC-USDT-SWAP --mgnMode cross --posSide long

Get Order Details

okx trade get-order --instId BTC-USDT --ordId 123456789

Get Pending Orders

okx trade orders-pending
okx trade orders-pending --instType SPOT
okx trade orders-pending --instId BTC-USDT

Get Order History (7 days)

okx trade orders-history --instType SPOT
okx trade orders-history --instType SWAP --state filled

Get Order History (3 months)

okx trade orders-history-archive --instType SPOT

Get Fills (3 days)

okx trade fills
okx trade fills --instType SPOT --instId BTC-USDT

Get Fills History (3 months)

okx trade fills-history --instType SPOT

Mass Cancel

okx trade mass-cancel --instType SPOT
okx trade mass-cancel --instType SWAP --instFamily BTC-USDT

Cancel All After (Dead Man's Switch)

okx trade cancel-all-after --timeOut 30
okx trade cancel-all-after --timeOut 0  # cancel the timer

Get Account Rate Limit

okx trade account-rate-limit

Order Pre-check

okx trade order-precheck --instId BTC-USDT --tdMode cash --side buy --ordType limit --sz 0.01 --px 60000

Place Algo Order (TP/SL, Trigger, Trailing Stop, TWAP)

# Stop-loss / Take-profit
okx trade order-algo --instId BTC-USDT-SWAP --tdMode cross --side buy --ordType conditional --sz 1 --tpTriggerPx 70000 --tpOrdPx 69900 --slTriggerPx 58000 --slOrdPx 57900

# Trigger order
okx trade order-algo --instId BTC-USDT-SWAP --tdMode cross --side buy --ordType trigger --sz 1 --triggerPx 65000 --orderPx 65100

# Trailing stop
okx trade order-algo --instId BTC-USDT-SWAP --tdMode cross --side sell --ordType move_order_stop --sz 1 --callbackRatio 0.05

# TWAP
okx trade order-algo --instId BTC-USDT-SWAP --tdMode cross --side buy --ordType twap --sz 10 --pxLimit 65000 --szLimit 1 --timeInterval 60

Cancel Algo Orders

okx trade cancel-algos --data '[{"algoId":"123","instId":"BTC-USDT-SWAP"}]'

Get Algo Order Details

okx trade get-algo-order --algoId 123456

Get Pending Algo Orders

okx trade algo-orders-pending --ordType trigger
okx trade algo-orders-pending --ordType conditional --instType SWAP

Get Algo Order History

okx trade algo-orders-history --ordType trigger --state effective

Easy Convert

okx trade easy-convert-list
okx trade easy-convert --fromCcy USDC,DAI --toCcy USDT
okx trade easy-convert-history

One-Click Repay

okx trade one-click-repay-list
okx trade one-click-repay --debtCcy USDT --repayCcy BTC
okx trade one-click-repay-history

Key Parameters

ParameterDescription
--instIdInstrument ID, e.g. BTC-USDT, BTC-USDT-SWAP
--tdModeTrade mode: cash (spot), cross (cross margin), isolated
--sidebuy or sell
--ordTypemarket, limit, post_only, fok, ioc
--szOrder size (contracts for derivatives, base currency for spot)
--pxPrice (required for limit orders)
--tgtCcybase_ccy or quote_ccy (spot market orders)
--posSidelong, short, net (for long/short mode)

Response Format

{
  "code": "0",
  "msg": "",
  "data": [{ "ordId": "...", "clOrdId": "...", "sCode": "0", "sMsg": "" }]
}

Check sCode per order in batch operations.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.