Skip to content

Let people see how their investments have moved - #15

Merged
x0ba merged 5 commits into
mainfrom
cursor/investments-trend-chart-6d78
Aug 15, 2026
Merged

Let people see how their investments have moved#15
x0ba merged 5 commits into
mainfrom
cursor/investments-trend-chart-6d78

Conversation

@x0ba

@x0ba x0ba commented Aug 15, 2026

Copy link
Copy Markdown
Owner

Investments was a snapshot: today's total, a donut, a list. You could not see whether the portfolio had moved, and you could not isolate one account or one position.

The tab now has the same daily line as net worth. It opens on total investments. A picker — or clicking a holding or account — focuses the line on that series, with the same range chips (1M / 3M / YTD / 1Y / ALL).

Daily investment snapshots record account and position values so the line can grow. Until those exist, older net-worth account balances fill in the total and per-account views. A single position only has history from the first day we recorded it.

The net-worth chart now uses the same TrendLineChart so the two pages stay in step.

Open in Web Open in Cursor 

Note

Add investment trend chart with range selection and per-account/holding filtering

  • Adds a Trend panel to the investments page with a line chart showing portfolio value over time (1M, 3M, YTD, 1Y, ALL), filterable by account or individual holding via a grouped SearchSelect.
  • Introduces an investmentSnapshots table and writeInvestmentSnapshot to record daily total, per-account, and per-holding values; snapshots are written on Plaid sync and net worth snapshots.
  • Adds an investments.history query that builds a daily value series from investment and net-worth snapshots, with gap-filling and range cutoff logic in convex/lib/investmentHistory.ts.
  • Replaces the bespoke SVG chart on the net worth page with the new shared TrendLineChart component.
  • Behavioral Change: investments.portfolio now limits returned holdings to active investment accounts and computes totalValue per-account (falling back to currentBalance when no holdings exist); upsertHoldings deletes stale holdings after sync.

Macroscope summarized d047622.

The investments tab now has the same daily line as net worth, defaulting to
total portfolio value. A picker (and clicking a holding or account) focuses
the series on one position or account. Daily snapshots record holdings so
that history can grow, and older net-worth account balances fill the gap
until those snapshots exist.

Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bud Ready Ready Preview Aug 15, 2026 7:57am

Comment thread convex/lib/investmentSnapshots.ts Outdated
Comment thread src/routes/app/investments.tsx Outdated
Comment thread src/routes/app/investments.tsx Outdated
Comment thread src/routes/app/investments.tsx Outdated
Comment thread src/routes/app/net-worth.tsx
Comment thread convex/lib/investmentHistory.ts Outdated
Main's last commit left these two markdown files unformatted, and
prettier --check fails the whole pipeline before lint even runs.

Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
Snapshot totals now sum every account (holdings where we have them,
balances otherwise) so a brokerage without positions is not dropped.
Stale account or position filters fall back to the full portfolio.
The daily snapshot retries after a failure and again after UTC midnight.
Range cutoffs clamp the day so March 31 minus one month is February 28,
and changing the series clears the hover tip.

Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
Comment thread convex/investments.ts
Hidden, closed, and non-investment positions were still in the list and
donut after the total started skipping them. All three now use the same
active investment accounts.

Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
@greptile-apps

greptile-apps Bot commented Aug 15, 2026

Copy link
Copy Markdown

Greptile Summary

This update adds investment-history snapshots and trend views for portfolios, accounts, and holdings. The historical fallback now excludes hidden and closed investment accounts, and Plaid synchronization removes positions that are no longer returned before calculating a new investment snapshot.

Confidence Score: 5/5

No blocking failure remains.

The executed account-history calculation excluded hidden and closed accounts, and the holdings reconciliation calculation removed absent positions while preserving positions from other financial institutions.

T-Rex T-Rex Logs

What T-Rex did

  • Executed a targeted fallback-history reproduction with visible, hidden, and closed investment accounts, validating that the prior predicate returned 600 when all three accounts were included and the current predicate returned 100 when only the visible account is included, followed by a repository diff and a TypeScript no-emit typecheck.
  • Ran a two-item holdings reconciliation harness to verify removal of a position absent from the synchronized item, preservation of the other position, and resulting snapshot totals, observing that the prior revision produced 360 and the current revision produced 260, with TypeScript typecheck passing.
  • Compared before and after ID filtering by reviewing logs: the before run included hidden and closed IDs and returned 600, while the after run included only the visible ID and returned 100; the reproduction source and typecheck output were uploaded.
  • Reviewed the code paths that delete through accounts.by_item(itemId) for investment accounts and then write the investment snapshot, and confirmed the investmentSnapshots logic reads remaining holdings and aggregates them; no outstanding lines apply.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (2): Last reviewed commit: "Keep investment history and holdings in ..." | Re-trigger Greptile

Comment thread convex/investments.ts
Comment thread convex/plaidMutations.ts
@macroscopeapp

macroscopeapp Bot commented Aug 15, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

This PR introduces a new investment history/trend feature with a new database table, new API endpoints, new UI components, and integration into existing sync workflows. New features of this scope warrant human review.

You can customize Macroscope's approvability policy. Learn more.

Fallback history now ignores hidden and closed accounts, matching the
snapshots we write, so the line does not drop when those begin.
A Plaid holdings sync also deletes positions that left the item, so a
sold security does not keep inflating the chart.

Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
@x0ba
x0ba merged commit 8e213e8 into main Aug 15, 2026
6 checks passed
@x0ba
x0ba deleted the cursor/investments-trend-chart-6d78 branch August 15, 2026 08:11
cursor Bot pushed a commit that referenced this pull request Aug 15, 2026
Daily snapshots now store mark values so the chart matches the live book, and a quote refresh rewrites today's point. Drop the unused PortfolioChart now that the page uses TrendLineChart.

Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
cursor Bot pushed a commit that referenced this pull request Aug 15, 2026
Keep prior close/open when a quote omits them, show day P&L only when every quoteable holding is covered, treat the oldest quote as freshness, and prefer snapshot history over bars reconstructed from today's quantity.

Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants