> ## 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

> Compare APIs for reproducible Hyperliquid and Lighter backtests using books, trades, funding, OI, Hyperliquid L4, Lighter L3, replay, and quality checks.

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 order books, trades, funding, open interest, liquidations, Hyperliquid L4, and Lighter L3 through one API, so a strategy test, migration check, research notebook, or replay job can record the same route, window, schema, and quality context every time.

Comparing market-data APIs for a strategy test starts with the venue family: Hyperliquid or Lighter. Native Hyperliquid handles execution and account state. Tardis.dev provides broad multi-exchange coverage. Keep both jobs separate from the comparison below.

> **Evidence checked August 28, 2026.** Tardis' [Hyperliquid page](https://docs.tardis.dev/historical-data-details/hyperliquid) and [Lighter page](https://docs.tardis.dev/historical-data-details/lighter) state their venue-specific history, captured channels, and delivery paths. Hyperliquid's [Info endpoint documentation](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint) states native response and retention limits. The 0xArchive route and coverage claims use [Venue coverage](/venue-coverage), [Replay and reconstruction](/core-concepts/replay-and-reconstruction), and [Data quality](/data-quality).

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 |
| Trades | Continuous since April 2023 |
| Funding and open interest | Since May 2023 |
| Liquidations | Completed events from each symbol's `coverage_by_type.liquidations` start |
| Hyperliquid L4 resting-order depth and separate lifecycle routes | Hyperliquid L4 history starts March 2026 on core and HIP-3 and May 2026 on HIP-4; Spot order events and reconstructable checkpoints require separate coverage checks; lifecycle history is route-specific |
| Lighter market data | Earliest observed trade row: January 17, 2025; exact starts vary by market. Funding and OI are recorded since August 2025. L2 tick starts January 2026; L3 starts March 2026. |
| Replay and reconstruction | WebSocket replay plus route-specific reconstruction; use the SDK when the application needs local state |
| Reproducibility | Request IDs when exposed, plus a data-quality 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, parameters, window, schema, and quality context every time you rerun it. Record the request ID for each run when the response exposes one. Hyperliquid order books and trades go back to April 2023, funding and OI to May 2023, and completed liquidations to each symbol's `coverage_by_type.liquidations` start. Full order-level L4 history with wallet attribution starts in March 2026 on core and HIP-3 and in May 2026 on HIP-4; Spot order events and reconstructable checkpoints require separate coverage checks. The earliest observed Lighter trade row is January 17, 2025; exact starts vary by market. Lighter L3 begins in March 2026. Pair request IDs, when exposed, with coverage, freshness, incidents, and latency before a model run trusts the window. Use another provider when the required venue sits outside the Hyperliquid and Lighter APIs.

| 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` when the route exposes it.
  </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 [gap handling](/data-quality#handle-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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.