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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lighter_data-0.1.0.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lighter_data-0.1.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file lighter_data-0.1.0.tar.gz.

File metadata

  • Download URL: lighter_data-0.1.0.tar.gz
  • Upload date:
  • Size: 31.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lighter_data-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5d08531617a826b50ffaa0424b187fe385e0e2bb88193683f29ac1855d5b42be
MD5 cb15b76367ebc16df68cfce259bf89fe
BLAKE2b-256 f5afff489c9fa5fdb5ac1693b391faefc9a68893d02981cbecf5c081882bffca

See more details on using hashes here.

Provenance

The following attestation bundles were made for lighter_data-0.1.0.tar.gz:

Publisher: release.yml on bond-labs-dev/lighter-data

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lighter_data-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lighter_data-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lighter_data-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38929df371f6c3c2d54f4873c3c8b70ae72f1c60ef4c7a713163286f52adda92
MD5 85aec2fdce9eaa8b0eabea3a795e8f47
BLAKE2b-256 a7b6e272b2b1db97b21ec72573d5ffdbfbbd8730d7c1193fe2cc2a247369ce91

See more details on using hashes here.

Provenance

The following attestation bundles were made for lighter_data-0.1.0-py3-none-any.whl:

Publisher: release.yml on bond-labs-dev/lighter-data

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page