01 / The Portfolio App
A portfolio tracker built across seven backend services.
A working portfolio tracker for individual and shared household accounts. It records multi-currency transactions or imports them from CSV, values holdings from live prices, and reports P&L, time-weighted returns, risk against a chosen benchmark, and UK capital gains.
- Status
- Functional staging
- Date
- October 2026
- Role
- Creator
- services
- 7 deployed backend services
- contracts
- REST, gRPC, codegen
- platform
- k3s, Helm, Terraform


- Downside, p10
- $1,347,334
- Median, p50
- $1,731,944
- Upside, p90
- $2,237,510

Capital gains matching, step by step
HMRC helpsheet HS284 (2025), Example 2. HMRC's answer is a loss of £1,850.
Sold 4,000 for £6,000. HMRC decides which shares were sold, in a fixed order.
- 30-day rule, bought 11 Sep 2024500£850
- Section 104 pool3,500£7,000
- Proceeds
- £6,000
- Allowable cost
- £7,850
- Gain
- −£1,850
Pool at the end of the day: 6,000 shares, £12,000 cost
Engine output computed at build time.
Six measured results from the current build.
Select a result to see where it happened. Hover, tab to or tap a service to trace it.
Seven services behind one gateway. Python owns the ledger, risk and broker sync; Rust owns quotes, calculations and tax.
Technical details
- BOUNDARIES
FastAPI services run the gateway, ledger, risk analytics and broker sync. Rust services handle quotes, portfolio calculations and UK tax matching. The public API uses OpenAPI; the Rust services are reached over gRPC using protobuf.
- CORRECTNESS
Transactions are the source of truth. Positions and daily NAV can be rebuilt from the ledger, and a dirty watermark queues recalculation when an older transaction changes.
- SECURITY
The gateway signs tokens with Ed25519. Internal Python services validate them from the public JWKS and accept audience-scoped service tokens that expire after 60 seconds. Broker credentials are encrypted at rest with AES-256-GCM.
- DELIVERY
Terraform provisions Hetzner and Cloudflare. Helm deploys the services to k3s after database migrations, and Playwright checks the deployed commit before it is marked ready on staging.
Risk and tax are live on staging. Broker sync is next.
Risk analytics, shipped
The Risk view reports volatility, max drawdown, 95% historical VaR and CVaR, Sharpe and Sortino ratios, and beta against one of five benchmarks, with MSCI ACWI as the default. An advanced tier adds a correlation matrix, Fama-French five-factor and momentum exposure, and a 10,000-path Monte Carlo projection. The worst-case full report, 50 instruments over 1,299 trading days, computes in 62.4 ms.
UK capital gains, shipped
A stateless Rust tax service applies HMRC same-day matching, the 30-day bed-and-breakfast rule and Section 104 pooling. It is checked by property-based tests and HMRC manual worked examples, and it matched an independent calculator exactly on four cases. Tax-year reports export as PDFs archived to R2.
Broker connections, next
The Interactive Brokers connector is built and deployed but switched off until it has been checked against a real statement. Trading 212 sync and production Google and Apple sign-in follow.








