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)
| File | Size | Uploaded | |
|---|---|---|---|
| bagelquant_bt-0.2.0.tar.gz | 60.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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
|