Implement Total P&L and net deposits for single-account view#46
Implement Total P&L and net deposits for single-account view#46dbigham wants to merge 5 commits into
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 (fundingEntries.length) { | ||
| collected.push.apply(collected, fundingEntries); | ||
| foundFunding = true; | ||
| } else if (foundFunding) { | ||
| break; | ||
| } |
There was a problem hiding this comment.
Continue fetching historical funding beyond first empty month
The backward scan in loadFundingActivities breaks whenever a 30‑day window contains no funding after at least one funding window has been seen (else if (foundFunding) break). That means any gap of a month or more between deposits causes the loop to stop at the first deposit it encounters and ignore all earlier contributions. Since real accounts commonly have sporadic deposits, the computed netDeposits and the derived Total P&L override will usually include only the most recent month of funding history, producing incorrect totals. The scan should continue until there are no activities returned at all or until an explicit historical cutoff is reached rather than exiting after the first empty window.
Useful? React with 👍 / 👎.
8342127 to
c10a76d
Compare
ae3726a to
cc59929
Compare
c7f2145 to
c8636e3
Compare
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68dfec885694832db5fd2d54287e9723