# OKX Options

OKX historical data for **all its options instruments** is available since **2020-02-01**.

{% embed url="<https://api.tardis.dev/v1/exchanges/okex-options>" %}
See OKX Options historical data coverage: available symbols, channels, date ranges and incidents
{% endembed %}

### 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](/downloadable-csv-files/overview.md).

| data type             | symbol                | date       |                                                                                                                            |
| --------------------- | --------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------- |
| incremental\_book\_L2 | BTC-USD-200327-8500-P | 2020-03-01 | [Download sample](https://datasets.tardis.dev/v1/okex-options/incremental_book_L2/2020/03/01/BTC-USD-200327-8500-P.csv.gz) |
| trades                | BTC-USD-200327-8500-P | 2020-03-01 | [Download sample](https://datasets.tardis.dev/v1/okex-options/trades/2020/03/01/BTC-USD-200327-8500-P.csv.gz)              |
| options\_chain        | OPTIONS               | 2020-03-01 | [Download sample](https://datasets.tardis.dev/v1/okex-options/options_chain/2020/03/01/OPTIONS.csv.gz)                     |

### 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](/downloadable-csv-files/overview.md) or official [client libs](/api/quickstart.md) that can perform data normalization client-side.

{% tabs %}
{% tab title="Python" %}

```python
# pip install tardis-dev
import asyncio
from tardis_dev import Channel, replay

async def main():
    async for local_timestamp, message in replay(
        exchange="okex-options",
        from_date="2024-01-01",
        to_date="2024-01-02",
        filters=[Channel(name="books-l2-tbt", symbols=[])],
        api_key="YOUR_API_KEY",
    ):
        # messages as provided by OKX real-time stream
        print(message)

asyncio.run(main())
```

See [Python client docs](/python-client/quickstart.md).
{% endtab %}

{% tab title="Node.js" %}

```javascript
// npm install tardis-dev
import { replay } from 'tardis-dev';

const messages = replay({
  exchange: 'okex-options',
  from: '2024-01-01',
  to: '2024-01-02',
  filters: [{ channel: 'books-l2-tbt', symbols: [] }],
  apiKey: 'YOUR_API_KEY'
});

// messages as provided by OKX real-time stream
for await (const { localTimestamp, message } of messages) {
  console.log(localTimestamp, message);
}
```

See [Node.js client docs](/node-client/quickstart.md).
{% endtab %}

{% tab title="cURL & HTTP API" %}

```bash
curl --compressed -g 'https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01&filters=[{"channel":"books-l2-tbt","symbols":[]}]&offset=0'
```

{% embed url="<https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01&filters=[{%22channel%22:%22books-l2-tbt%22,%22symbols%22:[]}]&offset=0>" %}
Example API response for OKX Options historical market data request
{% endembed %}

See [HTTP API docs](/api/http-api-reference.md).
{% endtab %}

{% tab title="cURL & tardis-machine" %}

```bash
curl -g 'localhost:8000/replay?options={"exchange":"okex-options","filters":[{"channel":"books-l2-tbt","symbols":[]}],"from":"2024-01-01","to":"2024-01-02"}'
```

[Tardis-machine](/tardis-machine/quickstart.md) is a locally runnable server that exposes API allowing efficiently requesting historical market data for whole time periods in contrast to [HTTP API](/api/http-api-reference.md) that provides data only in minute by minute slices.

See [tardis-machine](/tardis-machine/quickstart.md) docs.
{% endtab %}
{% endtabs %}

### Captured real-time channels

{% embed url="<https://www.okx.com/docs-v5/en/>" %}
See OKX Options WebSocket API docs providing documentation for each captured channel's format
{% endembed %}

{% hint style="info" %}
Click any channel below to see [HTTP API](/api/http-api-reference.md#data-feeds-exchange) response with historical data recorded for it.
{% endhint %}

**Current channels (API v5, since 2021-12-23):**

* [trades](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22trades%22}]) Public options trade executions stream
* [trades-all](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22trades-all%22}]) — available since **2023-10-19** All trades stream including non-aggregated trade messages
* [option-trades](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22option-trades%22}]) — available since **2023-03-30** Option trades stream
* [books-l2-tbt](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22books-l2-tbt%22}]) Tick-by-tick L2 options order book updates
* [books](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22books%22}]) — available since **2023-02-24**, until **2024-07-19** Incremental options order book depth updates
* [bbo-tbt](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22bbo-tbt%22}]) — available since **2022-05-05** Tick-by-tick best bid and offer updates
* [tickers](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22tickers%22}]) 24h options ticker updates
* [opt-summary](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22opt-summary%22}]) Option summary with greeks, implied volatility and contract statistics
* [index-tickers](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22index-tickers%22}]) Index ticker updates with keepalive up to 1m when unchanged
* [open-interest](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22open-interest%22}]) Open interest updates
* [mark-price](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22mark-price%22}]) Mark price updates with keepalive up to 10s when unchanged
* [status](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22status%22}]) Exchange status and maintenance notifications
* [instruments](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22instruments%22}]) Instrument state updates (listing, suspension, parameter changes)
* [price-limit](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22price-limit%22}]) Price limit updates
* [estimated-price](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22estimated-price%22}]) Estimated delivery/settlement price updates
* [public-block-trades](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22public-block-trades%22}]) — available since **2023-01-01** Public block trades stream
* [public-struc-block-trades](https://api.tardis.dev/v1/data-feeds/okex-options?from=2024-01-01\&filters=\[{%22channel%22:%22public-struc-block-trades%22}]) — available since **2023-01-01** Public structured block trades stream

**Legacy channels (API v3, until 2021-12-23):**

* [option/trade](https://api.tardis.dev/v1/data-feeds/okex-options?from=2021-01-01\&filters=\[{%22channel%22:%22option/trade%22}]) — available until **2021-12-23** Public options trade executions stream
* [option/trades](https://api.tardis.dev/v1/data-feeds/okex-options?from=2021-01-01\&filters=\[{%22channel%22:%22option/trades%22}]) — available since **2020-07-30**, until **2021-12-23** Public options trade executions stream
* [option/depth](https://api.tardis.dev/v1/data-feeds/okex-options?from=2020-02-01\&filters=\[{%22channel%22:%22option/depth%22}]) — available until **2020-02-13** Incremental options order book updates (legacy depth channel)
* [option/depth\_l2\_tbt](https://api.tardis.dev/v1/data-feeds/okex-options?from=2021-01-01\&filters=\[{%22channel%22:%22option/depth_l2_tbt%22}]) — available since **2020-02-07**, until **2021-12-23** Tick-by-tick L2 options order book updates with sequencing
* [option/ticker](https://api.tardis.dev/v1/data-feeds/okex-options?from=2021-01-01\&filters=\[{%22channel%22:%22option/ticker%22}]) — available until **2021-12-23** 24h options ticker updates
* [option/summary](https://api.tardis.dev/v1/data-feeds/okex-options?from=2021-01-01\&filters=\[{%22channel%22:%22option/summary%22}]) — available until **2021-12-23** Option summary with greeks, implied volatility and contract statistics
* [index/ticker](https://api.tardis.dev/v1/data-feeds/okex-options?from=2021-01-01\&filters=\[{%22channel%22:%22index/ticker%22}]) — available since **2020-06-08**, until **2021-12-23** Index ticker for options contracts with keepalive up to 1m when unchanged
* [option/instruments](https://api.tardis.dev/v1/data-feeds/okex-options?from=2021-01-01\&filters=\[{%22channel%22:%22option/instruments%22}]) — available until **2021-12-23** Option instruments metadata updates (listing, expiry, contract parameter changes)
* [system/status](https://api.tardis.dev/v1/data-feeds/okex-options?from=2021-01-01\&filters=\[{%22channel%22:%22system/status%22}]) — available since **2020-07-01**, until **2021-12-23** Exchange status and maintenance notifications

### Market data collection details

[Market data collection infrastructure](/faq/general.md#what-is-your-infrastructure-setup) for OKX Options since **2022-05-04** is located in AWS HK region (Hong Kong, China, VPC colo setup), before that, since **2020-05-15** it was located in GCP asia-northeast1 region (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`.

{% hint style="info" %}
OKX servers are located in Alibaba Cloud cn-hongkong region (Hong Kong, China).
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tardis.dev/historical-data-details/okex-options.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
