Core
URTH · IEF · GLD
World equities, US Treasuries and gold: the ballast of the portfolio.
Volatility 7.0 to 17.7 %
Project Advanced Mathematics · VUB 2026-2027 · Koen Hanegreefs
I invest in semiconductors, defense and quantum computing. I used linear algebra and optimisation in Python to find the "best" mix of ten assets, and then checked whether that mix would really have worked.
Step 1 · The question
My portfolio is built around themes I believe in. What I never had was a rule for how much to put in each one. Modern portfolio theory (Harry Markowitz, 1952) says the answer is a mathematical optimisation problem: choose the weights that give the lowest risk for the return you want.
Research question. Does mean-variance optimisation give a better risk-adjusted portfolio of my thematic assets than simply giving every asset the same weight, and does the advantage survive on data the optimiser has never seen?
"Risk-adjusted" is measured with the Sharpe ratio: the return above the risk-free rate, per unit of volatility.
Step 2 · The data
I downloaded weekly closing prices from the historical data service of Interactive Brokers on 16 November 2026. The sample runs from the week ending 12 August 2022, the first week in which all ten assets trade, to 13 November 2026. Prices are in US dollar and adjusted for stock splits; dividends and bond coupons are not included.
URTH · IEF · GLD
World equities, US Treasuries and gold: the ballast of the portfolio.
Volatility 7.0 to 17.7 %
SMH · NVDA · ASML
The whole chip industry in one ETF, the leading AI chip designer and the only maker of EUV lithography machines.
Volatility 34.0 to 46.5 %
ITA
US aerospace and defense companies in one ETF.
Volatility 20.2 %
IONQ · RGTI · QBTS
Three young quantum computing companies, each betting on a different hardware approach.
Volatility 97.5 to 184.2 %
Bars show the range of annual volatility within each theme, on one scale from 0 to 190 %.
From prices I compute simple weekly returns, and I annualise by multiplying the mean by 52 and the standard deviation by √52.
| Asset | Theme | Mean return | Volatility | Sharpe | Compound growth | Worst drawdown |
|---|---|---|---|---|---|---|
| URTH · MSCI World ETF | Core | 13.7 % | 14.8 % | 0.66 | 13.5 % | −14.9 % |
| IEF · US Treasury bonds | Core | −3.1 % | 7.0 % | −1.00 | −3.2 % | −13.1 % |
| GLD · Gold | Core | 19.2 % | 17.7 % | 0.86 | 19.2 % | −26.5 % |
| SMH · Semiconductor ETF | Semiconductors | 38.1 % | 34.0 % | 1.00 | 38.1 % | −34.1 % |
| NVDA · NVIDIA | Semiconductors | 61.5 % | 46.5 % | 1.24 | 66.0 % | −37.1 % |
| ASML · ASML Holding | Semiconductors | 30.6 % | 40.7 % | 0.65 | 25.0 % | −44.2 % |
| ITA · Defense ETF | Defense | 18.2 % | 20.2 % | 0.70 | 17.5 % | −20.1 % |
| IONQ · IonQ | Quantum | 79.5 % | 97.5 % | 0.77 | 43.3 % | −65.0 % |
| RGTI · Rigetti Computing | Quantum | 99.9 % | 139.2 % | 0.69 | 17.5 % | −91.8 % |
| QBTS · D-Wave Quantum | Quantum | 112.1 % | 184.2 % | 0.59 | −2.9 % | −95.5 % |
One line in this table already taught me something. D-Wave has the highest average weekly return of all ten assets (112 % a year), yet an investor who held it for the whole period lost 2.9 % a year. Extreme volatility destroys compound growth: after a loss of 50 % you need a gain of 100 % to get back to where you started.
Step 3 · Analysis 1
Diversification only works when assets do not move together. I measured this with the correlation matrix of the weekly returns: a 10 × 10 table in which every number lies between −1 (always opposite) and +1 (always together).
The world ETF, the three semiconductor positions and defense form one red block: their correlations are between 0.34 and 0.81. The three quantum stocks form a second block (0.46 to 0.68). Only the bond ETF and gold are close to zero with everything else.
To summarise 45 correlations in a few numbers I computed the eigenvalues and eigenvectors of the correlation matrix (this is called principal component analysis). Each eigenvector is a combination of assets that moves independently of the others; its eigenvalue tells how much of the total variation it explains.
Interpretation. The first eigenvector explains 42 % of everything. All ten assets have a positive weight in it, so it is the general "market" direction: when it falls, my whole portfolio falls. The second (16 %) separates the quantum stocks from the rest, and the third (12 %) is bonds and gold. Together three factors explain 70 % of the variation of ten assets. Ten positions in my themes are, in terms of risk, closer to three.
Step 3 · Analysis 2
A portfolio is a vector of weights w that add up to 1. With the vector of mean returns μ and the covariance matrix Σ of the ten assets, its return and risk are:
Markowitz optimisation looks for the weights with the smallest variance for a chosen return:
Without the condition w ≥ 0 this can be solved exactly with Lagrange multipliers; the solution only needs two linear systems (Σx = 1 and Σx = μ). With the condition, which is my real situation, I let Python solve it numerically (SLSQP algorithm in SciPy). Repeating this for many target returns m draws the efficient frontier. As a sanity check I also generated 20 000 random portfolios (Monte Carlo).
| Portfolio | Expected return | Volatility | Sharpe | Main weights |
|---|---|---|---|---|
| Equal weight | 47.0 % | 43.0 % | 1.00 | 10 % in each asset |
| Minimum variance | −0.1 % | 6.7 % | −0.61 | IEF 85 %, URTH 9 %, GLD 3 %, ITA 3 % |
| Maximum Sharpe | 35.4 % | 21.0 % | 1.49 | GLD 56 %, NVDA 31 %, ITA 9 %, RGTI 3 %, IONQ 2 % |
Interpretation. In hindsight the optimiser clearly beats equal weights: the Sharpe ratio rises from 1.00 to 1.49, with half the volatility (21 % instead of 43 %). None of the 20 000 random portfolios reaches 1.49 (the best one has 1.43), which confirms that the solver found the true optimum. But look at what it buys: more than half in gold, a third in NVIDIA and nothing in the world ETF, the semiconductor ETF or ASML. It simply loads up on whatever had the best past numbers. The minimum-variance portfolio shows the opposite problem: it is 85 % bonds, the calmest asset, and it earned nothing.
Step 3 · Analysis 3
Analysis 2 cheats: it uses returns that an investor could not know in advance. So I split the data in two. I computed the weights using only the training period (Aug 2022 to 27 Dec 2024, 124 weeks) and then measured what those fixed weights did in the test period (3 Jan 2025 to 13 Nov 2026, 98 weeks).
| Strategy | Sharpe promised | Sharpe delivered | Return p.a. | Volatility | Value of 100 | Worst drawdown |
|---|---|---|---|---|---|---|
| Equal weight | 1.24 | 0.64 | 29.3 % | 39.2 % | 151 | −30.0 % |
| Minimum variance | −0.57 | −0.09 | 3.5 % | 5.8 % | 107 | −10.6 % |
| Maximum Sharpe | 2.14 | 0.70 | 21.4 % | 24.9 % | 141 | −22.0 % |
| MSCI World only | 0.59 | 0.75 | 14.9 % | 14.4 % | 130 | −14.9 % |
Interpretation. The maximum-Sharpe portfolio promised 2.14 and delivered 0.70, one third of the promise. Its Sharpe ratio was still slightly above that of equal weights (0.70 against 0.64) because it took much less risk, but the boring world ETF had the best risk-adjusted result of all (0.75).
Why? The optimiser's two inputs behaved very differently. Risk was predictable: the maximum-Sharpe portfolio was expected to have 22.9 % volatility and had 24.9 %. Return was not: NVIDIA averaged +96 % a year in the training period and +18 % a year in the test period. The optimiser trusted the +96 % and put a third of the portfolio there. Small errors in μ are magnified into large errors in the weights; this is known as estimation error.
Step 5 · Conclusion
Answer. Yes in hindsight, hardly in practice. Optimisation improved the Sharpe ratio from 1.00 to 1.49 on past data, but on unseen data the advantage shrank to 0.70 against 0.64, and a single world ETF did better than both.
Limitations
All data, code and figures are in the public repository:
github.com/Fomural/thematic-portfolio-optimisation.
Running python run_all.py rebuilds every number and figure on this page.
The figures are also available as PDF in the figures/ folder.