OKX Swap
OKX Swap historical market data details - instruments, data coverage and data collection specifics
OKX historical data for all its perpetual swap instruments is available since 2019-03-30.
Downloadable CSV files
Historical CSV datasets for the first day of each month are available to download without API key. See downloadable CSV files documentation.
Liquidations datasets are available since 2020-12-18.
API Access and data format
Historical data format is the same as provided by real-time OKX WebSocket v5 API with addition of local timestamps (before 2021-12-23 it was v3 API version). If you'd like to work with normalized data format instead (same format for each exchange) see downloadable CSV files or official client libs that can perform data normalization client-side.
See Python client docs.
See Node.js client docs.
See HTTP API docs.
Tardis-machine is a locally runnable server that exposes API allowing efficiently requesting historical market data for whole time periods in contrast to HTTP API that provides data only in minute by minute slices.
See tardis-machine docs.
Captured real-time channels
Click any channel below to see HTTP API response with historical data recorded for it.
Current channels (API v5, since 2021-12-23):
trades Public swap trade executions stream
trades-all — available since 2023-10-19 All trades stream including non-aggregated trade messages
books-l2-tbt Tick-by-tick L2 swap order book updates (10ms)
books — available since 2023-02-24, until 2024-07-19 Incremental swap order book depth updates (100ms)
bbo-tbt — available since 2022-05-05 Tick-by-tick best bid and offer updates (10ms)
tickers 24h swap ticker updates (100ms)
liquidations Liquidation events with at most one update per second per contract
liquidation-orders — available since 2023-03-30 Liquidation orders with at most one update per second per contract
open-interest Open interest updates (3s)
mark-price Mark price updates with keepalive up to 10s when unchanged (200ms)
funding-rate Funding rate updates with upcoming funding time (30s to 90s cadence)
index-tickers Index ticker updates with keepalive up to 1m when unchanged (100ms)
price-limit Price limit updates (200ms)
status Exchange status and maintenance notifications
instruments Instrument state updates (listing, suspension, parameter changes)
long-short-account-ratio Long/short account ratio snapshots from REST statistics endpoint (1m)
taker-volume Taker buy/sell volume snapshots from REST statistics endpoint (1m)
public-block-trades — available since 2023-01-01 Public block trades stream (15m)
public-struc-block-trades — available since 2023-01-01 Public structured block trades stream (15m)
taker-volume-contract — available since 2024-08-08 Contract-level taker buy/sell volume snapshots from REST statistics endpoint (1m)
long-short-account-ratio-contract-top-trader — available since 2024-08-08 Contract-level top-trader long/short account ratio snapshots (1m)
long-short-position-ratio-contract-top-trader — available since 2024-08-08 Contract-level top-trader long/short position ratio snapshots (1m)
long-short-account-ratio-contract — available since 2024-08-08 Contract-level long/short account ratio snapshots from REST statistics endpoint (1m)
Legacy channels (API v3, until 2021-12-23):
swap/trade — until 2021-12-23 Public swap trade executions stream
swap/depth — until 2020-02-13 Incremental swap order book updates (legacy depth channel, 100ms)
swap/depth_l2_tbt — available since 2020-02-07, until 2021-12-23 Tick-by-tick L2 swap order book updates with sequencing
swap/ticker — until 2021-12-23 24h swap ticker updates
swap/liquidation — available since 2020-12-18, until 2021-12-23 Swap liquidation events
swap/funding_rate — until 2021-12-23 Funding rate updates
swap/mark_price — until 2021-12-23 Mark price with keepalive up to 10s when unchanged
index/ticker — available since 2019-09-20, until 2021-12-23 Index ticker for swap contracts with keepalive up to 1m when unchanged
system/status — available since 2020-07-01, until 2021-12-23 Exchange status and maintenance notifications
information/sentiment — available since 2020-10-28, until 2021-12-23 Market sentiment ratio metrics (75s, REST polling)
information/long_short_ratio — available since 2020-10-28, until 2021-12-23 Long/short account ratio metrics (75s, REST polling)
information/margin — available since 2020-10-28, until 2021-12-23 Margin ratio metrics (75s, REST polling)
Market data collection details
Market data collection infrastructure for OKX Swap since 2022-05-04T16:45 is located in AWS HK region (Hong Kong, China, VPC colo setup), before that, starting since 2020-05-15 it was located in GCP asia-northeast1 (Tokyo, Japan) and initially it was located in GCP europe-west2 region (London, UK).
Real-time market data is captured via multiple WebSocket connections to wss://awscolows1.okx.com:8443/ws/v5/public.
OKX servers are located in Alibaba Cloud cn-hongkong region (Hong Kong, China).
Last updated
