Add return breakdown dialog with PnL history chart - #61
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| if (aggregateTotals.cashFlowsCad.length > 0) { | ||
| const performanceSummary = buildFundingPerformanceSummary( | ||
| aggregateTotals.cashFlowsCad, | ||
| Number.isFinite(aggregateTotals.totalPnlCad) ? aggregateTotals.totalPnlCad : null, | ||
| Number.isFinite(aggregateTotals.totalEquityCad) ? aggregateTotals.totalEquityCad : null, |
There was a problem hiding this comment.
Aggregated cash flows mis-handle per-account final equity entries
The all‑accounts summary feeds every account’s cashFlowsCad directly into buildFundingPerformanceSummary. Those per‑account arrays already contain a final positive entry representing that account’s current equity. When concatenated, all but one of those positive entries land in the “contributions” slice inside buildFundingPerformanceSummary, where they are negated and treated as withdrawals. As soon as more than one account is selected, the resulting net‑deposit totals and PnL history become incorrect (final equity for account A is subtracted from the aggregate deposits). The aggregate cash flows should either strip per‑account terminal entries and add one combined terminal balance, or the builder should ignore positive entries before the final one; otherwise the rendered return chart and trailing return numbers for “All accounts” are wrong.
Useful? React with 👍 / 👎.
c7f2145 to
c8636e3
Compare
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68e279c70b10832d81a0e98a22887154