Skip to main content

Lastra

CI PyPI License

Python reader/writer for the Lastra columnar time series format.
Bit-exact compatibility with lastra-java and lastra-ts.


Status

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.

Install

pip install lastra

Usage

from 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()

Why Lastra

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.

Reference implementations

Language Repo Status
Java QTSurfer/lastra-java Reference (writer + reader)
TypeScript QTSurfer/lastra-ts Reader feature-complete
Python QTSurfer/lastra-py This repo

Conversion to/from Parquet, CSV, Arrow

See QTSurfer/lastra-convert-py — Python CLI port of the QTSurfer/lastra-convert (Java) tool.

License

Copyright 2026 Wualabs LTD. Apache License 2.0 — see LICENSE.

Metadata

Release files for lastra 0.8.3

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

Source distribution (sdist)

Source distribution for lastra 0.8.3
File Size Uploaded
lastra-0.8.3.tar.gz 44.0 kB Details

Built distribution (wheel)

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

Total release size: 78.7 kB

Release files / lastra-0.8.3.tar.gz

Download URL lastra-0.8.3.tar.gz
Size 44.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4a9ef51631df752ccce52a93015307b5c6f02dbda987b54f3759f8eb7df6b92d
BLAKE2b-256 checksum
How to use checksums
3887fc27963226f6a2bb7e49661c006a0c83f79c2eff7a70bf60e993133d6780
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 6, 2026.

Transparency log

Release files / lastra-0.8.3-py3-none-any.whl

Download URL lastra-0.8.3-py3-none-any.whl
Size 34.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b71cbdc5a696a475e27878ae3c08d896d6c638e8e96b9d4d42d5b86ceed23d33
BLAKE2b-256 checksum
How to use checksums
b859e6210385a1b857be21d43ed2b4e4702eadff4107ed84c349c25474a03dfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.3 This release

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

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