Back

Classical Asset Allocation with Mean-Variance Optimization

This algorithm is the LEAN implementation of the paper Momentum and Markowitz: A Golden Combination from Wouter J. KellerAdam Butler, and Ilya Kipnis

The CAA model here applies mean-variance optimization over a lookback horizon of one year. The return and volatility are calculated with daily resolution and monthly rebalancing.

  •  Data 
  1. The universe includes 7 ETFs of the global market. The risky assets are ETFs of S&P 500 (SPY), EAFE (EFA), MSCI Emerging Markets Index (EEM), JPX-Nikkei 400 (JPXN), Vanguard Information Technology ETF (VGT), The cash-like assets are ETFs of 7-10 Year Treasury Bond(IEF) and 20+ Yr Treasury Bond(TLT). The backtesting period is from 2007 to 2018.
  • Method
  1. Each month we estimate the optimal mix of assets weights based on information from the prior 252 trading days and use that mix for the next month. For the covariance matrix, we used the historical covariance matrix of returns for the trailing twelve months. 
  2. As the mean-variance optimization seeks any optimal set of portfolio weights, There is the potential for the portfolio to become quite concentrated at times. To reduce this possibility, we imposed caps (max weights) on assets to enforce greater diversification as indicated in the paper. E.g. impose a cap of 25% for all risky assets and no cap (i.e. a cap of 100%) for all cash-like assets.
  • Optimization
  1.  For optimization, we tried the different methods like maximizing the Sharpe Ratio, maximizing the return given target volatility stays unchanged (We use 5% as the target volatility). In addition, we also compare the results with the equally weighted algorithm. You could change the target volatility variable in the algorithm to test the defensive and offensive model.

Results are presented below. 

  • <1> Maximizing the Sharpe Ratio
Update Backtest






The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.



  • <2>  Maximizing the Return given the Target Volatility
1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


  • <3> The equally Weighted Asset Allocation
1

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks Jing , this is a really cool paper (and Python code!)

Merci

0

Thank you very much for sharing, I am working on an adaptation...I am not a coder just an enthusiast.

However, one wonders how the rebalance function behaves when a ticker is removed from the portfolio. Does the algorythm liquidate all shares of the removed ticker once it is time to rebalance?

0

Hi Okana, you need to manually remove stocks which are not in the portfolio

 

Here is an example 

https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/CoarseFineFundamentalComboAlgorithm.py
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Thanks...will research further.

0

Hi Jing Wu Thats really great I'm sure you can apply this to a broader universe of stocks.  I added a few more funds and relaxed the constraints on the bounds and was able to get the sharpe of the backtest to 1.15!

1


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed