Skip to main content

Python reader/writer for the Lastra columnar time series format. Bit-exact compatible with QTSurfer/lastra-java + lastra-ts.

Project description

Lastra

CI PyPI License

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


Status

🚧 Pre-release — repository scaffold while we port the format from Java. The first published release will be 0.8.0 to align with lastra-java.

The wire-format spec lives in FORMAT.md. Same semantics as lastra-java v0.8.0.

Install (planned)

pip install lastra

Usage (planned API)

from lastra import LastraReader

with open("ohlcv.lastra", "rb") as f:
    r = LastraReader(f)

    # Read only what you need — other columns are not decompressed
    ts = r.read_series("ts")           # numpy int64 array
    close = r.read_series("close")     # numpy float64 array

    # Column metadata
    meta = r.series_column("ema1").metadata
    # {"indicator": "ema", "periods": "10"}

    # Events (independent timestamps)
    sig_ts = r.read_event("ts")
    sig_data = r.read_event("data")    # list[bytes]

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.

Project details


Download files

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

Source Distribution

lastra-0.8.0.tar.gz (37.5 kB view details)

Uploaded Source

Built Distribution

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

lastra-0.8.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file lastra-0.8.0.tar.gz.

File metadata

  • Download URL: lastra-0.8.0.tar.gz
  • Upload date:
  • Size: 37.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lastra-0.8.0.tar.gz
Algorithm Hash digest
SHA256 5cb1aca579843bec18ebecf41f3303becda59f3069f255b7470a0f1262137ca8
MD5 22c1a7b8c678378c43788f8f4cb1ae62
BLAKE2b-256 89a13adfe661efe542cd7cc717494eb6480fadbc46576991e12669247c546abd

See more details on using hashes here.

Provenance

The following attestation bundles were made for lastra-0.8.0.tar.gz:

Publisher: release.yml on QTSurfer/lastra-py

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

File details

Details for the file lastra-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: lastra-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for lastra-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 014dcef3c4f90b3bdf585793a6ca37dc4b6ea248e803829df92b64285c29cf07
MD5 2ec720df315330a54e989d1fc8d37f32
BLAKE2b-256 a90045013a8a5aee80b4624c31e4c7f57ad5a53c413fc7246ab7d5b670d67a1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for lastra-0.8.0-py3-none-any.whl:

Publisher: release.yml on QTSurfer/lastra-py

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 Pingdom Monitoring Sentry Error logging StatusPage Status page