-
Notifications
You must be signed in to change notification settings - Fork 0
fix(backtest): freeze cost book, rank on train, refuse live-go #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2937503
fix(backtest): freeze cost book, rank on train, refuse live-go
cursoragent 39194a5
fix(backtest): close review integrity gaps
Trujillofa 446e9ae
fix(backtest): keep WFO boundary bar out of train
Trujillofa 3f70958
fix(backtest): make the live-go refusal reachable on research CLIs
claude dbdae12
fix(backtest): print the selection score the search ranks on
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Canonical backtest and WFO | ||
|
|
||
| Research replay lives in `src/backtest/*`. It is **not a live-go**. A passing | ||
| WFO does not enable `trading_execution.enabled`, flip `test_mode`, or place | ||
| orders. Paper → live is a separate human config + deploy step. | ||
|
|
||
| ## How to run | ||
|
|
||
| Single window (historical simulator only): | ||
|
|
||
| ```bash | ||
| uv run python scripts/run_backtest.py \ | ||
| --symbol SOLUSDT --timeframe 1h \ | ||
| --start 2024-01-01 --end 2024-06-01 \ | ||
| --config config/settings.yaml \ | ||
| --execution-profile execution_parity_v2 | ||
| ``` | ||
|
|
||
| Walk-forward + gates (canonical WFO): | ||
|
|
||
| ```bash | ||
| uv run python scripts/experiment_autopilot.py \ | ||
| --config config/settings.yaml \ | ||
| --symbol SOLUSDT --timeframe 1h \ | ||
| --start 2024-01-01 --end 2026-01-01 \ | ||
| --train-months 6 --test-months 3 \ | ||
| --execution-profile execution_parity_v2 | ||
| ``` | ||
|
|
||
| `--execution-profile execution_parity_v2` is closed-bar signal / next-open fill. | ||
| `legacy_v1` fills at the signal-bar close and is kept only for old-run | ||
| reproducibility. Autopilot defaults to v2. | ||
|
|
||
| There is no `--live`, `--promote`, or `live_go` on these paths. Passing one | ||
| is refused. | ||
|
|
||
| ## Clock | ||
|
|
||
| Bar `time` is the **open**. A `1h` bar at `10:00` is `[10:00, 11:00)`. | ||
| Strategies see completed OHLCV for that bar. v2 queues the fill for the next | ||
| open. Unknown timeframe labels raise; they are not treated as 1 minute. | ||
|
|
||
| ## Cost book | ||
|
|
||
| Frozen snapshot: `fee_rate` (commission / side of notional), `slippage_pct` | ||
| (per-side price concession = spread + slip), `futures_funding_rate` (8h | ||
| settlement fraction), `fixed_notional_usdt` (USDT size cap; 0 = uncapped). | ||
| Defaults are 4 bps fee and 2 bps slip per side. Mutation after engine | ||
| construction does not change fills. | ||
|
|
||
| ## Ranking | ||
|
|
||
| Candidate ranking uses the **first train window** only. Holdout / WFO test | ||
| metrics are reported, not used to order names. `scripts/run_wfo_sweep.py` is | ||
| not a selection tool (it never applied `param_grid`). | ||
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.