Repository navigation
sim report: word an empty-side R profit factor as insights does (#1000) - #1003
Merged
Merged
Conversation
The edge table's `Profit factor (R)` printed the engine's raw `inf` for an R sample with no losing trade and `0.000` for one of scratches only (or a zero-R win). It now prints `n/a (no losses yet)` / `n/a (no wins or losses yet)` through `undefined_reading` and a new shared `insights.profit_factor_r_reason_of`, whose sides are decided by counting the R sample (`n_wins_r` / `n_losses_r`), not by reading a zero. An all-losses 0 keeps its number; a row with no R stays a bare `n/a`. `BacktestResult` is unchanged; `_r_cell`'s docstring now says the `inf` it keeps is only the degenerate zero-R-loss case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
eaitbrahim
commented
Oct 13, 2026
eaitbrahim
left a comment
Contributor
Author
There was a problem hiding this comment.
Review of #1003 (issue #1000). The wording is right: it matches rules backtest and insights summary for every case. Sides are decided by counting, and BacktestResult and the gates are unchanged. No other surface renders profit_factor_r, and nothing parses the edge table. Three comments below: one minor (layering) and two docstring nits.
…ocstrings (#1000) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #1000
What changed
The
keel simreport's edge table printed the engine's rawProfit factor (R):infwhen the R sample had no losing trade, and0.000when it held only scratches or a zero-R win. Those cells now use the wording thatinsights summary, the Rules page andrules backtestalready use (#986/#998):infn/a (no losses yet)0.000n/a (no wins or losses yet)0.000n/a (no losses yet)0.0000.000(a measured value, unchanged)n/an/a(unchanged)insights.profit_factor_r_reason_of(stats)sits next toprofit_factor_reason_of. It calls the same_profit_factor_reasonon the R sample (n_trades - n_excluded_no_risk) and decides each side by countingn_wins_r/n_losses_r, as the issue asks. It never reads a zero.report._profit_factor_r_cellrenders the cell throughundefined_reading, so the wording has one source and is not copied.BacktestResult/profit_factor_r, the promotion gates andpool_statsare unchanged. The test checks that the engine value is stillInfinityafter rendering.Ruling
Change the display rather than keep
inf. The old_r_celldocstring calledinfdeliberate, so I checked each reason it could still hold:BacktestResult.None of these holds, so the docstring is updated.
infremains only for the degenerate case where both sides have trades but the losing R sums to zero.Tests
test_edge_section_words_an_empty_side_profit_factor_as_insights_does: one test covering all seven rows above plus the pooled row. It also asserts the fixtures' raw engine values first, so no case passes vacuously.cmp.mypy,ruff checkandruff format --checkare clean.🤖 Generated with Claude Code