Python reader/writer for the Lastra columnar time series format.
Bit-exact compatibility with lastra-java and lastra-ts.
Reader and writer feature-complete, aligned with lastra-java. Wire-format spec lives in FORMAT.md. See the PyPI badge above for the latest version.
pip install lastrafrom lastra import LastraReader
with open("ohlcv.lastra", "rb") as f:
r = LastraReader.from_stream(f)
# Read only what you need — other columns are not decompressed
ts = r.read_series_long("ts") # numpy int64 array
close = r.read_series_double("close") # numpy float64 array
# Column metadata
meta = r.get_series_column("ema1").metadata
# {"indicator": "ema", "periods": "10"}
# Events (independent timestamps)
sig_ts = r.read_event_long("ts")
sig_data = r.read_event_binary("data") # list[bytes | None]Pandas / Polars / Arrow adapters (planned for 0.9):
df = LastraReader(f).to_pandas() # all series columns
pl_df = LastraReader(f).to_polars()
table = LastraReader(f).to_arrow()Lastra is a columnar file format optimised for numeric time series — financial tick data, IoT sensors, infrastructure metrics. It applies semantic compression per column:
- ALP: decimal-aware → ~3-4 bits/value for prices at 2 decimal places
- Pongo: decimal erasure + Gorilla XOR → ~18 bits/value
- Gorilla: XOR for volatile metrics
- DELTA_VARINT: ~1 byte/value for regular timestamps
A typical OHLCV column at 2 decimal places compresses to ~13× the raw size — about 2× better than Apache Parquet (SNAPPY) or ORC for the same data. See the lastra-java README for benchmarks.
| Language | Repo | Status |
|---|---|---|
| Java | QTSurfer/lastra-java | Reference (writer + reader) |
| TypeScript | QTSurfer/lastra-ts | Reader feature-complete |
| Python | QTSurfer/lastra-py | This repo |
See QTSurfer/lastra-convert-py — Python CLI port of the QTSurfer/lastra-convert (Java) tool.
Copyright 2026 Wualabs LTD. Apache License 2.0 — see LICENSE.