Session Ready
Exercise

Plot efficient frontier

We can finally plot the results of our MPT portfolios, which shows the "efficient frontier". This is a plot of the volatility vs the returns. This can help us visualize our risk-return possibilities for portfolios. The upper left boundary of the points is the best we can do (highest return for a given risk), and that is the efficient frontier.

To create this plot, we will use the latest date in our covariances dictionary which we created a few exercises ago. This has dates as keys, so we'll get the sorted keys using sorted() and .keys(), then get the last entry with Python indexing ([-1]). Lastly we'll use matplotlib to scatter variance vs returns and see the efficient frontier for the latest date in the data.

Instructions
100 XP
  • Get the latest date from the covariances dictionary -- remember the dates are the keys.
  • Plot the volatility vs returns (portfolio_returns) for the latest date in a scatter plot, and set the alpha value for transparency to be 0.1.