MGMT 675



AI-Assisted Financial Analysis

OPTIMAL PORTFOLIOS THE EASY WAY

We don’t need a numerical solver

  • We can find the tangency portfolio without using any type of numerical solver (if short sales are allowed).
  • We don’t need cvxopt.
  • We do need to solve some equations, but that is fairly easy.
  • Can do similar for GMV portfolio and frontier.

Equations to solve

  • Solve \[\begin{pmatrix} \text{var}_1 & \cdots & \text{cov}_{1n} \\ \vdots & \vdots & \vdots \\ \text{cov}_{1n} & \cdots & \text{var}_n \end{pmatrix} \begin{pmatrix} w_1 \\ \vdots \\ w_n \end{pmatrix} = \begin{pmatrix} \mu_1 - r_f \\ \vdots \\ \mu_n - r_f \end{pmatrix}\]
  • The solution minimizes (1/2) * variance minus risk premium. It is on the capital allocation line.
  • Divide by sum of weights to get tangency portfolio.

Solve in Excel

  • The equations are solved in Excel with the MINVERSE and MMULT functions.
  • MMULT(RPREM, MINVERSE(COV))
  • RPREM should be in a row
  • Result will be in a row

Global minimum variance portfolio

  • Solve \[\begin{pmatrix} \text{var}_1 & \cdots & \text{cov}_{1n} \\ \vdots & \vdots & \vdots \\ \text{cov}_{1n} & \cdots & \text{var}_n \end{pmatrix} \begin{pmatrix} w_1 \\ \vdots \\ w_n \end{pmatrix} = \begin{pmatrix} 1 \\ \vdots \\ 1 \end{pmatrix}\]
  • Divide by sum of weights

Frontier (hyperbola)

  • Solve

\[\begin{pmatrix} \text{var}_1 & \cdots & \text{cov}_{1n} \\ \vdots & \vdots & \vdots \\ \text{cov}_{1n} & \cdots & \text{var}_n \end{pmatrix} \begin{pmatrix} w_1 \\ \vdots \\ w_n \end{pmatrix} = \begin{pmatrix} \mu_1 \\ \vdots \\ \mu_n \end{pmatrix}\]

  • Divide by sum of weights
  • Put some weight x on the GMV portfolio and 1-x on this portfolio. Vary x and trace out frontier.

Excel Example

  • portfolios.xlsx
  • U.S., developed, and emerging from Applied Finance

Julius Example

  • Ask Julius to use yfinance to get Yahoo adjusted closing prices for
    • SPY = S&P 500
    • VBR = Vanguard small-cap value
    • IEF = Treasury bonds
    • UUP = U.S. dollar bullish
  • Ask Julius to downsample prices to end-of-month and compute monthly returns as percent changes in the downsampled prices.

  • Ask Julius to compute means and covariance matrix as numpy arrays.
  • Tell Julius the risk-free rate is 0.05/12 and ask Julius to compute the risk premia.
  • Ask Julius to multiply the risk premia by the inverse of the covariance matrix.
  • Ask Julius to divide the result by the sum of its elements.