SigmaField

Practice Portfolios

Find the minimum-variance mix of two funds

Easy+10 pointsAbout 20 minutesPortfolios

The brief

A portfolio team is building the lowest-risk mix of two funds for a cautious client. One is a global bond fund with a volatility of 7% a year; the other is a global equity fund at 16%.

The best mix depends on how the two funds move together, and that changes with the market. The team's risk model gives three correlation scenarios, and the client may not sell either fund short.

Your task

  1. Write min_variance_mix(sA, sB, rho): the pair (w, vol). Here w is the weight in fund A with the lowest variance, short sales allowed, and vol is the volatility at that weight. Raise ValueError for a volatility of zero or below, a correlation outside [−1,1][-1, 1], or when every weight gives the same variance.
  2. Write long_only_mix(sA, sB, rho): the same pair when neither fund may be sold short, so that 0≤w≤10 \le w \le 1.
  3. Write short_sale_threshold(sA, sB): the correlation above which the lowest-variance mix sells the riskier fund short.

The data

BOND_VOL and EQUITY_VOL in the code are the two funds' yearly volatilities. SCENARIOS gives the correlation between them in a calm, a normal and a stressed market. The tests take the bond fund as fund A.

Hint: Where to start

With weight ww in fund A, the portfolio's variance is a quadratic in ww, and its lowest point is the vertex (lesson 1.2.2). Case study 1.2.4 writes out the coefficients and the minimum-variance weight.

Hint: Without short sales

If the vertex lies outside [0,1][0, 1], the variance keeps falling towards the nearer end of that range. So the best allowed weight is that end (case study 1.2.4).

Hint: When the mix needs a short sale

Case study 1.2.4 shows the vertex leaving [0,1][0, 1] once the correlation rises above the smaller volatility divided by the larger one. Check the leading coefficient before you divide by it: it is zero only when ρ=1\rho = 1 and the two volatilities are equal.