Skip to content

Add account performance analysis dialog#44

Open
dbigham wants to merge 7 commits into
mainfrom
codex/add-total-pl-and-cagr-calculation-feature-1qb531
Open

Add account performance analysis dialog#44
dbigham wants to merge 7 commits into
mainfrom
codex/add-total-pl-and-cagr-calculation-feature-1qb531

Conversation

@dbigham

@dbigham dbigham commented Oct 1, 2025

Copy link
Copy Markdown
Owner

Summary

  • add account performance API endpoint that aggregates executions, transfers, and price history to build timeline data
  • surface a “View performance” workflow that fetches the new endpoint, opens a dialog, and renders CAGR/P&L metrics with a chart
  • allow configuration of transferred holdings via accounts.json so synthetic events can be represented in performance calculations

Testing

  • npm run lint (client)

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

@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 +1146 to +1148
const totalPnl = (endValue + totalWithdrawals) - (startValue + totalContributions);
const investedBase = startValue + totalContributions;
const totalReturn = investedBase > 0 ? totalPnl / investedBase : null;

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 Avoid double-counting contributions in P&L totals

The totals calculation treats the first timeline value as already-invested capital (startValue) and then subtracts the same trades again through totalContributions. Because the earliest timeline entry is computed after the first day’s executions, any buys that created that position are counted twice in (endValue + totalWithdrawals) - (startValue + totalContributions), which can yield negative P&L for an otherwise profitable account. The function needs either an initial zero-value entry before the first trade or to exclude cash flows occurring on/before that first timeline date when building totalContributions/totalWithdrawals.

Useful? React with 👍 / 👎.

@dbigham
dbigham force-pushed the codex/add-total-pl-and-cagr-calculation-feature-1qb531 branch from c5378fa to 3c6855b 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