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
- Market data / indicators →
okx-cex-market(this skill) - Account balance / positions →
okx-cex-portfolio - Place / cancel orders →
okx-cex-trade - Trading a directional view as an event contract →
okx-cex-trade - Market sentiment / most bullish-bearish coins →
okx-sentiment-tracker - Grid / DCA bots →
okx-cex-bot
Preflight
Before running any command, follow ../_shared/preflight.md.
Use metadata.version from this file's frontmatter as the reference for Step 2.
Install
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
Operation Flow
Step 1 — Identify data type and load reference
Event contracts are not served by this skill.
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
- instId format: SPOT
BTC-USDT· SWAPBTC-USDT-SWAP· FUTURESBTC-USDT-250328· OPTIONBTC-USD-250328-95000-C· IndexBTC-USD· Stock tokenTSLA-USDT-SWAP· Metals/Commodities/Forex/Bonds: useinstruments-by-categoryto discover valid instIds first - OPTION listing:
instruments --instType OPTIONrequires--uly BTC-USDor--instFamily BTC-USD; if unknown, runopen-interest --instType OPTIONfirst to discover active instIds - EVENTS listing:
instruments --instType EVENTSrequires--seriesId(e.g.--seriesId BTC-ABOVE-DAILY); runokx event seriesfirst to discover valid series IDs - funding-rate / price-limit: SWAP only · mark-price: SWAP / FUTURES / OPTION only
- candles
--bar: uppercase —1Hnot1h; use--after <ts>to paginate back into historical data (back to 2021); index-candles supports--historyfor extended history - ⚠️ Large historical range: before fetching with
--after/--before, estimate candle count =time_range_ms / bar_interval_ms. If estimate > 500, tell the user the estimated count and ask for confirmation before proceeding. This prevents silently filling the context window. - indicator
--bar: uses1Dutcnot1D,1Wutcnot1W— different from candle bar values market filtersortBy values:lastchg24hPctmarketCapUsdvolUsd24hfundingRateoiUsdlistTime— defaultvolUsd24hmarket filterctType:linearorinverse(SWAP/FUTURES only); omit for SPOTmarket filterquoteCcy: comma-separated list supported, e.g.--quoteCcy USDT,USDCmarket filterSPOT + quoteCcy: when--instType SPOT, the API returns instruments across all quote currencies (USDT, USDC, BTC, ETH, etc.) mixed together — this pollutes sort order and bloats results. Always pass--quoteCcy USDTby default unless the user explicitly asks for other quote currencies.market filterchg24hPct: value is a percentage number —--minChg24hPct -5means -5%,--maxChg24hPct 10means 10%market oi-historyts: Unix ms timestamp; returns bars with ts ≤ this value for historical paginationmarket oi-history/oi-changebar: valid values5m15m1H4H1D— default1H. Server accepts case variants (1h==1H) but prefer canonical casing.market oi-historylimit: 1–500 (default 50)market oi-changeinstType: onlySWAPorFUTURESsupported (not SPOT)market oi-changeminAbsOiDeltaPct: filters by absolute OI change —1.0keeps only rows where |oiDeltaPct| ≥ 1%market oi-changesortBy values:oiUsdoiDeltaUsdoiDeltaPctabsOiDeltaPctvolUsd24hfundingRatelast— defaultoiDeltaPct(signed). UseabsOiDeltaPctto rank by |oiDeltaPct| (largest magnitude regardless of direction).market oi-changelimit: 1–100 (default 20). For deeper than 100 rows, fetchoi-historyper instId.- indicator
--barvalid values:3m5m15m1H4H12Hutc1Dutc3Dutc1Wutc—1mis not supported for indicators (usecandlesfor 1-minute data) - indicator
--limit: 1–100 (only used withreturnList, i.e. when a historical series is requested) - indicator arg order: indicator name before instId —
okx market indicator rsi BTC-USDT - indicator
--params: comma-separated, no spaces —--params 5,20. For period-based indicators (ema/ma/wma/rsi/macd/bb/…) omitting--paramsmakes the CLI substitute a default period (EMA/MA/WMA/RSI →14, MACD →12,26,9, BB →20,2) so the table is populated instead of empty; pass--paramsexplicitly to override the default. (CLI-only convenience — the MCPmarket_get_indicatorraw-data path still requires an explicitparamList.) - indicator no values returned: the CLI never prints nothing — if a query yields no values (e.g. a non-period indicator, or a period indicator with no default), it prints a visible hint:
No indicator values returned. This indicator may require a period — try --params (e.g. --params 14). - BTC-only indicators:
ahr999,rainbow— BTC-USDT only - Unknown indicator name: returns a
ValidationErrorwith similar-name suggestions before the API is called — usemarket_list_indicators/okx market indicator listto see all valid names - Stock token hours: US stocks trade Mon–Fri ~09:30–16:00 ET; verify live price before acting
- No data returned: instrument may be delisted — verify with
okx market instruments bollis an alias forbb
Global Notes
- No API key required for any command in this skill
- Rate limit: 20 req / 2 s per IP
- Candle data is sorted newest-first
vol24his in base currency (e.g., BTC for BTC-USDT)--demo/--liveand--profiledo not affect market data results via CLI (public endpoints); they only determine the active trading environment context

