Repository navigation
fix(report): a sold position keeps its weekly contribution without a closing quote - #107
Merged
Merged
Conversation
…ithout a closing quote The collector stops quoting a symbol once it is sold, so a position closed during the week normally has no end-of-week quote. The contribution arithmetic skipped every trade without one, so a full sale printed $0.00 and a buy-and-sell round trip vanished from the contributor list while the week's total was right (1.7.4 re-audit, N05 remaining branch). The contribution is now computed from the identity directly, end value - start value + proceeds - outlays, where an endpoint with no shares is worth zero and needs no quote. A held position that lacks its quote is printed as n/a (and is already named under the missing-price warning), never as $0.00. The price-move / trade-P&L breakdown is still shown when both quotes exist; it is algebraically the same figure, so the round-4 cases are unchanged. Tests (whole main(), real loader, no closing quote for the sold symbol): full sale, round trip, a loss with fees, forward and reverse splits before the sale, and a held position with a missing end quote showing n/a; each priced case asserts sum(contributions) == delta(securities + cash). Also: CLAUDE.md no longer says app/tests/ is "only FIFO coverage". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 7 |
| Duplication | 0 |
AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.
TIP This summary will be updated as you push new changes.
Merged
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
Re-audit finding N05, remaining branch (round 5, task 29). The collector quotes only symbols with a positive quantity or a watchlist flag, so a position closed during the week normally has no end-of-week quote. The contribution loop skipped every trade without one and zeroed the price move, so a full sale printed
$0.00and a buy-and-sell round trip vanished from the contributor list while the week's total was right.end value − start value + proceeds − outlays, fees once, week's units, trades after the baseline day. An endpoint with no shares is worth zero and needs no quote.n/awith the share count and which endpoint is unpriced, and is already named under the missing-price warning; it is never$0.00.CLAUDE.mdno longer describesapp/tests/as "only FIFO coverage" (audit maintenance note).Tests (
app/tests/test_report_weekly_split.py, wholemain(), real loader, no closing quote for the sold symbol)Full sale ($100, the audit's case), round trip ($25, stays in the list), a loss with fees (−$53), forward and reverse splits before the sale ($100 / $8), and a held position with a missing end quote (
n/aline, the warning names it, no$0.00). Every priced case asserts Σ contributions == Δ(securities + cash). All round-3/4 weekly tests are green (27 in the file).Smoke-ran the report read-only against production: identical output to 1.7.4 for this week (no positions were sold).
Pre-commit: 310 MCP / 659 app / 89 tools passed.
🤖 Generated with Claude Code