BagelQuant Data
bagelquant-data is a local Parquet and SQLite data lake for quantitative
research. Its public API has three facades: lake.admin, lake.update, and
lake.query.
Read the guides in order: overview, quickstart, datasets, sources, updates, queries, and operations.
import polars as pl
from bagelquant_data import DataLake, DatasetSpec
lake = DataLake.open("data")
spec = DatasetSpec(
"daily",
"by_daily",
calendar="trade_cal",
field_mappings={"trade_date": "time", "ts_code": "asset_id"},
)
lake.ingest(spec, pl.DataFrame({"trade_date": ["20250102"], "ts_code": ["000001.SZ"], "close": [11.25]}))
print(lake.query.query("daily", source="custom", fields=["time", "asset_id", "close"]).collect())
general datasets replace one file and do not require canonical key fields.
by_daily and by_asset datasets derive the key (time, asset_id) and must
explicitly map provider fields to those names; add primary_key_extra when
another field, such as period, is also unique.
Incremental local coverage is owned by the lake's update_scopes ledger.
by_daily records one scope per open date and request variant, and by_asset
records one scope per asset and request variant. A scope becomes successful
only after its canonical Parquet commit succeeds. Provider-only range checks
are stored separately in provider_scope_checks and never advance local data
coverage. Validated empty responses are durable empty scope outcomes and are
rechecked on the next update while their dates remain within the latest 20
requested trading sessions. Older empty daily scopes stay terminal. Repair
requests finish and commit before new daily scopes begin. by_asset data uses
stable year/asset-bucket partitions (32 buckets by default), so a new asset
does not rewrite one whole-year file. Old metadata schemas are rejected rather
than migrated; metadata schema v3 requires a fresh lake root.
uv run pytest
uv run pyright
uv run ruff check .
Metadata
Release files for bagelquant-data 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bagelquant_data-0.2.0.tar.gz | 53.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bagelquant_data-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 124.2 kB
Release files / bagelquant_data-0.2.0.tar.gz
| Download URL | bagelquant_data-0.2.0.tar.gz |
|---|---|
| Size | 53.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66509a7691cf84011437d38cbc490934d51649dbee1db48aaaab0a610f25ef29
|
|
BLAKE2b-256 checksum How to use checksums |
6f89ce4d95d3842c1771490429c15973339d8678bac2d6ca716ae17a9608291f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / bagelquant_data-0.2.0-py3-none-any.whl
| Download URL | bagelquant_data-0.2.0-py3-none-any.whl |
|---|---|
| Size | 70.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d116cb9e6da5ecae508ac644943e741267ba190d8df5aea856e60f167b85653
|
|
BLAKE2b-256 checksum How to use checksums |
4a52d52d4f3711d1390834e564cfea24b1287f82368cdd29329253d17a26899d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|