
Okx Cex Market
Query OKX perpetual-swap derivatives market data—funding rates, mark prices, and contract fields—from the terminal or an agent without hand-rolling REST calls.
Overview
OKX CEX Market is an agent skill for the Build phase that exposes OKX derivatives market CLI commands for funding rates and mark prices on perpetual swaps and other contract types.
Install
npx skills add https://github.com/okx/agent-skills --skill okx-cex-marketWhat is this skill?
- Funding-rate command for current and historical perpetual-SWAP funding (`--history`, `--limit`, JSON output).
- Mark-price lookup by instrument type (SWAP, FUTURES, OPTION) with optional single-instrument filter.
- Strict `-SWAP` instrument IDs—spot pairs like BTC-USDT are rejected to avoid wrong-endpoint mistakes.
- Structured CLI params with `--json` for piping into dashboards, alerts, or backtests.
- Covers derivatives and contract data commands shared across SWAP, FUTURES, and OPTION (not spot unless noted).
- Historical funding default limit 100 records unless `--limit` is set
Adoption & trust: 7.1k installs on skills.sh; 134 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need reliable perpetual funding and mark-price data from OKX but do not want to debug REST paths and instrument-ID rules every time your agent runs.
Who is it for?
Solo builders automating crypto derivatives research, agent-driven market monitors, or CLI-first workflows against OKX public market endpoints.
Skip if: Spot-only price checks without swap instruments, full order placement, or teams that need audited trading compliance without reviewing credentials and exchange ToS themselves.
When should I use this skill?
You need OKX SWAP/FUTURES/OPTION funding rates or mark prices via documented `okx market` commands.
What do I get? / Deliverables
Your agent invokes documented OKX market subcommands with valid `-SWAP` IDs and structured fields (`fundingRate`, `markPx`, timestamps) ready for downstream logic or alerts.
- Correctly parameterized CLI invocations
- JSON or tabular funding/mark-price fields for downstream scripts
Recommended Skills
Journey fit
Sits in Build because it wires an external CEX API into your agent or automation stack as a repeatable CLI integration. Integrations subphase is the right shelf for third-party exchange market endpoints consumed by coding agents or scripts.
How it compares
Use instead of ad-hoc HTTP snippets when you already standardize on the OKX CLI for market reads—not a hosted MCP server or portfolio custodian.
Common Questions / FAQ
Who is okx-cex-market for?
Indie developers and agent users who pull OKX perpetual and contract market metrics (funding, mark price) from the command line or through coding agents.
When should I use okx-cex-market?
During Build when integrating OKX derivatives data into bots or dashboards; during Operate when monitoring funding drift; during Validate when sanity-checking carry assumptions before committing to a strategy script.
Is okx-cex-market safe to install?
Treat it as documentation for CLI market reads; review the Security Audits panel on this Prism page and never embed live API secrets in prompts—scope keys to read-only market use where possible.
SKILL.md
READMESKILL.md - Okx Cex Market
# Derivatives & Contract Data Commands These commands apply to SWAP, FUTURES, and/or OPTION instruments. Not applicable to SPOT unless noted. --- ## funding-rate — Funding Rate ```bash okx market funding-rate <instId> [--history] [--limit <n>] [--json] ``` | Param | Required | Default | Description | |---|---|---|---| | `instId` | Yes | - | Perpetual swap instrument ID, **must end with `-SWAP`** (e.g., `BTC-USDT-SWAP`). Spot IDs like `BTC-USDT` will be rejected. | | `--history` | No | false | Return historical funding rates | | `--limit` | No | 100 | Number of historical records (only with `--history`) | **Current rate** (no `--history`): Returns: `fundingRate` · `nextFundingRate` · `fundingTime` · `nextFundingTime` **Historical** (`--history`): Returns table: `fundingRate` · `realizedRate` · `fundingTime` ```bash okx market funding-rate BTC-USDT-SWAP okx market funding-rate BTC-USDT-SWAP --history --limit 10 ``` > **IMPORTANT**: `instId` must end with `-SWAP` (e.g., `BTC-USDT-SWAP`). Spot IDs like `BTC-USDT` are **NOT** valid and will be rejected. Funding rate applies only to perpetual swap instruments. --- ## mark-price — Mark Price ```bash okx market mark-price --instType <type> [--instId <id>] [--json] ``` | Param | Required | Values | |---|---|---| | `--instType` | Yes | `SWAP` `FUTURES` `OPTION` | | `--instId` | No | Filter to a single instrument | Returns: `instId` · `instType` · `markPx` · `ts` Used for liquidation price calculation and contract fair-value reference. ```bash okx market mark-price --instType SWAP --instId BTC-USDT-SWAP okx market mark-price --instType FUTURES ``` --- ## price-limit — Upper / Lower Price Limits ```bash okx market price-limit <instId> [--json] ``` Returns: `buyLmt` (max buy price) · `sellLmt` (min sell price) Applies to SWAP and FUTURES only. Used to check whether a limit order price is within allowed range. ```bash okx market price-limit BTC-USDT-SWAP ``` --- ## open-interest — Open Interest ```bash okx market open-interest --instType <type> [--instId <id>] [--json] ``` | Param | Required | Values | |---|---|---| | `--instType` | Yes | `SWAP` `FUTURES` `OPTION` | | `--instId` | No | Filter to a single instrument | Returns: `instId` · `oi` (contracts) · `oiCcy` (base currency amount) · `ts` ```bash okx market open-interest --instType SWAP --instId BTC-USDT-SWAP okx market open-interest --instType SWAP ``` > For OPTION: use `--instId BTC-USD` (underlying, not a specific strike/expiry) to list all active option series OI. --- ## index-ticker — Index Price ```bash okx market index-ticker [--instId <id>] [--quoteCcy <ccy>] [--json] ``` | Param | Required | Default | Description | |---|---|---|---| | `--instId` | Cond. | - | Index ID (e.g., `BTC-USD`). Either this or `--quoteCcy` required. | | `--quoteCcy` | Cond. | - | Filter all indices by quote currency (e.g., `USD`, `USDT`) | Returns: `instId` · `idxPx` · `high24h` · `low24h` > Use `BTC-USD` format for index IDs (not `BTC-USDT`). ```bash okx market index-ticker --instId BTC-USD okx market index-ticker --quoteCcy USD ``` > **Demo market data**: All commands above support `--demo` (CLI) or `demo: true` (MCP) to query OKX's simulated trading market data. Default is live data. # Technical Indicator Command Reference ## Discover Supported Indicators ```bash okx market indicator list # print all supported indicator names and descriptions okx market indicator list --json # machine-readable format ``` Use this before calling `market_get_indicator` (MCP) or `okx market indicator` (CLI) to confirm a name is supported. The API returns empty data silently for unknown indicator names. --- ## Command Syntax ```bash okx market indicator <indicator> <instId> [--bar <bar>] [--params <n1,n2,...>] [--list] [--limit <n>] [--backtest-time <ms>] [--json] ``` > Argument order: `<indicator>` comes **before** `<instId>` — e.g., `okx market indicator rsi BTC-USDT`, not the reverse. | Param | Required | Defau