Modern Portfolio Theory

Modern Portfolio Theory (MPT) is a framework for constructing an investment portfolio that maximizes returns for a given level of risk. Developed by Harry Markowitz in 1952, it emphasizes diversification to minimize idiosyncratic risk while optimizing expected returns.

MPT measures risk as the standard deviation of the portfolio’s returns. For a weighted portfolio with assets, the portfolio’s volatility is then given by

where is the correlation between the -th and the -th asset.

When assets are not perfectly correlated, the overall portfolio volatility decreases, allowing investors to construct an efficiently weighted portfolio that offers the best possible return for a given level of risk. The set of optimal portfolios forms the efficient frontier, a curve that represents the highest expected return achievable at each level of risk:

\usepackage{tikz}
 
\begin{document}
 
\begin{tikzpicture}[scale=0.75]
 
   % Axes
   \draw[->] (0,0) -- (7,0) node[right] {$\sigma_p$};
   \draw[->] (0,0) -- (0,6) node[above] {$E(R_p)$};
 
   % Risk-free rate
   \node[left] at (-0.1,1) {$R_f$};
   \draw[dashed] (0,1) -- (6,4.2) node[above right] {Capital Mkt. Line};
 
   % Efficient frontier
   \draw[thick] (3,0.5) .. controls (-1.25,1.2) and (2,2) .. (6,3.5) node[below right] {Efficient Frontier};
 
   % Points
   \filldraw[black] (1,1.2) circle (2pt) node[below left] {M};
   \filldraw[black] (1.6,1.8) circle (2pt) node[below right] {T};
 
\end{tikzpicture}
 
\end{document}

When a risk-free asset is introduced, the efficient frontier transforms into a straight line, known as the capital market line, given by the equation

where is the market risk premium (expected market return minus the risk-free rate), and is the overall market volatility. The slope of the capital market line is called the Sharpe ratio, , and is a measure of the increase in expected return per increase in volatility.

The tangency portfolio () is the point where the efficient frontier meets the capital market line (CML), representing the optimal mix of risky assets. Maximizing the Sharpe ratio, it allows investors to tailor their risk exposure by combining it with risk-free lending or borrowing.

Usage of the Sharpe Ratio

The Sharpe ratio can be used to determine the risk-reward of any asset (or combination of assets). However, in terms of the capital market line, the Sharpe ratio is used exclusively in combination with market returns and volatility.

Examples

Two-Stock Portfolio

Suppose you want to pick the optimal portfolio of two stocks, and :

  • Stock has a return of , and volatility of .
  • Stock has a return of , and volatility of .
  • The correlation between and is around .
  • The risk-free rate is , and the risk premium is . The market volatility is .

We proceed with the following code:

import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import statsmodels
 
sigma_abc = 0.27
sigma_xyz = 0.33
corr = 0.2
 
er_abc = 0.09
er_xyz = 0.15
 
w = 1
i = 0.05
r = {}
while w >= 0:
    er = w * er_abc + (1 - w) * er_xyz
    risk = np.sqrt((w  * sigma_abc) ** 2 + ((1 - w) * sigma_xyz) ** 2 + 2 * w * (1 - w) * corr * sigma_abc * sigma_xyz, )
    r[w] = (risk, er)
    w -= i
    w = round(w, 2)
 
sharpe = [(pf[1] - 0.045) / pf[0] for w, pf in r.items()]
opt_idx = sharpe.index(max(sharpe))
 
risk = [pf[0] for pf in r.values()]
ret = [pf[1] for pf in r.values()]
 
opt = (risk[opt_idx], ret[opt_idx])
opt_w = [k for k, v in r.items() if v == opt][0]
 
 
print(r)
sns.scatterplot(x = risk, y = ret, hue=r.keys())
plt.scatter(x = risk[opt_idx], y = ret[opt_idx], color = 'green', )
plt.annotate(text=f"{opt_w}:{1-opt_w}, Sharpe = {round(max(sharpe), 3)}", xy = opt)
 
plt.xlabel("Porfolio Risk")
plt.ylabel("Porfolio Return")
plt.legend(title="Weight on ABC")
plt.title("ABC:XYZ Portfolio Weights Return vs. Risk")