Skip to main content

kalshieye

Python client for Kalshi Eye flat files. Kalshi: daily Parquet for the order book (book_l2), 1-second top-10 book snapshots (book_snap_1s), top of book (bbo), one-minute bars (bbo_1m), trades, crypto spot (spot), and the reference tables (markets, settlements, series, incidents). Polymarket: polymarket_l2, polymarket_trades, polymarket_fills, polymarket_markets. Limitless: limitless_l2, limitless_markets. Chainlink prices: chainlink. replay_book rebuilds Kalshi books from book_l2.

pip install "kalshieye[pandas]"      # or kalshieye[polars], or plain kalshieye
export KALSHIEYE_API_KEY=clab_...     # create one at https://kalshieye.com/app/api/
from kalshieye import Client, replay_book

kx = Client()
kx.datasets()                                             # schemas, coverage, required plan
# 2026-10-13 is a free sample day: any key gets every dataset for it.
kx.estimate(["bbo_1m", "trades"], "2026-10-13", "2026-10-13", series=["KXBTC*"])

kx.download(["bbo_1m", "trades"], "2026-10-13", "2026-10-13",
            series=["KXBTC*"], progress=True)               # into ./kalshieye-data

df = kx.load("bbo_1m", "2026-10-13", "2026-10-13", series="KXBTC15M")
fills = kx.load("trades", "2026-10-13", "2026-10-13", tickers=["KXBTC15M-26OCT131200-00"])

# Rebuild the book from book_l2 rows (Full book; free on sample days)
book = kx.load("book_l2", "2026-10-13", "2026-10-13", tickers=["KXBTC15M-26OCT131200-00"])
for ts, ticker, bids, asks in replay_book(book):
    ...

# One Kalshi event in a zip: the datasets on your plan, metadata.json, settlement.json.
# A zip holds 31 published days; bundles() saves every zip of a longer event, each named by its days.
zip_path = kx.bundle("KXBTC15M-26OCT131200")
paths = kx.bundles("KXBTC15M-26OCT131200")

# Book replay for one market-day: every 1-second frame and every trade (all pages)
day = kx.replay("KXBTC15M-26OCT131200-00", date="2026-10-13")

# CSV.gz copy of a single file
f = next(kx.files("trades", "2026-10-13", "2026-10-13", series="KXBTC15M"))
kx.csv(f["key"])

# S3 sync (aws s3 sync, rclone, DuckDB, boto3) is coming soon: create_s3_key() answers 503 until then.
  • Files land under dest (default kalshieye-data) in the lake layout (bbo_1m/date=2026-10-13/series=KXBTC15M/...parquet), so DuckDB, Polars, and Spark can read the folder as a hive-partitioned dataset. spot and chainlink are partitioned by asset= instead of series=.
  • Every file is checked against its sha256. Files already on disk are skipped and do not count toward your monthly download allowance.
  • series accepts wildcards (KXBTC*). categories keeps the Kalshi series in those categories, named as /api/v1/categories returns them (Crypto, Climate and Weather, ...); an unknown one is an error, not an empty result. tickers picks the series files holding those markets, and load keeps only their rows.
  • Every call counts toward your plan's API limits (Explorer: 100 requests a day, 30 a minute); see https://kalshieye.com/docs/authentication/.
  • bundle, csv, and replay are built on the server the first time anyone asks, then cached. The client polls until each is ready, up to its wait seconds, and raises ApiError (504) if it is still building; call again later.
  • Nothing comes back cut short. replay walks every page (next_offset) and checks the totals; bundles asks for each 31-day zip in turn (next_start_date); bundle raises (413) for an event that needs more than one zip; requests returns every saved request, or the newest limit.
  • Errors raise kalshieye.ApiError. Use err.code to tell plan limits (plan_required, history_limited, download_quota) apart.

Without an account

replay_book works on any book_l2 rows, including the free one-day sample on Hugging Face (KalshiEye/kalshi-order-book-sample), which DuckDB reads in place:

# pip install "kalshieye[pandas]" duckdb
import duckdb
from kalshieye import replay_book

# Bills vs Rams, YES if Buffalo wins: every book change up to 11 PM Eastern
book = duckdb.sql("""
  SELECT * FROM 'hf://datasets/KalshiEye/kalshi-order-book-sample/kalshieye-data/book_l2/*/series=KXNFLGAME/*.parquet'
  WHERE ticker = 'KXNFLGAME-26OCT12BUFLAR-BUF'
    AND ts_recv::TIMESTAMPTZ <= '2026-10-13 03:00:00+00'::TIMESTAMPTZ
  ORDER BY ts_recv, seq
""").df()

*_, (ts, ticker, bids, asks) = replay_book(book, levels=3)
print(bids)  # [(0.51, 155253.51), (0.5, 405328.0), (0.49, 15126.0)]
print(asks)  # [(0.52, 960851.07), (0.53, 862817.41), (0.54, 113351.03)]

More runnable examples (a backtest, spreads and depth, calibration) are in KalshiEye/kalshieye-examples. Every column is described in the data dictionary.

Metadata

Release files for kalshieye 0.2.4

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

Source distribution (sdist)

Source distribution for kalshieye 0.2.4
File Size Uploaded Provenance Actions
kalshieye-0.2.4.tar.gz 15.3 kB With provenance Details for kalshieye-0.2.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kalshieye 0.2.4
File Interpreter ABI Platform Actions
kalshieye-0.2.4-py3-none-any.whl Python 3 none any Details for kalshieye-0.2.4-py3-none-any.whl

Total release size: 27.1 kB

Release files / kalshieye-0.2.4.tar.gz

Download URL kalshieye-0.2.4.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e71bad7a93b056ba86bf2685761735861d7483d0d754ba446ed629e787282e7d
BLAKE2b-256 checksum
How to use checksums
04fc9da002a3e04e6f4932a0f06554f7165e59f4959684aaa6c5a40aca2bca52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Release files / kalshieye-0.2.4-py3-none-any.whl

Download URL kalshieye-0.2.4-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa8bf4f56fe3a3462d286034f85732078d8a9a867ea5670eccca0ceebeff0b5b
BLAKE2b-256 checksum
How to use checksums
5643fd6e198479c631d50224feee3c8ea49d2ae448d11059155125a460ccb5e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 28, 2026.

Transparency log

Security for kalshieye 0.2.4

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kalshieye-0.2.4.tar.gz

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 Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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