Efficient Frontier & Portfolio Optimization with Python [Part 2/2]

Bernard Brenyah
DS Biz
Published in
3 min readNov 2, 2017

William F. Sharpe. Image Credit: Sensible Investor

In the first part of this series, we looked at the underpinnings of Modern Portfolio Theory and generated an Efficient Frontier with the help of Monte Carlo Simulation. This post concludes the series by looking at the concept of portfolio optimization.

50,000 portfolios with different combinations of weights generated different expected returns and expected volatility. Each point lying on the line represents an optimal combination of stocks (CenterPoint Energy, Facebook, Walmart, General Electric, Tesla in this case) that maximises the expected return for the given level of risk. If all points on the Efficient Frontier curve are optimal combinations, what is the optimal portfolio among the various optimal combinations? What would even the criteria for choosing this “best of the best” combinations?

William F. Sharpe, another Nobel Prize laureate extended Markowitz’s work which resulted in the infamous Capital Asset Pricing Model (CAPM). This post will not delve into this model now. However, we will utilize one of his contributions (the Sharpe Ratio) as criteria for choosing this “best combination”.

Image Credit: Investopedia

Sharpe ratio is simply as a measure of the performance of an investment’s returns given its risk. This ratio adjusts the returns of an investment which makes it possible to compare different investments on a scale that incorporates risk. Without this scale of comparison, it would be virtually impossible to compare different investments with different combinations and their accompanying risks and returns.

NB: For simplicity's sake a risk free rate of 0% was assumed for this post

We will take advantage of the code we used in generating the efficient frontier in the last post with some minor adjustments. We already have expected returns and returns of our simulated portfolios. We are simply going to calculate their risk-adjusted returns (with the help of the Sharpe Ratio), and make a…

Bernard Brenyah
DS Biz
Editor for

I have a love/hate relationship with numbers