01 / The Portfolio App
A portfolio tracker built across four backend services.
A working portfolio tracker for virtual accounts and shared households. It records transactions, calculates holdings, valuation, P&L and time-weighted returns, and tracks allocation drift using live prices.
- Status
- Functional staging
- Date
- August 2026
- Role
- Creator
- services
- 4 deployed backend services
- contracts
- REST, gRPC, codegen
- platform
- k3s, Helm, Terraform

Four measured results from the current build.
Query path
347 ms1.05 ms
330× faster
TimescaleDB continuous aggregates cut a measured six-symbol, 1.55-million-row price-history query while returning all 546 chart points identically.
Idle cost
3.1M writes0 writes
per month, idle
Quote caching moved from supply-pushed polling to demand-filled write-back, so staging stops writing to Redis when nobody is reading.
Quote fan-out
2H calls2 commands
H = holdings
A sparse GetQuotes gRPC batch resolves up to 256 symbols through one MGET and one set-based Timescale query instead of one call per holding.
Token rotation
6 commands1 command
6× fewer
An atomic Lua script replaced six refresh-token mint operations, taking full issue and rotation flows from 8/9 commands down to 3/4.
Technical details
- BOUNDARIES
FastAPI handles the main product workflows. Rust handles quote ingestion and calculation-heavy work. The public API uses OpenAPI; services communicate 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. Other services validate them from the public JWKS and receive audience-scoped credentials that expire after 60 seconds.
- 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.
From tracking value to explaining risk and tax.
Statistics and risk
I’m adding rolling volatility, drawdown, Sharpe and Sortino ratios, benchmark beta, historical VaR, correlations, Monte Carlo projections, and factor exposure. Each calculation will be checked against reference fixtures before it appears in the Risk interface.
UK capital gains
A Rust tax service will implement HMRC same-day matching, the 30-day bed-and-breakfast rule, and Section 104 pooling, with worked-example and property tests plus tax-year reports exported to R2.
Production connections
The next step after staging is direct Trading 212 and IBKR sync, production OAuth, and clearer failure states.




