What's new in 0.16¶
A focused release on the Wealth page: a reworked Asset Allocation section, a new Settings admin page, and a sizeable performance overhaul that makes the page render 12–25× faster.
Highlights¶
- Reworked Asset Allocation on the Wealth page. The table is now primary and always visible, with inline weight bars, a stable per-class colour palette shared with the chart and donut, and click-to-expand rows that group contributing accounts by owner and commodity.
- Current-month donut paired with the table (net wealth in the centre), plus a full-history area chart spanning every month with data — auto-scaled monthly or quarterly ticks based on span, and a % / CHF axis toggle.
- Wealth page renders 12–25× faster thanks to a bulk balance preload that replaces the previous per-month SQL storm.
Wealth & Asset Allocation¶
- Single-line "Total Assets" replaced by a three-line footer: Gross assets, Liabilities (only when nonzero, in danger colour), and Net wealth.
- Expanding an asset class now lists contributing accounts grouped by (owner, balance commodity), with both the commodity-native total and the base-currency conversion. Multi-currency accounts (e.g. Revolut with CHF + USD sub-balances) produce one row per actual commodity.
- The area chart now spans your full data history (earliest balance or statement entry to last completed month), not just the selected year. It auto-fills zero values for asset classes that hadn't yet appeared so Plot interpolates smoothly when a new class shows up (e.g. a property purchase).
- New
wealth_tracking_startsetting clamps the chart's earliest month — useful when early data only covers a subset of your accounts (e.g. one bank's statements were imported before others were tracked). - Donut and table no longer blank out when any asset account is missing a balance for the queried date: those accounts are skipped from the allocation, and external payables with no balance fall back to zero liabilities instead of
None. - Fixed an off-by-one in the chart's earliest-month detection that skipped the very first month of balance-based data.
- Stray
amount=0placeholder rows (date-input bugs, half-created accounts) no longer drag the chart back to year 1 AD.
Settings admin page¶
- New
/admin/settingspage surfaces three previously hard-to-edit settings: wealth_tracking_start— no UI at all before this release.backup_path— moved here from/admin/backups, which now shows it read-only with an "Edit in Settings →" link.base_commodity— links into the existing dialog.
Custom month picker¶
- Firefox renders
<input type="month">as a plain text field, which made the month inputs unusable there. A Stimulus-based month-picker widget now replacestype="month"everywhere the app used it —wealth_tracking_start, the account-validity dialog, and the exchange-rates download dialog. It submitsYYYY-MM-01so server-side parsing is unchanged.
Performance¶
The asset-allocation chart and wealth month strip both looped per-month over the per-account fetch_account_balances pipeline, issuing ~140 SQL calls (chart) and ~60 SQL calls (strip) per page load, each with multiple per-account sub-queries. They've been replaced with one shared bulk preload of every source table (balances, statement_entries, empty_statements, postings, exchange_rates) and a Python-side derivation of every (account, month, commodity) value. The /wealth route now builds one preload and shares it across the strip and the chart.
Measured on the demo DB (median of 5 runs):
| Path | Owner | Before | After | Speedup |
|---|---|---|---|---|
| Combined wealth route (strip + chart) | all (0) | 205 ms | 8.4 ms | 24.5× |
| Chart alone | all (0) | 141 ms | 7.0 ms | 20× |
| Strip alone | all (0) | 72 ms | 6.2 ms | 12× |
| Combined wealth route | per-user | 20–108 ms | 4–7 ms | 5–16× |
Each balance_calculation_mode branch is mirrored bit-for-bit against the existing fetcher; parity is verified on the demo DB across all owner IDs and years. The legacy fetch_account_balances path is untouched and still used by per-account-type pages, the wealth-month detail view, and period balance reports.
Under the hood¶
- New tests in
tests/test_asset_allocation.pycover the behaviours added across this release: missing-balance handling, external-payable fallback,_earliest_data_monthfiltering and clamping, and chart gap-filling. - Demo seed now exercises real estate and liabilities — a joint CHF 1M flat purchase mid-2024 with a CHF 300k down payment drained from both partners' savings, plus a CHF 700k mortgage amortising CHF 3k/quarter.
tests/helpers.api_create_accountnow accepts anaccount_typeso tests can create real-estate and payable accounts.