Regima
A user-owned portfolio construction and backtesting platform for comparing explicit investment strategies with deeper portfolio analytics.
Summary
Regima is a working MVP for constructing portfolios, applying investment strategies, and reviewing their historical behaviour.
Many backtesting tools provide performance charts without making the underlying strategy sufficiently explicit. Regima starts from the opposite direction: the user selects a defined portfolio construction approach and receives analytics that help explain how the portfolio behaved.
Status
Working MVP
The core portfolio optimisation and backtesting functionality is implemented. Additional work remains around statistical analysis, product breadth, and the surrounding user experience.
The problem
Backtesting tools often make it easy to produce a performance chart, but harder to understand what generated the result. A portfolio may be presented with historical returns and risk measures without clearly communicating the allocation framework, the assumptions behind it, or how it should be compared with an alternative.
This makes it difficult to distinguish between a strategy-driven portfolio and a collection of analytics assembled after the fact.
Regima is designed to make the portfolio construction method explicit and connect it to the resulting performance, risk, and attribution analysis.
The original concept also considered using fully point-in-time constituent data to address survivorship bias. Reliable datasets for that purpose are paid, so this was not treated as a solved problem in the current MVP and is not presented as a feature of the product.
What it does
Users define a portfolio, select an optimisation strategy, and evaluate its historical behaviour.
The current system includes:
- mean-variance optimisation (MVO);
- equal-weight (1/N) allocation;
- risk-parity allocation based on risk contribution;
- historical price and fundamental data;
- periodic or threshold-based rebalancing;
- configurable costs for more realistic performance estimates;
- performance, risk, and factor-attribution analytics.
The objective is not only to display a return figure, but to provide context for how that figure was produced.
Methodological choices
The main design decisions are intended to keep the relationship between strategy and outcome visible:
- portfolio construction is selected explicitly rather than hidden behind a single default approach;
- rebalancing rules and triggers are defined as part of the backtest configuration;
- trading and other configurable costs can be included in performance estimates;
- performance is presented alongside risk and attribution measures;
- different allocation approaches can be compared using the same analytical workflow.
These choices favour transparency and analytical usefulness over a single headline return number.
System
| Layer | Technology |
|---|---|
| Frontend | SvelteKit |
| Backend | FastAPI |
| Database | PostgreSQL |
| Analytics | SciPy, scikit-learn |
| Market data | yfinance |
| Packaging | Docker |
The frontend provides the portfolio and analysis interface, while the backend owns the data processing and analytical workflow.
Screenshots

Rebalancing / Costs

Details

Limitations and next steps
The current MVP is focused on the core optimisation and backtesting workflow. It can account for configurable costs when estimating performance, but it does not yet model returns from a tax perspective.
Future work includes:
- minimum-risk optimisation;
- a machine-learning optimisation approach, with the specific method still to be determined;
- user-interface improvements;
- probabilistic Sharpe ratio analysis to assess whether a portfolio’s performance is meaningfully better than a selected fund or benchmark.
These items are planned development work and should not be interpreted as currently implemented functionality.
Why I built it
I wanted a portfolio tool that combined portfolio construction, optimisation, and risk analysis without requiring the same analytical pipeline to be rebuilt for every experiment.
Regima is also a way to make investment methodology visible in the product itself: the allocation approach, portfolio rules, risk measures, and attribution should be inspectable rather than treated as implementation details.