Expand description
Multi-run backtest research over yuzu-core.
yuzu-core runs one backtest; the research primitives (factor IC/ICIR,
event study, forward/daily returns) live in yuzu-core::research. This crate
is the layer above: it composes those into multi-run analyses over a
synced data-layout tree — parameter sweeps, grids, walk-forward
selection, and lookahead-bias detection — plus the data-loading glue
that turns a prices/ tree into an EvalContext.
It sits between the data/engine crates and the front ends: pomelo-* /
yuzu-core → yuzu-research → yuzu-cli (or a backend research service).
Everything returns serializable report structs; no CLI, no argument parsing.
One module per analysis (plus the shared [ctx] loader); the public API is
flattened by the re-exports below.
Structs§
- Grid
Spec - A grid file: a spec template plus parameter value lists. Inside
spec, any JSON string equal to"$name"is a placeholder for the parametername. - Lookahead
Leg - Headline metrics of one leg of the lookahead comparison.
- Lookahead
Profile - Decay profile across several shifts. The SHAPE is the diagnosis: a cliff at shift 1 that then flattens = same-close execution dependence; smooth decay = genuinely fast alpha; performance that holds until shift ≈ N then drops = data stamped ~N days ahead of its real publication (fundamentals lookahead); flat = robust to execution timing.
- Lookahead
Profile Point - One shift level of the lookahead decay profile.
- Lookahead
Report - Baseline vs signal-lagged comparison (issue #23). A strategy whose edge
survives executing
shift_dayslater is robust to same-close execution assumptions and same-day data timestamps; one that collapses is living on lookahead (or on fills it could never get). - Sweep
Entry - One row in the sweep leaderboard.
- Walk
Forward Params - Window/selection settings for
run_walkforward. - Walk
Forward Report - Stitched out-of-sample result across all walk-forward windows.
- Walk
Forward Window - One walk-forward window: variant selection happened on the train range, evaluation on the (out-of-sample) test range.
Enums§
- SortKey
- Which metric to rank by in a sweep (also the walk-forward selection metric).
Constants§
- PROFILE_
SHIFTS - Default shift ladder for
run_lookahead_profile.
Functions§
- expand_
grid - Expand a
GridSpecinto one named variant per parameter combination (cartesian product, parameter order = alphabetical by name). Names look like"n=10,thresh=0.5". A grid with no params yields the spec itself. - max_
lookback - Largest window argument anywhere in a spec tree (the
n/nwindow/dfields) — the auto value for walk-forward warmup. - run_
event - Event study (#45): evaluate
specto a 0/1 event panel, take daily returns from close, and average the return path over[-pre, +post]around each event. JSON out; not a strategy run. - run_
factor - Factor report (#45): evaluate
specto a factor panel, formhorizon-day forward returns from close, and return rank-IC / quantile diagnostics as JSON. Not a strategy run — no positions, no NAV.--neutralize-industrydemeans the factor within sector first (needs an industry map in the tree). - run_
lookahead - Run the strategy twice — as-is, and with the position matrix lagged by
shift_days(signals executed N days late) — and report the metric deltas. - run_
lookahead_ profile - Run the strategy once, then re-price it under each
shiftslag and report the metric decay curve. Signals are evaluated once — only the position matrix is shifted per level, so an N-level profile costs ~N NAV loops, not N strategy evaluations. - run_
single - Run one strategy over the full universe, or over an explicit
symbolssubset (None= every symbol underprices/). Scoping changes what every cross-sectional op sees, so a requested symbol missing from the data tree is an error, not a silent drop. Note: a symbol list frozen today implies survivorship bias in a historical run — seedocs/strategy-envelope.md. - run_
sweep - Run many strategy variants in parallel (Rayon) and return a ranked leaderboard.
- run_
walkforward - Walk-forward analysis: roll a
train_days/test_dayswindow (in trading days) over the close panel’s date axis; in each window run every variant on the train slice, pick the best bysort_by, run it on the test slice, and chain the out-of-sample equity segments into one curve.