Okx Market okx-market
OKX cryptocurrency market data interface. Uses the OKX V5 REST API to retrieve spot, derivatives, index, and other crypto market data, including real-time prices, candlesticks, funding rates, open interest, and more. No authentication required, free to use.
- Our test
- —
- not tested yet
- GitHub stars
- 40k
- hkuds/vibe-trading
- Added by
- 0
- members
- Updated
- Dec 6
- commit bd7b97d
- Content
- 16 files
- 2 scripts · 30 KB
- License
- MIT
- free to use
What our test found
Not tested yet. Our model tries every skill on a realistic request and scores the result, the most popular skills first. Until then, the safety checks on the right still apply.
name: okx-market description: OKX cryptocurrency market data interface. Uses the OKX V5 REST API to retrieve spot, derivatives, index, and other crypto market data, including real-time prices, candlesticks, funding rates, open interest, and more. No authentication required, free to use. category: data-source
OKX Market
Overview
The OKX V5 REST API provides comprehensive cryptocurrency market data covering spot, perpetual swaps, delivery futures, options, and more. All market-data endpoints are public and can be called directly without authentication. The data comes from OKX, the world's second-largest cryptocurrency exchange.
Quick Start
- Install a Python runtime (Python 3.9+ recommended) and the required
requestsdependency.
pip install requests pandas- No account registration or token configuration is required. Market-data endpoints are fully open.
- Review the endpoint documentation below and locate the interface you need.
- Use Python code to retrieve data according to the documentation. Example for the spot ticker endpoint:
from src.data_gateway.reads import public_http_get
import pandas as pd
BASE_URL = "https://www.okx.com/api/v5"
# Get the latest BTC-USDT market quote
resp = public_http_get(f"{BASE_URL}/market/ticker", params={"instId": "BTC-USDT"})
data = resp.json()["data"][0]
print(f"BTC last price: {data['last']} 24h change: {float(data['last'])/float(data['open24h'])*100-100:.2f}%")Parameter Format Reference
- Instrument format (`instId`):
- Spot:
BTC-USDT,ETH-USDT - Perpetual swap:
BTC-USDT-SWAP,ETH-USDT-SWAP - Delivery futures:
BTC-USDT-250328(expiry date inYYMMDD) - Options:
BTC-USD-250328-95000-C(expiry-strike-C/P) - Index:
BTC-USD,ETH-USD - Candlestick interval (`bar`):
1m,3m,5m,15m,30m,1H,2H,4H,6H,12H,1D,1W,1M - Instrument type (`instType`):
SPOT(spot),SWAP(perpetual),FUTURES(delivery),OPTION(option) - Timestamp: millisecond Unix timestamp (for example
1773763200000) - Response format: JSON.
code=0indicates success, and data is returned in thedatafield
Link convention: every link toreferences/in this document is written relative to this document (for examplereferences/...) — the form GitHub resolves when someone opens the file in a browser. Theread_filetool resolves the same string against the skill that owns it, so the agent and a human reader reach one file. When adding new skill docs, always use the relative form, and keep reference paths unique across skills: a path two skills both carry is reported as ambiguous rather than guessed.
Python Script Examples
Market Data Endpoint List
| ID | Endpoint Path | Title (Detailed Documentation) | Category | Description | | ---: | :--- | :--- | :--- | :--- | | 1 | /market/ticker | | Spot Market | Retrieve the latest market data for a single trading instrument, including last price, bid/ask, 24h volume, and more | | 2 | /market/tickers | | Spot Market | Retrieve all market data for a given instrument class (SPOT/SWAP/FUTURES/OPTION) in batch | | 3 | /market/candles | | Spot Market | Retrieve candlestick (OHLCV) data with multiple supported intervals | | 4 | /market/trades | | Spot Market | Retrieve recent trade-level details | | 5 | /public/instruments | | Spot Market | Retrieve metadata for all tradable instruments, including minimum order size and price precision | | 6 | /market/books | | Spot Market | Retrieve bid/ask order book depth data | | 7 | /public/funding-rate | | Derivatives Market | Retrieve current and historical funding rates for perpetual contracts | | 8 | /public/funding-rate-history | | Derivatives Market | Retrieve historical funding-rate data for perpetual contracts | | 9 | /public/mark-price | | Derivatives Market | Retrieve mark prices for derivatives, used for PnL and liquidation calculations | | 10 | /public/open-interest | | Derivatives Market | Retrieve open-interest data for derivatives | | 11 | /public/price-limit | | Derivatives Market | Retrieve the current maximum and minimum price limits for derivatives | | 12 | /market/index-tickers | | Index Market | Retrieve index price market data | | 13 | /market/index-candles | | Index Market | Retrieve index candlestick data |