Portfolio Builder
Project 3
A full-stack web app that builds an investment portfolio for you. You choose an amount, a risk appetite and a time horizon, and it recommends how to split your money across a curated set of 18 stocks, ETFs, bonds and gold. It then shows where that portfolio could be in anywhere from 1 to 50 years.
The recommendation engine is built on Modern Portfolio Theory. From five years of daily prices, it estimates each asset's expected return and how the assets move together. It then solves a Markowitz mean-variance optimisation with SciPy to find the mix that earns the most return for the risk you've chosen. Historical averages are noisy, so I shrink the estimates to stop the optimiser piling into whatever happened to perform best, and I cap any single asset at 25%. A 6,000-path Monte Carlo simulation then projects the portfolio forward as a range of outcomes rather than a single number.
The backend is a FastAPI service that pulls market data from Yahoo Finance, caches it on disk and refreshes it every night, so pages load instantly. The frontend is a React and TypeScript single-page app with charts I drew by hand in SVG, without a chart library. It runs on an AWS server behind nginx with HTTPS, and it's covered by automated tests.
Options pricing coming soon.
Python
TypeScript
FastAPI
React
NumPy
- SciPy
pandas
Vite
AWS
- nginx