Hi All,

I just wrote a blog post on Portfolio Optimization using QuantConnect (link here). The purpose of this project is to provide the community with a useful workflow in which to perform research with powerful visualizations and then backtest conclusions back and forth between the Notebook and the Algorithm Framework.

The Notebook is divided into several sections covering some preliminary analysis and walk-forward optimizations with multiple lookback periods. Some interesting stuff in the code:

  • You can test multiple optimization techniques by simply changing the objective function: Maximize Portfolio Return (disregard volatility), Minimize Portfolio Volatility (disregard return), Maximize Portfolio Sharpe Ratio (assuming a risk-free rate of 0%), Maximize Portfolio Sortino Ratio, Risk Parity Portfolio. Also, you can choose the lookback period for optimization and different date rules for the rebalancing logic (Expiry.EndOfWeek, Expiry.EndOfMonth, etc.).
  • The implementation of Risk Parity using Spinu convex formulation.
  • In the Notebook, several interesting visualizations are provided (efficient frontier, monthly weights, relative risk contributions, risk-reward profiles, etc.).
  • In the Notebook, you can run all the walk-forward optimizations on multiple lookback periods at the same time and visualize the performance of the different combinations.
Let me know if any questions regarding the code or the analysis and I'll be happy to answer! Thanks, Emilio InnoQuantivity.com