Skip to main content

bagelquant-bt

bagelquant-bt provides typed signal composition, evaluation, portfolio-policy application, performance metrics, and Plotly visualization.

The public investment flow is:

AlphaValue Panel -> SignalComposer -> SignalPanel -> SignalDatePolicy
-> ScheduledSignal -> ExecutionPolicy -> PortfolioPolicy -> Weights Panel

Public backtests require a core SignalPanel. Ordinary panels, raw DataFrames, and direct weights cannot enter the backtest API. Prices remain explicit long-form Polars data with time, asset_id, and price.

from bagelquant_core import IdentitySignalComposer, Panel
from bagelquant_bt import (
    BacktestConfig,
    MissingSnapshotAction,
    SignalAnchor,
    SignalDatePolicy,
    compose_signal,
    run_signal_backtest,
)

alpha_value = Panel.from_domain(alpha_frame, domain, name="quality")
policy = SignalDatePolicy(
    id="month_end",
    frequency="monthly",
    anchor=SignalAnchor.LAST_TRADING_DAY,
    missing_snapshot=MissingSnapshotAction.PREVIOUS_IN_PERIOD,
)
signal = compose_signal(
    {"quality": alpha_value},
    IdentitySignalComposer(),
    calendar,
    policy,
)
result = run_signal_backtest(
    signal,
    prices,
    calendar,
    policy,
    config=BacktestConfig(initial_capital=1_000_000),
)

run_signal_evaluation computes execution-to-execution IC, quantiles, spread, TOP N, lag, and IC-decay diagnostics from ScheduledSignal. Sparse or monthly signals rebalance only on their snapshot dates; positions are held between snapshots. OrderSizingPolicy reserves the later target-weight-to-order boundary, but quantity sizing is not implemented yet.

During an asset-specific price gap, its holding is frozen at the last observed price. The gap sessions have zero return and the cumulative move is recognized when a new price appears.

Development

uv run ruff check .
uv run python -m pytest

Metadata

Release files for bagelquant-bt 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bagelquant-bt 0.2.0
File Size Uploaded
bagelquant_bt-0.2.0.tar.gz 60.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bagelquant-bt 0.2.0
File Interpreter ABI Platform
bagelquant_bt-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 132.1 kB

Release files / bagelquant_bt-0.2.0.tar.gz

Download URL bagelquant_bt-0.2.0.tar.gz
Size 60.9 kB
Tags Source
SHA-256 checksum
How to use checksums
122ad45145a7e5c62bd10f1d57b9c77d21a9c039f3ec02dc60132fc2d2145aaa
BLAKE2b-256 checksum
How to use checksums
32a48e0b815966f268458d5aa9cda4f9e172b9ac3955014577b0980d7faa5310
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / bagelquant_bt-0.2.0-py3-none-any.whl

Download URL bagelquant_bt-0.2.0-py3-none-any.whl
Size 71.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00bc266b2fd21bb1b20f734e1dca97b2080e7e9b8235ef237a6f2795cc6d9074
BLAKE2b-256 checksum
How to use checksums
dff35867365ed43e510a08210cbb15b30b261fcb1ff6b7ea10e07ead7e3f3eae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page