feat: richer pnl reporting + CLI ergonomics polish - #7
Merged
Conversation
Spec for rounding out the CLI's read-views (positions, trades, cash-flows), deeper P&L reporting (expectancy, avg/largest win-loss, max drawdown), a P&L component breakdown (trade profit / commission / swap / fee) driven by the NZ IR3B tax workflow, --by symbol|magic, a --format table|json|csv contract, help/exit-code fixes, a mixed-currency guard, and a deal-time timezone verify-and-document task. Flags-only and no-config stance kept and recorded as a deliberate decision. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… plan Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…t 1) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… guard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Closes coverage gaps flagged by the Task 7 and final code reviews. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Brings the British/Commonwealth English convention and the privacy/audience sweep (PR #6) onto the feature branch, plus the targeted-coverage-gaps tests. Conflict resolutions: - main.go: keep the --version alias and use main's resolveVersion() for the version string (the alias resolves the same way as the subcommand). - cli_test.go: keep both sides' added tests (Phase 1 format/help/mixed-currency tests and main's coverage tests); no name collisions. - e2e_test.go: --version is an alias of version, so its smoke assertion now checks the stable surrounding format rather than the literal "dev". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nomics review Brings the branch-only recent docs into line with the conventions main adopted in PR #6 (British/Commonwealth English; jurisdiction-neutral examples): - reporting spec: drop the NZD-specific reporting-currency example. - new CLI ergonomics & feature review (approved; recommendations accepted, nothing scheduled for build), written under the same conventions. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sequenced TDD plan for the approved ergonomics review's self-contained bundle: drop the --json alias, help examples, richer --version, --quiet, right-aligned numeric columns (manual table writer), currency footer, and sign-based colour. Independent of the unmerged reporting roadmap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both pnl and accounts commands now accept --quiet (-q) to silence staleness and mixed-currency warnings on stderr; errors still print. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace text/tabwriter with a small manual column-width writer so numeric columns (P&L, TRADES, WINS, LOSSES, BALANCE, EQUITY) are right-aligned. Introduces writeTable, colSpec, cell, tone, TableOpts, and signTone; wires opts through PnLTable and AccountsTable for use by later colour and currency tasks. JSON/CSV renderers are unchanged. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…subtotals 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>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7 +/- ##
==========================================
+ Coverage 84.29% 89.14% +4.85%
==========================================
Files 12 13 +1
Lines 452 783 +331
==========================================
+ Hits 381 698 +317
- Misses 64 71 +7
- Partials 7 14 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Resolves staticcheck QF1001; logically equivalent, no behaviour change. Co-Authored-By: Claude Opus 4.8 <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.
Summary
Two complete chunks of the read-views-and-reporting expansion (design:
docs/superpowers/specs/2026-06-15-cli-read-views-and-reporting-design.md).CLI ergonomics & polish bundle — drops the
--jsonalias so--format table|json|csvis the single spelling, addsExamplessections to command help, enriches--versionwith commit and build date, adds--quiet/-qto silence stderr warnings, right-aligns numeric table columns via a manual table writer, shows the account currency in the pnl summary footer, and adds sign-based--coloroutput (auto/always/never with TTY detection honouringNO_COLOR/TERM=dumb).Phase 2 — richer reporting — splits net P&L into trade-profit/commission/swap/fee subtotals across every output, adds expectancy plus average and largest win/loss and a realised-P&L max drawdown to the summary, surfaces all of it in JSON and (rows-only) CSV, and replaces the old single-line summary with a two-group performance/breakdown block in table and JSON output.
Full-precision sums throughout; all display rounding stays in the render layer. README and
CLAUDE.mdare updated to match.Test Plan
go test ./...passes-race)pnl_table.goldendiff for alignment and the two-group blockpnl --format json|csvcomponent subtotals sum to net--color autodetects a TTY and respectsNO_COLOR🤖 Generated with Claude Code