Skip to content

Implement Total P&L and net deposits for single-account view#46

Open
dbigham wants to merge 5 commits into
mainfrom
codex/implement-total-pl-for-single-account-view
Open

Implement Total P&L and net deposits for single-account view#46
dbigham wants to merge 5 commits into
mainfrom
codex/implement-total-pl-for-single-account-view

Conversation

@dbigham

@dbigham dbigham commented Oct 3, 2025

Copy link
Copy Markdown
Owner

Summary

  • add server-side funding summary logic that walks Questrade activities, applies historical FX conversion, and exposes combined CAD totals for single accounts
  • include net deposits and computed Total P&L in the summary API response for single-account requests
  • surface the new data in the client summary pod with a dedicated net deposits row and ellipsis separator, and update clipboard output

Testing

  • npm run lint

https://chatgpt.com/codex/tasks/task_e_68dfec885694832db5fd2d54287e9723

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Comment thread server/src/index.js
Comment on lines +918 to +923
if (fundingEntries.length) {
collected.push.apply(collected, fundingEntries);
foundFunding = true;
} else if (foundFunding) {
break;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

@dbigham
dbigham force-pushed the codex/implement-total-pl-for-single-account-view branch from 8342127 to c10a76d Compare October 3, 2025 16:55
@dbigham
dbigham force-pushed the codex/implement-total-pl-for-single-account-view branch from ae3726a to cc59929 Compare October 4, 2025 12:06
@dbigham
dbigham force-pushed the main branch 3 times, most recently from c7f2145 to c8636e3 Compare November 15, 2025 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant