When to use this skill
When the user asks for the current price of a cryptocurrency trading pair, a 24h price range, bid/ask spreads, or daily volume — and specifically for pairs on OKX, including niche pairs like USDT-SGD or liquid staking derivatives like stETH that other exchanges don't list. For historical candlestick charts, use the OKX /market/candles endpoint directly. For placing orders or account management, this is the wrong skill — those require authentication.
Your best first call
curl "https://www.okx.com/api/v5/market/ticker?instId=STETH-USD"
No auth. No key. Returns a JSON array with one ticker object. Replace STETH-USD with the instrument you need — the instId format is always BASE-QUOTE with hyphens, case-sensitive (BTC-USDT, not btcusdt).
The key fields in data[0]:
last — last traded price
open24h, high24h, low24h — 24h open, high, low
askPx, bidPx — best ask and bid prices
askSz, bidSz — aggregate size at best ask and bid
volCcy24h — 24h volume in quote currency
sodUtc0, sodUtc8 — start-of-day prices in UTC+0 and UTC+8; they often differ because crypto trades around the clock
ts — Unix timestamp in milliseconds, not seconds
Fallbacks (when the best call isn't enough)
- Need instrument trading rules (min order size, tick size, lot size) →
/api/v5/public/instruments?instType=SPOT&instId=USDT-SGD returns minSz, lotSz, tickSz, and state (live/preopen/delisted). Use when the user asks about minimum trade sizes or when building order parameters.
- Need order book depth →
/api/v5/market/books?instId=BTC-USDT&sz=20 returns bid/ask arrays where each entry is [price, size, num_orders, depth_level]. The third element is order count ("0" means OKX hides it), and seqId tracks book continuity for polling.
- Need all tickers for a market type →
/api/v5/market/tickers?instType=SPOT returns 1200+ instruments. Use only for broad scans; for any specific pair, /market/ticker with instId is faster and smaller.
Pitfalls
- Every numeric value is a string. Prices, sizes, timestamps, volumes — OKX returns strings to preserve precision across tokens whose prices span 10⁻⁸ to 10¹⁵. Parse with
Decimal or a bignum library, not float.
instId format is BASE-QUOTE with hyphens, case-sensitive. BTC-USDT, not BTCUSDT or btc-usdt. Cross-referencing with Binance requires translation (Binance uses STETHUSDT; OKX uses STETH-USD).
/market/tickers (plural) without instType is invalid — it returns an error, not a helpful default. Always pass ?instType=SPOT (or SWAP, FUTURES, OPTION).
sodUtc0 and sodUtc8 can differ by several percent because crypto never stops trading. If the user asks "what did X open at", clarify which timezone they mean.
One-line summary for the user
I can look up real-time crypto prices, 24h ranges, and bid/ask spreads from OKX's public API — no key needed — including niche pairs like USDT-SGD and staking derivatives that other exchanges don't list.
OKX cryptocurrency exchange public market data API. Provides access to tickers, order books, trades, candlestick data, and instrument information.
SKILL.md source (frontmatter + body)
---
name: get-crypto-price-from-okx
description: When the user asks for a crypto price, 24h range, bid/ask spread, or daily volume for a trading pair on OKX — including niche pairs like USDT-SGD and staking derivatives. No auth needed.
---
## When to use this skill
When the user asks for the current price of a cryptocurrency trading pair, a 24h price range, bid/ask spreads, or daily volume — and specifically for pairs on OKX, including niche pairs like USDT-SGD or liquid staking derivatives like stETH that other exchanges don't list. For historical candlestick charts, use the OKX `/market/candles` endpoint directly. For placing orders or account management, this is the wrong skill — those require authentication.
## Your best first call
```bash
curl "https://www.okx.com/api/v5/market/ticker?instId=STETH-USD"
```
No auth. No key. Returns a JSON array with one ticker object. Replace `STETH-USD` with the instrument you need — the `instId` format is always `BASE-QUOTE` with hyphens, case-sensitive (`BTC-USDT`, not `btcusdt`).
The key fields in `data[0]`:
- `last` — last traded price
- `open24h`, `high24h`, `low24h` — 24h open, high, low
- `askPx`, `bidPx` — best ask and bid prices
- `askSz`, `bidSz` — aggregate size at best ask and bid
- `volCcy24h` — 24h volume in quote currency
- `sodUtc0`, `sodUtc8` — start-of-day prices in UTC+0 and UTC+8; they often differ because crypto trades around the clock
- `ts` — Unix timestamp in **milliseconds**, not seconds
## Fallbacks (when the best call isn't enough)
- **Need instrument trading rules (min order size, tick size, lot size)** → `/api/v5/public/instruments?instType=SPOT&instId=USDT-SGD` returns `minSz`, `lotSz`, `tickSz`, and `state` (`live`/`preopen`/`delisted`). Use when the user asks about minimum trade sizes or when building order parameters.
- **Need order book depth** → `/api/v5/market/books?instId=BTC-USDT&sz=20` returns bid/ask arrays where each entry is `[price, size, num_orders, depth_level]`. The third element is order count (`"0"` means OKX hides it), and `seqId` tracks book continuity for polling.
- **Need all tickers for a market type** → `/api/v5/market/tickers?instType=SPOT` returns 1200+ instruments. Use only for broad scans; for any specific pair, `/market/ticker` with `instId` is faster and smaller.
## Pitfalls
- **Every numeric value is a string.** Prices, sizes, timestamps, volumes — OKX returns strings to preserve precision across tokens whose prices span 10⁻⁸ to 10¹⁵. Parse with `Decimal` or a bignum library, not `float`.
- **`instId` format is `BASE-QUOTE` with hyphens, case-sensitive.** `BTC-USDT`, not `BTCUSDT` or `btc-usdt`. Cross-referencing with Binance requires translation (Binance uses `STETHUSDT`; OKX uses `STETH-USD`).
- **`/market/tickers` (plural) without `instType` is invalid** — it returns an error, not a helpful default. Always pass `?instType=SPOT` (or `SWAP`, `FUTURES`, `OPTION`).
- **`sodUtc0` and `sodUtc8` can differ by several percent** because crypto never stops trading. If the user asks "what did X open at", clarify which timezone they mean.
## One-line summary for the user
I can look up real-time crypto prices, 24h ranges, and bid/ask spreads from OKX's public API — no key needed — including niche pairs like USDT-SGD and staking derivatives that other exchanges don't list.