feat(pnl): group by symbol or magic with uniform group/group_by output - #8
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…agic cuts Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…on cuts Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment/usage-string only; no behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
==========================================
+ Coverage 89.14% 89.39% +0.24%
==========================================
Files 13 13
Lines 783 858 +75
==========================================
+ Hits 698 767 +69
- Misses 71 76 +5
- Partials 14 15 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Split the pnl Commands wall-of-text into a one-line-per-flag reference and a separate Notes section (dates/bucketing, P&L components, max drawdown, mixed currencies, output shape); drop the bold mini-headings. No behaviour change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Now covered globally for all repos via the user's global writing-style rule, so the project-level note is no longer needed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Remove the "just works" phrasing from the "One file in, answers out." bullet; state the snapshot env var/flag and the command plainly instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
tanem
force-pushed
the
feat/cli-phase-3-pnl-grouping
branch
from
June 17, 2026 18:42
06201ec to
e799b18
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
Phase 3 (part 1) of the read-views-and-reporting expansion (plan; spec sections 3.1/3.2 plus parts of 1.2/1.3). It generalises the
pnlgrouping dimension.--bynow acceptssymbolandmagicalongsideday|week|month. Time cuts are unchanged — per-account rows plus a combinedALLrow per period.symbolandmagicinstead aggregate across all in-scope accounts, one row per symbol or magic number, with no per-account orALLrow; the first table column becomesSYMBOL/MAGICand theACCOUNTcolumn is dropped. Magic groups sort numerically.Every cut now emits a uniform shape: JSON/CSV rows carry
group(the period date, symbol, or magic) andgroup_by(the--byvalue), replacing the oldperiodfield — a deliberate pre-1.0 break.accountis the login for per-account time rows andnull/empty for the combined time row and for every symbol/magic row.Because a
symbol/magiccut sums across accounts, it refuses (stderr, exit 1, not silenced by--quiet) when the in-scope accounts span more than one currency — narrow--accountsto a single currency. Internally,aggregate.Row.Periodis renamed toRow.Group, the summary is accumulated per-deal so totals are independent of the grouping path, and a newaggregate.AccountsInScopeexposes the contributing logins for the currency guard. README andCLAUDE.mdare updated.Built with subagent-driven development: a fresh implementer per task, an independent review after each, and an opus whole-branch review at the end (verdict: ready to merge, no Critical/Important findings).
Test Plan
go test ./...passes-race) and the lint jobgo vetandstaticcheckclean locallypnl_table.goldenbyte-identical tomain(no regression to existing output)AccountsInScoperange filtering, mixed-currency refusal, empty account columns, droppedACCOUNTcolumn, newpnl_table_symbol.goldenpnl --by symbol/magic --format json|csvcarriesgroup/group_byand omits per-account/ALLrows (asserted byTestPnLByMagicJSONGroupBy,TestPnLCSVSymbolEmptyAccountColumns)🤖 Generated with Claude Code