Portfolio Snapshot Recalculation
Every time an AssetSnapshot is created, updated, or deleted, Strata automatically recalculates portfolio snapshots. There is no manual “Take Snapshot” button.
How it works
Section titled “How it works”AssetSnapshotService.create/update/delete→ synchronously callsportfolioSnapshotService.recalculateFromDate(date)recalculateFromDate(fromDate)upserts a PortfolioSnapshot forfromDateand updates all existing PortfolioSnapshots withobservedAt > fromDate
Formula
Section titled “Formula”For each date D, the portfolio total is:
totalValue(D) = SUM( latest AssetSnapshot.value per non-disposed asset where observedAt ≤ D )Why synchronous?
Section titled “Why synchronous?”Strata runs on a personal laptop — not a server that stays running 24/7. A cron job or background worker would be unreliable. Synchronous recalculation is simple, testable, and always correct.
Cascade example
Section titled “Cascade example”You add an AssetSnapshot for Jan 1st. Strata recalculates the portfolio total for Jan 1st and all later dates that already have a PortfolioSnapshot (Feb 1st, Mar 1st…). Historical net worth is always consistent with your asset history.