Skip to main content

lighter-data

ci

Pull Lighter (zkLighter) market data into Parquet: funding history, candles, historical L2 book + trades — plus a live WebSocket recorder for the data no archive sells yet. Everything is free: public REST / WebSocket, no API key, no account.

Lighter is a young zk CLOB venue with 0%/0% maker/taker fees, perps and a small set of USDC spot markets. There is no official historical-data tooling: symbols are numeric market indices, history endpoints silently cap a single response (~750 funding rows, 500 candles), and the funding rate arrives as an unsigned percent-per-hour magnitude with the sign in a separate field. This package deals with all of that and writes tidy, manifest-checked Parquet.

Install

pip install lighter-data
# or, from a checkout:
pip install -e .

Python ≥3.10. Dependencies: pyarrow, websocket-client (the recorder); all HTTP is stdlib.

Quickstart

# full hourly funding history, per coin, paginated to the floor date
lighter-data funding --coins ETH SOL --root data

# hourly candles for the perp and the (young) USDC spot market
lighter-data candles --coins ETH --kinds perp spot --root data

# historical L2 + trades: Tardis.dev free first-of-month samples, no key
lighter-data tardis --coins XPL,EIGEN,JTO --dates 2026-05-01,2026-06-01 --root data

# live recorder: sampled top-20 book every 500ms + every trade
lighter-data record --coins WLD,ONDO,LINK --root data

--coins (and tardis --dates) accept space- and comma-separated lists interchangeably on every subcommand.

Datasets

command source output notes
funding REST /api/v1/fundings funding/lighter/<coin>_perp/funding.parquet signed hourly fraction, HL-comparable
candles REST /api/v1/candles candles/lighter/<coin>_<kind>/<tf>/candles.parquet perp + spot, 500-bar cap windowed
tardis datasets.tardis.dev l2book/…/date=…/l2book.parquet, trades/…/trades.parquet first day of each month is free
record WebSocket /stream l2book/…/date=…/part-*.parquet, trades/…/part-*.parquet top-20 @ 500ms, counterparty account ids

Candle/funding partitions get a manifest.json sidecar (row count, bounds, cadence, duplicate timestamps, largest gaps), so a half-month hole from a broken resume shows up at download time, not as a silent bias in a backtest.

The funding sign, pinned

A Lighter funding row is {timestamp, value, rate, direction} where rate is a non-negative percent-per-hour magnitude and the sign lives in direction ("long" = longs pay shorts). The written rate column is the signed hourly fraction:

rate = rate_pct / 100 * (+1 if direction == "long" else -1)

verified live against value / index_price, and on the same scale as Hyperliquid's fundingRate — so cross-venue carry math needs no adapter. (Sister package: hyperliquid-data; the candle and funding schemas are identical across the two.)

Caps and pagination

A single wide request against Lighter's history endpoints does not error — it silently returns the most-recent slice (~750 funding rows, 500 candles), which looks like the venue's whole history. The pullers paginate fixed overlapping windows from a floor date (default 2025-01-01, before the first mainnet perp listing) and collapse the seam duplicates, so the written series reaches the true listing date.

The recorder

lighter-data record maintains each subscribed book from snapshot + deltas and samples the top-20 every 500 ms (~20x smaller than storing every delta, and the shape a fill-sim wants), records every trade with both counterparty account ids (Lighter's public feed exposes them — enough to build maker/taker cohorts offline), flushes Parquet parts every 10 min, and survives disconnects with backoff. It is a long-running service: run it under docker-compose/systemd with restart, not from a terminal you plan to close.

data/l2book/lighter/wld_perp/date=20260506/part-123005-000100.parquet
data/trades/lighter/wld_perp/date=20260506/part-123005-000100.parquet

Library use

from pathlib import Path

from lighter_data import resolve_perp_ids, fetch_all_funding, funding_rows, write_funding

mid = resolve_perp_ids()["ETH"]
pairs = fetch_all_funding(mid, start_s=1735689600, end_s=1754377200)
write_funding(funding_rows("ETH", pairs), root=Path("data"), instrument="ETH-PERP")

The supported surface is lighter_data.__all__ (pinned by tests/test_public_api.py); schemas are typed in lighter_data.types and pinned as pyarrow schemas in lighter_data.parquet.

License

MIT.

Metadata

Release files for lighter-data 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lighter-data 0.1.0
File Size Uploaded
lighter_data-0.1.0.tar.gz 31.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lighter-data 0.1.0
File Interpreter ABI Platform
lighter_data-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 59.0 kB

Release files / lighter_data-0.1.0.tar.gz

Download URL lighter_data-0.1.0.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5d08531617a826b50ffaa0424b187fe385e0e2bb88193683f29ac1855d5b42be
BLAKE2b-256 checksum
How to use checksums
f5afff489c9fa5fdb5ac1693b391faefc9a68893d02981cbecf5c081882bffca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release files / lighter_data-0.1.0-py3-none-any.whl

Download URL lighter_data-0.1.0-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
38929df371f6c3c2d54f4873c3c8b70ae72f1c60ef4c7a713163286f52adda92
BLAKE2b-256 checksum
How to use checksums
a7b6e272b2b1db97b21ec72573d5ffdbfbbd8730d7c1193fe2cc2a247369ce91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page