Adjust net deposit baseline for CAGR start - #103
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 (result.netDeposits.perCurrency) { | ||
| const currentCad = Number(result.netDeposits.perCurrency.CAD) || 0; | ||
| const nextCad = currentCad + baselineEquity; | ||
| result.netDeposits.perCurrency.CAD = Math.abs(nextCad) < CASH_FLOW_EPSILON ? 0 : nextCad; |
There was a problem hiding this comment.
Avoid double counting baseline equity in per-currency totals
When computeNetDeposits adjusts for a CAGR start date it now adds baselineEquity to result.netDeposits.perCurrency.CAD. The per-currency map produced by computeNetDepositsCore already reflects the full CAD funding history (no CAGR pruning), so after combinedCad is increased by the baseline the CAD entry already matches that total. Adding the baseline again inflates the CAD amount by the start-of-period equity and makes per-currency totals no longer align with combinedCad, yielding overstated CAD deposits whenever the adjustment runs. The CAD entry should either be left unchanged or reduced by pre-start flows instead of adding the baseline a second time.
Useful? React with 👍 / 👎.
c7f2145 to
c8636e3
Compare
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68ebbc889bc0832dacb91ab5736fd7f3