Skip to main content

Unified data layer for the BagelQuant ecosystem

Project description

BagelQuant Data

bagelquant-data is a Polars-native, source-agnostic data lake framework for quantitative research.

  • Polars is the dataframe engine.
  • Parquet is the canonical analytical storage format.
  • SQLite stores mutable metadata, manifests, run state, and source/dataset registration.
  • Tushare is implemented as the first source adapter under bagelquant_data.sources.tushare.
  • Non-reference research extraction returns one field at a time as time | asset_id | value.
import polars as pl

from bagelquant_data import DataLake, DatasetSpec

lake = DataLake.open("data")
spec = DatasetSpec(
    name="daily",
    source="custom",
    source_dataset="daily",
    category="market",
    field_mapping={"ts_code": "ts_code", "trade_date": "trade_date"},
    required_columns=("asset_id", "time"),
    primary_key=("asset_id", "time"),
    asset_column="ts_code",
    time_column="trade_date",
    partition_strategy="year_month",
    deduplication="primary_key_last",
    sort_columns=("time", "asset_id"),
)
lake.ingest_frame(
    spec,
    pl.DataFrame(
        {
            "trade_date": ["2024-01-02"],
            "ts_code": ["000001.SZ"],
            "close": [100.0],
        }
    ),
)

close = lake.query.field("daily", "close", source="custom", collect=True)
print(close)  # time, asset_id, close

Documentation is available in two languages:

  • English: docs/en/index.md
  • Chinese: docs/cn/index.md

Development

uv run pytest

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

bagelquant_data-0.1.4.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

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

bagelquant_data-0.1.4-py3-none-any.whl (49.4 kB view details)

Uploaded Python 3

File details

Details for the file bagelquant_data-0.1.4.tar.gz.

File metadata

  • Download URL: bagelquant_data-0.1.4.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.14

File hashes

Hashes for bagelquant_data-0.1.4.tar.gz
Algorithm Hash digest
SHA256 17b63e2f17db37d2127bbf3f694d2bc8b0e8d4ba46a7d4e8b6744952764efa02
MD5 ca2ae7ace956f6f4a51a4459a13d5e1c
BLAKE2b-256 575b18156d80187507ecd49cfa40a85763891638a2e25d7774b8d1ceb7a63b6d

See more details on using hashes here.

File details

Details for the file bagelquant_data-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for bagelquant_data-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7ad4607dfffca915bd586217b90635581c650643bc7c8cb9cd5f42c3cb197fec
MD5 bfb95ef544c8cb8892c95fb49c45f107
BLAKE2b-256 c677a6fc89d885b1f03422f1aa7b1e6a7e5af6067e168b41d0be85bee7d538db

See more details on using hashes here.

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