Skip to main content

Composable panel data and graph logic for quantitative research

Project description

BagelQuant Core

bagelquant-core is the Polars-native panel and graph layer for BagelQuant.

Panel data is long-form and keyed by time and asset_id. Numeric panels use a single value column:

import polars as pl

from bagelquant_core import Domain, Panel
from bagelquant_core.composer import div
from bagelquant_core.transformer import rank, zscore

domain = Domain(calendar=["2024-01-02", "2024-01-03"], universe=["AAA", "BBB"])
price = Panel.from_domain(
    pl.DataFrame(
        {
            "time": ["2024-01-02", "2024-01-02"],
            "asset_id": ["AAA", "BBB"],
            "value": [100.0, 50.0],
        }
    ),
    domain,
    name="price",
)
book = Panel.from_domain(
    pl.DataFrame(
        {
            "time": ["2024-01-02", "2024-01-02"],
            "asset_id": ["AAA", "BBB"],
            "value": [40.0, 25.0],
        }
    ),
    domain,
    name="book",
)

factor = rank(zscore(div(book, price)), name="factor")
factor.compute()

print(factor.output.data)

Time-series operations group by asset_id and order by time. Cross-sectional operations group by time. Composer operations join inputs on (time, asset_id).

Development

uv run ruff check .
uv run python -m 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_core-0.1.1.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

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

bagelquant_core-0.1.1-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

Details for the file bagelquant_core-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for bagelquant_core-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cc132b1cc6cb71dbf09637c015ea8c13b0939bb7bb29a228f63526bb7d65488a
MD5 6a11f58ef78834089e6823db8a2a7ed6
BLAKE2b-256 c4a1badb59c990c093b1b318851ad9de43c7969f7535f94e2ed93a0f48f4f478

See more details on using hashes here.

File details

Details for the file bagelquant_core-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bagelquant_core-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2c088c931ad3bb4c87df9e00b386779ba3809f40774cec10d0d0c87a32ce1146
MD5 7c723fb71b42c170abb9e26e9dc3fb57
BLAKE2b-256 5e7b423a010179fad47ec253c5a6ec3cce912fa45311a81b6ec3bbe63bc2dfb8

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