You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
insights: an all-wins profit factor reads "—" (unknown) on Rules but "Infinity" in the CLI #979
Found while reviewing PR #975 (round 1, O2). This is not new: it was there before that PR.
What happens. A rule with winning trades and no losing ones has an infinite profit factor (stats.summarize returns Decimal("Infinity") when gross loss is 0 and gross profit is above 0).
keel insights summary prints profit_factor=Infinity.
The Rules view shows "—" with state unknown, because payload.ratio() turns any non-finite value into absent().
The gate card's realized_rr on an all-wins record shows "—" too. The CLI says rr=n/a (no losses yet) there.
Why it matters. This is the reverse of #965. Instead of an unknown shown as zero, a known value (no losses so far) is shown as unknown, and the page and the CLI disagree.
Fix (display only).
On the page, render an infinite profit factor as something like "∞ (no losses yet)" with a neutral state, not unknown.
In the CLI, pick one wording for both places, for example profit_factor=n/a (no losses yet) to match rr.
Gate verdicts are unaffected: check_floors reads the engine's own values.
Test. An all-wins record's profit factor reads the same reason on the page and in the CLI, and its page state is not unknown.
A related case, from PR #975 review round 2 (O2): when every closed trade is a scratch (gross profit = gross loss = 0), stats.summarize returns profit_factor = Decimal(0) (stats.py:205-210). The CLI then prints profit_factor=0.00 and the Rules view shows "0.00", but 0/0 is unknown, not zero. An all-losses profit factor of 0.00 is a real measurement; an all-scratch one is not. Worth fixing in the same display change.
Activity
eaitbrahim commentedon Oct 12, 2026
A related case, from PR #975 review round 2 (O2): when every closed trade is a scratch (gross profit = gross loss = 0),
stats.summarizereturnsprofit_factor = Decimal(0)(stats.py:205-210). The CLI then printsprofit_factor=0.00and the Rules view shows "0.00", but 0/0 is unknown, not zero. An all-losses profit factor of 0.00 is a real measurement; an all-scratch one is not. Worth fixing in the same display change.test(promotion): pin the _rr_reason guards (#979, #980)
insights+promotion: an empty sample side reads as empty, not as Infin…