The Claude Quant PlaybookDownload ebookDownload ebook

Minimum-variance portfolio

advancedRisk and portfolio9 of 13

Of all the ways to split money between two assets, one mix has the least risk. This formula gives that weight, using only the volatilities and the correlation, not the expected returns.

Build a trading system with Claude.Download ebook

01The formula

the weight in asset 1 that gives the lowest possible portfolio volatility
the volatilities of the two assets
the correlation between them

02See it move

03Where it is used

04Why traders use it

Expected returns are hard to estimate; volatilities and correlations are much easier. The minimum-variance mix uses only the reliable inputs, which is why it often holds up well out of sample.

05Worked example

With volatilities 20% and 30% and correlation 0.20, the lowest-risk mix puts 73.6% in asset 1 and 26.4% in asset 2, for a volatility of 18.06%. A simple 50/50 mix would have 19.62%.

06How it is built

  1. Write the portfolio variance as a function of : .
  2. It is a parabola in that opens upwards, so it has one lowest point.
  3. Set the derivative to zero: .
  4. Solve for to get . If the answer is above 100%: the lowest risk needs a short position in the riskier asset.

07The common mistake

Trusting the weights blindly. With many assets the estimated covariance matrix is noisy and the optimiser piles into whatever looks least correlated by chance, so practitioners shrink the covariance estimate or cap the weights.

08In Python and LaTeX

s1, s2, rho = 0.2, 0.3, 0.2
w = (s2**2 - rho*s1*s2) / (s1**2 + s2**2 - 2*rho*s1*s2)
vol = (w**2*s1**2 + (1-w)**2*s2**2 + 2*w*(1-w)*rho*s1*s2) ** 0.5
print(round(w, 4), round(vol, 4))
w_1^* = \frac{\sigma_2^2 - \rho\,\sigma_1\sigma_2}{\sigma_1^2 + \sigma_2^2 - 2\rho\,\sigma_1\sigma_2}

09Where it fits

Rather not code the maths yourself? Describe your trading idea and let AI build the bot.

Build a bot with AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.