fix(backtest): put leftover WFO runners on the canonical clock - #187
Merged
Conversation
Advertised run_wfo.py still used 30-day months, inclusive test_end fetches, and legacy_v1 fills while the quality bar only covered autopilot/search. Wire it, the short-comparison script, and entry overlap to calendar windows, half-open fetch bounds, and execution_parity_v2. This is not a live-go. Co-Authored-By: Grok 4.6 <noreply@x.ai> Co-authored-by: Yderf <Trujillofa@users.noreply.github.com>
Trujillofa
marked this pull request as ready for review
September 1, 2026 15:07
Owner
Author
|
Refreshing this PR onto current main after the Sharpe Ratio parser fix. Reopening the same PR; not a replacement. |
run_wfo.py matched Sharpe: and silently filled 0.0 into every fold. Parse the actual Sharpe Ratio: label and lock it with an e2e test. Co-Authored-By: Grok 4.6 <noreply@x.ai>
Trujillofa
force-pushed
the
cursor/wfo-canonical-clock-c2d3
branch
from
September 1, 2026 15:09
788f6f6 to
274784d
Compare
Empty commit so pull_request.synchronize runs against 7dd22b1. Co-Authored-By: Grok 4.6 <noreply@x.ai>
Trujillofa
force-pushed
the
cursor/wfo-canonical-clock-c2d3
branch
from
September 1, 2026 15:11
274784d to
788f6f6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Advertised WFO still used a different clock than canonical autopilot.
scripts/run_wfo.py(and leftover comparison/overlap callers) built 30-day months, fetched inclusivetest_endbars, and inheritedlegacy_v1signal-close fills. The quality bar only locked autopilot/search onto calendar + half-open + v2.Type of Change
Problem
After #185,
experiment_autopilotand the search CLIs translate half-open WFO windows before the inclusive reader. The documentedrun_wfo.pypath did not:timedelta(days=months * 30)instead of calendarbuild_wfo_windowstest_endintofetch_range(time <= end), so a v2 next-open fill on the exclusive boundary can complete a trade a half-open window would leave unfilled--execution-profile, so it inheritedrun_backtest.pydefaultlegacy_v1analyze_entry_overlap.pyalso passed rawwindow.test_endand defaulted tolegacy_v1. Paper-vs-backtest overlap could therefore disagree with gated WFO.Approach
run_wfo.py: calendar windows,wfo_inclusive_fetch_bounds(), defaultexecution_parity_v2. Honest docstring: fixed-config OOS, not parameter optimization.run_wfo_short_comparison.py: same clock + live-go refusal.analyze_entry_overlap.py: same fetch bounds + v2 fills + live-go refusal.oos_fetch_windowsequals canonical bounds + 30-day vs calendar divergence).BACKTEST_AND_WFO.md,RESEARCH_FRAMEWORK.md,CLAUDE.md) point gated WFO at autopilot.Test evidence
1404 passed locally. CI lint already green on this SHA; test job was still running at PR update.
Residual risk
run_backtest.pysingle-window default remainslegacy_v1for old-run reproducibility.run_wfo.pystill shells out torun_backtest.py(needs DB for a real run). Clock/profile are now explicit.return_pctdenominator (June audit D/E) are unchanged.live: no
No paper→live flip, size change, kill-switch change, or Binance keys.
Testing
uv run pytest -v(1404 passed)uv run ruff check .(CI uses ruff, not black)uv run ruff format --check .Checklist