Portfolio Optimization From Scratch
By: Kevin Mekulu
Tags: Stock Market, Economics, Business, Finance, Data Science

Portfolio Optimization in the Real World

Now that the theoretical and mathematical implications of modern portfolio theory have been covered, I will demonstrate how it can be used in the real world by an investor or an asset manager.

In this experiment, I randomly selected a portfolio of six stocks in the technology sector.

Step 1: Acquire stock data from your favorite data provider (I personally used data from Yahoo Finance)

Step 2: Compute mean returns and standard deviations of the stocks contained in your portfolio. Also, design a covariance matrix that contains returns and standard deviations as shown below(there are multiple packages available in both R and Python that will automatically take care of this task)

Covariance Matrix of the Portfolio

Step 3: Use the returns calculated in step 2 to simulate a wide range of portfolios (at least 50000 portfolios) with different expected weighted returns and different risks (standard deviations) and compute the Sharpe ratio of your simulated portfolios.

Simulated Portfolios (50000)

Step 4: Generate the “efficient frontier” which is a set of portfolios that maximize returns and minimize risk

The Efficient Frontier: The orange points on the plot represent “optimal” portfolios for each of the desired returns

Step 5: Generate the optimal asset allocation for the portfolio

Optimal Portfolio Allocation by author

Step 7: Backtest the portfolio to see how it has performed historically against the broad market

Criticism of Markowitz’s Model

“All models are wrong, but some are useful.” G. Box

Although Markowitz’s portfolio theory quantitatively demonstrated the importance of portfolio diversification and set a foundation for a lot of investment research, practitioners and academics have increasingly started to question some of its “unrealistic” assumptions.

1. Criticism of Estimates

A general criticism concerns with the predictability of the model. It lies in the use of historical data when estimating the variables used in the model. Usually, the estimates in Markowitz’s Model are computed by choosing a representative subset of historical data. The chosen subset should represent the period to be predicted as accurately as possible. While the past data might be a relatively plausible proxy for future performance if the time frame is large enough to reflect a general trend of the asset return, we could never assume the past movement of stock price can be replicated in the next period. This weakness of the model is most likely to surface itself in the face of unanticipated events in the financial markets like financial crisis, political tensions, or unexpected policy announcements. Thus, the model loses its predictability value in practice and should not be the sole quantitative tool to rely on when it comes to future investment planning.

2. Criticism of Assumptions

Among the five basic assumptions MPT is based on, most of them are considered non-practical and oversimplified given the complexity of the situation of a long-term investor. We would like to focus on two of them, which are most relevant to an investor’s long-term investment goal. We are going to discuss one of them in this section and the other in section V.

The first point of criticism lies in the assumption that there are no transaction costs in buying and selling securities. However, in reality, investors pay various intermediate fees like brokerage, taxes, commission fees, and other transactional fees. All these fees will be taken into consideration when calculating the total return of the portfolio. For example, a portfolio with a high turnover rate, i.e. more buying or selling of underlying securities, incurs more transaction fees and tax payments. Therefore, when thinking about optimizing the portfolio return, the investors have to subtract the middle fees, which hurt the overall return. Investors, on one hand, can adjust the portfolio structure by buying or selling securities to find the optimize the return from the assets; on the other hand, they have to consider the additional cost introduced by transactions.

References

[1] Brinson, P. Gary, et al, Determinants of Portfolio Performance (1986), Financial Analysts Journal, vol. 42, no. 4, 1986, pp. 39–44.

[2] H.M. Markowitz, Portfolio Selection (1952), The Journal of Finance, 7(1): 77–91.

[3] K. Mekulu, D. Yeung, K. Niebling, V. Jiang, Investing in the Long Run (2018), Research Project on Mathematical Economics

[4] A. Himonas, T. Cosimano, Investing in Stocks and Bonds over the Long Run (2007)