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.0.tar.gz (24.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.0-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bagelquant_core-0.1.0.tar.gz
  • Upload date:
  • Size: 24.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.0.tar.gz
Algorithm Hash digest
SHA256 6366a4882a61872b83859372438ec30ead6b71025512714acb9a927ab793c238
MD5 f84e7478061c11faff1c8b45d70d3b5f
BLAKE2b-256 0dbf3a4d323e93e58c34dfe0c3d6b7d2ffba813d18594f03098628feb2598ed6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bagelquant_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fdecc8a11b48d25fa97fe859b4a99d4760b61bf041d0c1fc65e9d42d0f6bcc5
MD5 80fa7156e00d0f1800a33bb312fc4b65
BLAKE2b-256 40d6db56d7d1687cf11346e77b87665624eca6f07d3101bbf1c5990b01c7b890

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