Simulating random portfolios to illustrate the 'efficient frontier' of returns

Question

Suppose you're given an array of equities and asked to simulate random portfolios to visualize the 'efficient frontier'.

The efficient frontier shows the set of 'optimal' portfolios that offer the highest expected return for a defined level of risk, where standard deviation is used as a proxy for risk.

In order to build the simulation and illustrate the efficient frontier, you can follow the steps below:

  • Calculate periodic returns of the stocks in your portfolio
  • Write function(s) to simulate randomized runs of your portfolio (randomly assigning weights). - You'll probably want to calculate a covariance matrix for the equities as well as the mean historical returns as general inputs
  • Plot the output of the annualized portfolio returns generated from your simulation function(s), as well as the portfolio standard deviation (volatility) in a scatter plot -- the left outer curve on this plot will illustrate the 'efficient frontier' where maximum expected returns for a given risk level exist

To help get you started, you can reference this Google Colab notebook with the historical returns for a portfolio of the following equities:

['AAPL','FB', 'C', 'DIS']

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now