trader.replay.bootstrap module¶
A date-clustered block bootstrap for the edge’s confidence interval.
Rows on one decision date share a market factor — nine symbols all traded on the same news day are not nine independent observations — so this resamples dates, not rows. A per-row t-test would treat correlated rows as independent and understate the interval.
- class trader.replay.bootstrap.Interval(low, high, point, draws, seed, resamples_used)[source]¶
Bases:
objectA percentile interval from a block bootstrap, with its own provenance.
- Parameters:
low (float | None)
high (float | None)
point (float | None)
draws (int)
seed (int)
resamples_used (int)
- low: float | None¶
- high: float | None¶
- point: float | None¶
- draws: int¶
- seed: int¶
- resamples_used: int¶
- trader.replay.bootstrap.date_clustered_interval(rows, statistic, *, draws=10000, seed=7, confidence=0.95)[source]¶
Resample decision dates with replacement and interval statistic.
Each draw picks as many dates (with replacement) as the row set has distinct dates, and takes every row on each picked date — so a draw with two dates of three rows each always has six rows, never four: the unit being resampled is the date, not the row.
A draw whose statistic returns None (e.g. no acting rows in that resample) is skipped rather than counted as zero, which would drag the interval toward zero and understate the uncertainty. resamples_used reports how many draws actually contributed, so a degenerate sample is visible rather than silently averaged away.