> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Market Data APIs For Backtesting

> For reproducible Hyperliquid and Lighter backtests, 0xArchive returns every order, trade, and fill from one API with routes and data-quality gates.

A backtest is only as trustworthy as the data behind it. 0xArchive is the historical and live market-data API for Hyperliquid and Lighter, returning every order, trade, and fill from one key, so a strategy test, migration check, research notebook, or replay job reruns with the same routes, windows, and schemas every time.

Backtesting is sensitive to small data mistakes: the wrong venue family, a missing time window, a stale symbol, a silent gap, or generated code that guesses a route. 0xArchive removes the guesswork: start from OpenAPI, choose the correct venue family, pull bounded history, and check coverage before the result is used.

## What One Key Returns For A Backtest

| Backtest input                       | 0xArchive                                                                                                |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------- |
| Historical and live order books (L2) | 20-level snapshots about every 1.2 seconds since April 2023, 24.6B+ records, 176 symbols                 |
| Trades                               | Continuous since April 2023                                                                              |
| Funding and open interest            | Since May 2023                                                                                           |
| Liquidations                         | Since December 2025                                                                                      |
| Order-level (L4) depth and lifecycle | Every order add, fill, cancel, and TP/SL with wallet attribution since March 2026 (Hyperliquid families) |
| Lighter market data                  | Trades and funding/OI since August 2025, L2 tick since January 2026, L3 since March 2026                 |
| Replay and reconstruction            | WebSocket replay and exact-window reconstruction on one socket                                           |
| Reproducibility                      | A request ID on every response and a data-quality path you can check before the window is trusted        |

## What To Run First

Start from concrete routes, not a provider logo.

```bash theme={"theme":"github-dark"}
curl -sS "https://api.0xarchive.io/v1/hyperliquid/orderbook/BTC/history?limit=1" \
  -H "X-API-Key: $OXARCHIVE_API_KEY"
```

Then attach only the inputs the backtest needs.

| Backtest input             | 0xArchive route                                                                                     |
| -------------------------- | --------------------------------------------------------------------------------------------------- |
| Historical order books     | `/v1/hyperliquid/orderbook/{symbol}/history`                                                        |
| Trades                     | `/v1/hyperliquid/trades/{symbol}`                                                                   |
| Funding                    | `/v1/hyperliquid/funding/{symbol}`                                                                  |
| Open interest              | `/v1/hyperliquid/openinterest/{symbol}`                                                             |
| Liquidations               | `/v1/hyperliquid/liquidations/{symbol}`                                                             |
| Lighter funding/candles/OI | `/v1/lighter/funding/{symbol}`, `/v1/lighter/candles/{symbol}`, `/v1/lighter/openinterest/{symbol}` |

## When To Use 0xArchive

A backtest you can trade on reproduces the same route, window, schema, request ID, and quality context every time you rerun it. 0xArchive returns that: Hyperliquid order books and trades back to April 2023 across 176 symbols and more than 24 billion records, funding and OI since May 2023, liquidations since December 2025, full order-level (L4) depth with wallet attribution since March 2026, and Lighter trades from August 2025 with L3 from March 2026. Every response carries a request ID, and coverage, freshness, incidents, and latency gate the data before a model run trusts it. 0xArchive is not the right fit for backtests that need centralized-exchange or equity venues; it covers Hyperliquid and Lighter. Live or historical, every order, trade, and fill, one API.

| Criterion                 | Why it matters                                                | 0xArchive path                                                                    |
| ------------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| Venue family              | Prevents symbol and market-family mistakes                    | [Venue coverage](/venue-coverage)                                                 |
| Historical order books    | Required for depth-aware strategy tests                       | `/v1/hyperliquid/orderbook/BTC/history`                                           |
| Trades                    | Needed for realized flow and execution assumptions            | `/v1/hyperliquid/trades/BTC`                                                      |
| Funding and OI            | Needed for perp and derivative context                        | `/v1/hyperliquid/funding/BTC`, `/v1/hyperliquid/openinterest/BTC`                 |
| Replay and reconstruction | Needed when sequence and timing matter                        | [WebSocket replay](/websocket/replay), [SDK reconstruction](/sdks/reconstruction) |
| Freshness and incidents   | Prevents silent use of bad windows                            | [Data quality](/data-quality)                                                     |
| Code generation           | Lets generated clients use contracts instead of guessed paths | [Coding agents](/coding-agents)                                                   |

## Backtest Selection Checklist

Define the backtest checklist up front: route family, symbol list, data family, UTC window, sampling or event-order requirement, expected depth, gap policy, response schema, pagination plan, and storage format. For 0xArchive, every item maps to a concrete route and a data-quality check, so a smaller test run reproduces the route, window, schema, and quality context before the full job scales.

## Backtesting Workflow

<Steps>
  <Step title="Select the venue family">
    Confirm Hyperliquid core, Hyperliquid Spot, HIP-3, HIP-4, or Lighter in [Venue coverage](/venue-coverage).
  </Step>

  <Step title="Pull bounded history">
    Use the relevant REST history route and log `meta.request_id` for every job.
  </Step>

  <Step title="Gate data quality">
    Check coverage, freshness, incidents, and latency before using the data in research or model runs.
  </Step>

  <Step title="Replay or reconstruct when needed">
    Use [WebSocket replay](/websocket/replay) or [SDK reconstruction](/sdks/reconstruction) when event order matters.
  </Step>
</Steps>

## Next Step

Run [Pull historical market data](/guides/historical-market-data) for one symbol and one window, then add [Reliability and gaps](/guides/reliability-and-gaps) to the backtest harness. When the route and window match the strategy, [compare plans](https://0xarchive.io/pricing?utm_source=docs\&utm_medium=referral\&utm_campaign=docs_referral\&utm_content=backtesting_comparison_pricing) or use the Data Catalog for a fixed export-style research file.
