Okx official cex market

From jiayaoqijia/cryptoskill · View interactive version

Okx official cex market is an AI agent skill from the GitHub repository jiayaoqijia/cryptoskill. Use this skill when the user asks for: price of any asset, ticker, order book, candles, OHLCV, funding rate, open interest, OI change scanner, market screener (top movers, high-volume, newly listed), mark price, index price, recent trades, instrument list, stock tokens, metals prices (gold, XAU, XAG

How to use this skill

Skill file

OKX CEX Market Data CLI

Compliance notice: This skill provides raw market data only. No strategy, recommendation, or optimization logic is embedded. All indicator outputs are objective numerical values; interpretation and trading decisions remain solely with the user.

Public market data for OKX: prices, order books, candles, funding rates, open interest, instrument info, and technical indicators. All commands are read-only and require no API credentials.

Skill routing

Preflight

Before running any command, follow CODE0.

Use metadata.version from this file's frontmatter as the reference for Step 2.

Install

npm install -g @okx_ai/okx-trade-cli
okx market ticker BTC-USDT   # verify

Market data commands return the same public data regardless of demo/live mode — no API credentials required. If the user's profile has demo=true set and they want live data context, they can use --live to confirm they are in live mode (it has no effect on public market data but clarifies environment). Always inform the user which environment is active (demo or live) when it is relevant to their query. No confirmation needed before running any market command. Add --json to any command for raw OKX API v5 response. Add --env to wrap the output as {"env", "profile", "data"}.


Command Index

| # | Command | Description |

|---|---|---|

| 1 | okx market ticker <instId> | Last price, 24h high/low/vol/change% |

| 2 | okx market tickers <instType> | All tickers for SPOT / SWAP / FUTURES / OPTION |

| 3 | okx market instruments --instType <type> [--instId <id>] [--uly <uly>] [--instFamily <fam>] [--seriesId <id>] | List instruments (instId, ctVal, lotSz, minSz, tickSz, state); OPTION requires --uly or --instFamily; EVENTS requires --seriesId |

| 4 | okx market orderbook <instId> [--sz <n>] | Order book asks/bids (default top 5 per side, max 400) |

| 5 | okx market candles <instId> [--bar <bar>] [--limit <n>] [--after <ts>] [--before <ts>] | OHLCV candles (default --bar 1m; UTC+0 bars 6Hutc…3Mutc available from 6H up); auto-routes to historical endpoint for data back to 2021; --after paginates back in time, --before paginates forward |

| 6 | okx market index-candles <instId> [--bar <bar>] [--limit <n>] [--history] | Index OHLCV (use BTC-USD not BTC-USDT) |

| 7 | okx market funding-rate <instId> [--history] [--limit <n>] | Current or historical funding rate (SWAP only) |

| 8 | okx market trades <instId> [--limit <n>] [--history [--type <1\|2>] [--after <id\|ts>] [--before <id>]] | Recent public trades (default 20, max 500). --history pages through the last 3 months (max 100 per page); --type/--after/--before require --history and are rejected otherwise |

| 9 | okx market mark-price --instType <type> [--instId <id>] | Mark price (SWAP / FUTURES / OPTION) |

| 10 | okx market index-ticker [--instId <id>] [--quoteCcy <ccy>] | Index price (e.g., BTC-USD) |

| 11 | okx market price-limit <instId> | Upper/lower price limits (SWAP / FUTURES only) |

| 12 | okx market open-interest --instType <type> [--instId <id>] | Open interest in contracts and base currency |

| 13 | okx market instruments-by-category --instCategory <3\|4\|5\|6\|7> | Discover instruments by asset category: 3=Stock tokens (AAPL/TSLA), 4=Metals (gold/silver), 5=Commodities (oil/gas), 6=Forex (EUR/USD), 7=Bonds |

| 13† | okx market stock-tokens | Deprecated — use instruments-by-category --instCategory 3 instead |

| 14 | okx market filter --instType <SPOT\|SWAP\|FUTURES> [--sortBy <field>] [--sortOrder <asc\|desc>] [--limit <n>] [--baseCcy <ccy>] [--quoteCcy <ccy>] [--settleCcy <ccy>] [--instFamily <fam>] [--ctType <linear\|inverse>] [--minLast <n>] [--maxLast <n>] [--minChg24hPct <n>] [--maxChg24hPct <n>] [--minMarketCapUsd <n>] [--maxMarketCapUsd <n>] [--minVolUsd24h <n>] [--maxVolUsd24h <n>] [--minFundingRate <n>] [--maxFundingRate <n>] [--minOiUsd <n>] [--maxOiUsd <n>] | Screen / rank instruments by multi-dimensional criteria (price, volume, OI, funding rate, market cap). Prints Total: N + a ranked table of matching instruments (No results only when nothing matches). Add --json for the raw OKX API v5 response (structurally unchanged). |

| 15 | okx market oi-history <instId> [--bar <5m\|15m\|1H\|4H\|1D>] [--limit <n>] [--ts <ms>] | OI history time series with bar-over-bar delta for a single instrument |

| 16 | okx market oi-change --instType <SWAP\|FUTURES> [--bar <5m\|15m\|1H\|4H\|1D>] [--sortBy <field>] [--sortOrder <asc\|desc>] [--limit <n>] [--minOiUsd <n>] [--minVolUsd24h <n>] [--minAbsOiDeltaPct <n>] | Find instruments with largest OI changes (accumulation/distribution scanner) |

| 17 | okx market indicator list | List all supported indicator names and descriptions |

| 18 | okx market indicator <indicator> <instId> [--bar] [--params] [--list] [--limit] [--backtest-time] | Technical indicator values. Omit --params to use the indicator's default (e.g. MACD 12,26,9, BB 20,2, RSI 14, MA 5,20,60, EMA 5,20, Supertrend 3,10); the CLI prints params: … (default). If you pass --params it must be complete — too few or too many values is an error (e.g. --params 12,26 for macd). Full list of params and defaults: references/indicator-commands.md. Unknown indicator names are rejected. |

| 19 | okx market pair-spread <instIdA> <instIdB> [--bar <5m\|15m>] [--window <window>] [--backtest-time <ms>] | Spread statistics (abs + ratio: mean/stdDev/median/min/max) over a lookback window; supports backtest mode |


Operation Flow

Step 1 — Identify data type and load reference

| User intent | Reference to load |

|---|---|

| Price, candles, order book, recent trades | {baseDir}/references/price-data-commands.md |

| Technical indicators (RSI, MACD, EMA, BB, KDJ, SuperTrend, AHR999, Rainbow, etc.) | {baseDir}/references/indicator-commands.md |

| Funding rate, mark price, open interest, price limit, index ticker | {baseDir}/references/derivatives-commands.md |

| Screen / rank instruments; find top movers, high-OI, high-volume contracts | Use okx market filter directly |

| OI history time series for a single instrument | Use okx market oi-history directly |

| OI change scanner; find contracts with large OI shifts | Use okx market oi-change directly |

| Pair spread statistics; mean-reversion / pairs-trade sizing | Use okx market pair-spread directly |

| List instruments, discover stock tokens, metals/commodities/forex/bonds, find option instIds | {baseDir}/references/instrument-commands.md |

| Multi-step or cross-skill workflows; MCP tool names | {baseDir}/references/workflows.md |

Event contracts are not served by this skill.

| User asks | Do |

|---|---|

| Which way an asset is moving — "is BTC going up", "what's the 15m trend" | Answer here with candles / indicators |

| Direction and whether they can trade it | Answer the data half here, then name okx-cex-trade for the trade half |

| To trade an event contract — "buy YES/NO on …" | Route to okx-cex-trade, serve nothing here |

Never substitute another product for an event contract — not a perp, not a futures position,

not market data presented as the contract they asked for. If you cannot load

okx-cex-trade, say so and stop.

Step 2 — Run commands immediately

All market data commands are read-only — no confirmation needed.

Step 3 — No writes, no verification needed

All commands in this skill are read-only.


Edge Cases

Global Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.