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
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- okx-accountSkill
- okx-assetSkill
- okx-copy-tradingSkill
- okx-financeSkill
- okx-marketSkill
- okx-publicSkill
- okx-rfqSkill
- okx-rubikSkill
- okx-spreadSkill
- okx-subaccountSkill
- okx-systemSkill
- okx-trading-botSkill
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
- Very specific: line 17
Confirm installed: Run which okx. If not found: npm install -g okx-trader-cli
- Very specific: line 200
Check sCode per order in batch operations.
≈ “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.
Files
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
- Confirm installed: Run
which okx. If not found:npm install -g okx-trader-cli - API credentials: Set
OKX_API_KEY,OKX_SECRET_KEY,OKX_PASSPHRASEin.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 57900Batch 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 myOrder001Batch 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 61000Close Position
okx trade close-position --instId BTC-USDT-SWAP --mgnMode cross
okx trade close-position --instId BTC-USDT-SWAP --mgnMode cross --posSide longGet Order Details
okx trade get-order --instId BTC-USDT --ordId 123456789Get Pending Orders
okx trade orders-pending
okx trade orders-pending --instType SPOT
okx trade orders-pending --instId BTC-USDTGet Order History (7 days)
okx trade orders-history --instType SPOT
okx trade orders-history --instType SWAP --state filledGet Order History (3 months)
okx trade orders-history-archive --instType SPOTGet Fills (3 days)
okx trade fills
okx trade fills --instType SPOT --instId BTC-USDTGet Fills History (3 months)
okx trade fills-history --instType SPOTMass Cancel
okx trade mass-cancel --instType SPOT
okx trade mass-cancel --instType SWAP --instFamily BTC-USDTCancel All After (Dead Man's Switch)
okx trade cancel-all-after --timeOut 30
okx trade cancel-all-after --timeOut 0 # cancel the timerGet Account Rate Limit
okx trade account-rate-limitOrder Pre-check
okx trade order-precheck --instId BTC-USDT --tdMode cash --side buy --ordType limit --sz 0.01 --px 60000Place 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 60Cancel Algo Orders
okx trade cancel-algos --data '[{"algoId":"123","instId":"BTC-USDT-SWAP"}]'Get Algo Order Details
okx trade get-algo-order --algoId 123456Get Pending Algo Orders
okx trade algo-orders-pending --ordType trigger
okx trade algo-orders-pending --ordType conditional --instType SWAPGet Algo Order History
okx trade algo-orders-history --ordType trigger --state effectiveEasy Convert
okx trade easy-convert-list
okx trade easy-convert --fromCcy USDC,DAI --toCcy USDT
okx trade easy-convert-historyOne-Click Repay
okx trade one-click-repay-list
okx trade one-click-repay --debtCcy USDT --repayCcy BTC
okx trade one-click-repay-historyKey Parameters
| Parameter | Description |
--instId | Instrument ID, e.g. BTC-USDT, BTC-USDT-SWAP |
--tdMode | Trade mode: cash (spot), cross (cross margin), isolated |
--side | buy or sell |
--ordType | market, limit, post_only, fok, ioc |
--sz | Order size (contracts for derivatives, base currency for spot) |
--px | Price (required for limit orders) |
--tgtCcy | base_ccy or quote_ccy (spot market orders) |
--posSide | long, short, net (for long/short mode) |
Response Format
{
"code": "0",
"msg": "",
"data": [{ "ordId": "...", "clOrdId": "...", "sCode": "0", "sMsg": "" }]
}Check sCode per order in batch operations.
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
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.

