Kelly Criterion for Optimal Portfolio Weights with No Short Sales
1. The U.S. Healthcare index seeks to track the investment results of healthcare providers, biotechnology companies, and manufacturers of advanced medical devices and pharmaceuticals.
2. GROWTH of 10,000 USD SINCE 31 JULY, 2007.
This notebook shows the relationship between Markowitz portfolio optimization and Kelly optimization. It is based on a longer whitepaper by Dr Thomas Starke (https://plot.ly/ipython-notebooks/markowitz-portfolio-optimization/) All calculation are written in Mathematica 10.
There are two sections of the demonstration; random data and actual market data. Random data; that will help you to get a idea of how to use this investment strategy for asset allocation and to improve the understanding of the modelling. Then, we shall create a backtest that the asset-weights in a kelly-optimization way.
Assume that we have 4 assets, each with a return series of 500 observations. We can use NormalDistribution to sample returns from a normal distribution.
Random Weights and the Returns/Risk of Each Portfolio
We can generate a wide range of random weights, which can be used to create different portfolios with a wide range of returns(mean) and risks(standard deviation). We assumed that all capital shall be invested, the sum of the weights is equal to 1.
Evaluate how many of these random portfolios would perform
In this section, the goal we are calculating the mean returns as well as the standard deviation (volatility). You can also see that there is a filter that only allows to plot portfolios with a standard deviation of < 1.5 for better illustration.
Generating the mean returns and volatility for 500 random portfolios:
The Efficient Frontier
S.T. ∑w = 1
w.avgReturns = tgtReturn
where vectorOfWeights is a vector of weights, mS is the sample variance/covariance matrix, optimalReturns is a vector of returns, and muRange is the target return.
The problem is that FindMinimum gives slightly different weights than NMinimize. Both give slightly different weights; I would prefer to use FindMinimum as it is much faster, and it seems to be more accurate.
Optimal Portfolio Weights
Backtesting on real market data
Retrieve data from Yahoo Finance
Optimal Portfolio Weights
Assume that we have 20 assets(U.S. Healthcare Sector), each with a return series of 3500 calendar days (2411 trade-days). We can use FinancialData to sample data from a wolfram server.
Daily Return of Assets
Initialization PortfolioWeight, every 70 trade-days update and rebalance its portfolio in a Markowitz-optimal way.
Even through the 2008 financial crisis, The volatility and return are pretty stable. This is most likely due to the universe selection and Increasing the number of stocks in the universe might reduce the volatility as well.