> For the complete documentation index, see [llms.txt](https://docs.lighter.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lighter.xyz/developers/integration-guides/historical-data.md).

# Historical Data

{% tabs %}
{% tab title="Lighter" %}
Users can fetch historical data using various REST endpoints, mainly:

* [accountInactiveOrders](https://docs.lighter.xyz/api/orders)
* [trades](https://docs.lighter.xyz/api/orders)
* [logs](https://docs.lighter.xyz/api/explorer-api/account)
* [tx](https://docs.lighter.xyz/api/transactions)
* [pnl](https://docs.lighter.xyz/api/account)
* [deposit\_history](https://docs.lighter.xyz/api/transactions), [transfer\_history](https://docs.lighter.xyz/api/transactions), [withdraw\_history](https://docs.lighter.xyz/api/transactions)
* [candles](https://docs.lighter.xyz/api/candlesticks)
* [fundings](https://docs.lighter.xyz/api/funding), [positionFunding](https://docs.lighter.xyz/api/account)
* [liquidations](https://docs.lighter.xyz/api/account)
* [exchangeMetrics](https://docs.lighter.xyz/api/info), [executeStats](https://docs.lighter.xyz/api/info)

Several of these are heavy (see the weights in [Rate Limits](https://docs.lighter.xyz/developers/reference/rate-limits.md)), so paginate and cache the results.

Alternatively, you can use [export](https://docs.lighter.xyz/api/orders) to obtain CSVs of trades or funding payments for a specific account index. Supply both `start_timestamp` and `end_timestamp` (Unix milliseconds), or omit both for the available history. Large exports may require a smaller date range; see [Export account data](https://docs.lighter.xyz/api/orders/export).

### Free Public Dataset (AWS Open Data)

For bulk historical trades and hourly open interest, use the free public dataset on the [AWS Open Data Registry](https://registry.opendata.aws/aws-public-blockchain/). It is part of the AWS Public Blockchain Data dataset and can be downloaded without an AWS account, credentials or payment.

Files are in Parquet format, with one file per UTC day for each dataset. Data starts at mainnet genesis (January 17, 2025), and new daily files are published each day. Open interest is sampled hourly within each daily file.

| Dataset              | Path                                                                                                   |
| -------------------- | ------------------------------------------------------------------------------------------------------ |
| Trades               | `s3://aws-public-blockchain/v1.1/lighter/core/mainnet/trades/date=YYYY-MM-DD/trades.parquet`           |
| Hourly open interest | `s3://aws-public-blockchain/v1.1/lighter/core/mainnet/open_interest_hourly/date=YYYY-MM-DD/oi.parquet` |

Use `--no-sign-request` with the AWS CLI to access the public bucket anonymously.

The legacy [`export/historicalTrades`](https://docs.lighter.xyz/api/orders/export_historicaltrades) endpoint is a separate access route with its own access requirements, documented in the API reference. It is not needed to download the free public dataset above; no transfer or payment is required for public-bucket access.

#### Migrating from the previous bucket

Update your scripts to use the public bucket and the full network-specific prefix shown above. The dataset folder names have changed:

| Previous folder         | Public dataset folder   |
| ----------------------- | ----------------------- |
| `trade-daily/`          | `trades/`               |
| `open-interest-hourly/` | `open_interest_hourly/` |

Replace `--request-payer requester` with `--no-sign-request`. Daily partition and file names remain `date=YYYY-MM-DD/trades.parquet` and `date=YYYY-MM-DD/oi.parquet`.

### Aggregated trades

Use [Aggregated trades](https://docs.lighter.xyz/developers/integration-guides/aggregated-trades.md) to retrieve fills grouped by order, trade type and maker/taker role on Lighter mainnet. The endpoint supports optional `start_timestamp` / `end_timestamp` filters in milliseconds and up to 1,000 orders per page (default 100). The start is inclusive and the end is exclusive; both apply to the stored order aggregate's last fill time.

### Historical Trade Events

The public dataset contains global trade events. List available dates or download a daily file for Lighter Core:

```shell
aws s3 ls s3://aws-public-blockchain/v1.1/lighter/core/mainnet/trades/ --no-sign-request | tail -3
aws s3 cp s3://aws-public-blockchain/v1.1/lighter/core/mainnet/trades/date=2026-10-15/trades.parquet /tmp/trades.parquet --no-sign-request
```

### Hourly Open Interest

Hourly open interest for every perpetual market is available under `open_interest_hourly/`, as one Parquet file per UTC day. Each row is the end-of-hour snapshot of one market:

| Column              | Type            | Description                     |
| ------------------- | --------------- | ------------------------------- |
| `hour`              | timestamp (UTC) | Start of the hour               |
| `symbol`            | string          | Market symbol, e.g. `BTC`       |
| `open_interest`     | double          | Open interest in the base asset |
| `mark_price`        | double          | Mark price at the snapshot      |
| `open_interest_usd` | double          | `open_interest * mark_price`    |

List available dates or download a daily file for Lighter Core:

```shell
aws s3 ls s3://aws-public-blockchain/v1.1/lighter/core/mainnet/open_interest_hourly/ --no-sign-request | tail -3
aws s3 cp s3://aws-public-blockchain/v1.1/lighter/core/mainnet/open_interest_hourly/date=2026-10-15/oi.parquet /tmp/oi.parquet --no-sign-request
```

{% endtab %}

{% tab title="Lighter on Robinhood Chain" %}
Users can fetch historical data using various REST endpoints, mainly:

* [accountInactiveOrders](https://docs.lighter.xyz/api/orders)
* [trades](https://docs.lighter.xyz/api/orders)
* [logs](https://docs.lighter.xyz/api/explorer-api/account)
* [tx](https://docs.lighter.xyz/api/transactions)
* [pnl](https://docs.lighter.xyz/api/account)
* [deposit\_history](https://docs.lighter.xyz/api/transactions), [transfer\_history](https://docs.lighter.xyz/api/transactions), [withdraw\_history](https://docs.lighter.xyz/api/transactions)
* [candles](https://docs.lighter.xyz/api/candlesticks)
* [fundings](https://docs.lighter.xyz/api/funding), [positionFunding](https://docs.lighter.xyz/api/account)
* [liquidations](https://docs.lighter.xyz/api/account)
* [exchangeMetrics](https://docs.lighter.xyz/api/info), [executeStats](https://docs.lighter.xyz/api/info)

Alternatively, you can use [export](https://docs.lighter.xyz/api/orders) to obtain CSVs of trades or funding payments for a specific account index. Supply both `start_timestamp` and `end_timestamp` (Unix milliseconds), or omit both for the available history. Large exports may require a smaller date range; see [Export account data](https://docs.lighter.xyz/api/orders/export).

### Free Public Dataset (AWS Open Data)

For bulk historical trades and hourly open interest, use the free public dataset on the [AWS Open Data Registry](https://registry.opendata.aws/aws-public-blockchain/). It is part of the AWS Public Blockchain Data dataset and can be downloaded without an AWS account, credentials or payment.

Files are in Parquet format, with one file per UTC day for each dataset. Data starts at mainnet genesis (June 26, 2026), and new daily files are published each day. Open interest is sampled hourly within each daily file.

| Dataset              | Path                                                                                                        |
| -------------------- | ----------------------------------------------------------------------------------------------------------- |
| Trades               | `s3://aws-public-blockchain/v1.1/lighter/robinhood/mainnet/trades/date=YYYY-MM-DD/trades.parquet`           |
| Hourly open interest | `s3://aws-public-blockchain/v1.1/lighter/robinhood/mainnet/open_interest_hourly/date=YYYY-MM-DD/oi.parquet` |

Use `--no-sign-request` with the AWS CLI to access the public bucket anonymously.

The legacy [`export/historicalTrades`](https://docs.lighter.xyz/api/orders/export_historicaltrades) endpoint is a separate access route with its own access requirements, documented in the API reference. It is not needed to download the free public dataset above; no transfer or payment is required for public-bucket access.

#### Migrating from the previous bucket

Update your scripts to use the public bucket and the full network-specific prefix shown above. The dataset folder names have changed:

| Previous folder         | Public dataset folder   |
| ----------------------- | ----------------------- |
| `trade-daily/`          | `trades/`               |
| `open-interest-hourly/` | `open_interest_hourly/` |

Replace `--request-payer requester` with `--no-sign-request`. Daily partition and file names remain `date=YYYY-MM-DD/trades.parquet` and `date=YYYY-MM-DD/oi.parquet`.

### Historical Trade Events

The public dataset contains global trade events. List available dates or download a daily file for Lighter on Robinhood Chain:

```shell
aws s3 ls s3://aws-public-blockchain/v1.1/lighter/robinhood/mainnet/trades/ --no-sign-request | tail -3
aws s3 cp s3://aws-public-blockchain/v1.1/lighter/robinhood/mainnet/trades/date=2026-10-15/trades.parquet /tmp/trades.parquet --no-sign-request
```

### Hourly Open Interest

Hourly open interest for every perpetual market is available under `open_interest_hourly/`, as one Parquet file per UTC day. Each row is the end-of-hour snapshot of one market:

| Column              | Type            | Description                     |
| ------------------- | --------------- | ------------------------------- |
| `hour`              | timestamp (UTC) | Start of the hour               |
| `symbol`            | string          | Market symbol, e.g. `BTC`       |
| `open_interest`     | double          | Open interest in the base asset |
| `mark_price`        | double          | Mark price at the snapshot      |
| `open_interest_usd` | double          | `open_interest * mark_price`    |

List available dates or download a daily file for Lighter on Robinhood Chain:

```shell
aws s3 ls s3://aws-public-blockchain/v1.1/lighter/robinhood/mainnet/open_interest_hourly/ --no-sign-request | tail -3
aws s3 cp s3://aws-public-blockchain/v1.1/lighter/robinhood/mainnet/open_interest_hourly/date=2026-10-15/oi.parquet /tmp/oi.parquet --no-sign-request
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lighter.xyz/developers/integration-guides/historical-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
