Mark investments from Alpaca between Plaid syncs - #14
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis change adds Alpaca-backed investment marks, daily price history, scheduled refreshes, and investment snapshots while retaining Plaid as the source of truth for holdings. Focused execution confirms that when Plaid restates a security ticker, stale quote and history fields are cleared and reconciliation continues to use the mark displayed before the ticker replacement. Confidence Score: 5/5No blocking failure remains. Focused ticker-restatement execution, the market regression suite, and TypeScript type checking confirm the corrected market-state reset and reconciliation behavior.
What T-Rex did
Reviews (4): Last reviewed commit: "Address Macroscope findings after the #1..." | Re-trigger Greptile |
ApprovabilityVerdict: Needs human review This PR introduces a new Alpaca integration feature with external API calls, new database schema (tables and fields), a 15-minute cron job, and changes to how portfolio values are calculated. New features of this scope warrant human review. You can customize Macroscope's approvability policy. Learn more. |
Brokerage snapshots stay on Plaid's cadence. Between those syncs, Investments now pulls live marks and daily history from Alpaca so the portfolio can move without another Link refresh. When Plaid does come back, quantity and cost basis are restated and the gap versus the market mark is recorded. Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
Keep quote timestamps aligned with the price source, isolate backfill failures from committed marks, chunk bar writes, and stop emitting a partial portfolio before every ticker has a close. Also clamp month-end ranges, recover from a failed auto-refresh, and drop a stale holding filter. Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
A renamed instrument kept the old live price and history flags, so the portfolio could mark META with FB's quote until the next refresh. Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
Clearing live price on a ticker rename happened before previousMarkValue was computed, so the gap was measured against the new close instead of the book we actually showed. Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
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>
a5993d8 to
4ebba0a
Compare
CI eslint rejects inline type specifiers on the investment history import. Co-authored-by: danielxu0307 <danielxu0307@gmail.com>
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>
Investments already record a daily trend from Plaid snapshots. Between those syncs the book sat on yesterday’s brokerage print.
This keeps Plaid as the source of truth for quantity and cost, and marks the book from Alpaca Market Data in between. When a brokerage account resyncs, the gap versus the prior mark is recorded on the holding. Position history prefers the snapshot series from #15; daily bars are only a fallback when that series is empty.
After #15
Rebased onto
mainafter “Let people see how their investments have moved.” The page keeps that PR’s trend chart, account/position filter, and snapshot history. Alpaca supplies live marks, day P&L, bar backfill, and reconcile-on-Plaid-sync. Daily snapshots are now written at mark value so the chart matches the live book.Setup
Paper keys work. Without them the rest of the app is unchanged.
Checks
pnpm test— 14 passing (convex/lib/market.test.ts)pnpm typecheck— cleanNote
Add Alpaca market data integration to mark investment holdings between Plaid syncs
securities,securityBars, andholdingReconcilesschema tables.Macroscope summarized 81d34b6.