Momentum Based ETF Portfolio Rebalancing
Optimizing Portfolio Construction For Optimal Sharpe Ratio
www.quantconnect.com
Jared Broad
CEO and Founder
We’ve built a web algorithm lab where thousands of
people test their ideas on financial data we provide; for free.
LEAN ALGO
TECHNOLOGY
FINANCIAL
DATA
POWER
COMPUTING
What is QuantConnect?
EQUITIES
OPTIONS
FUTURES
FOREX
CRYPTO
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 2
Outline
 Basics of Mean Variance Portfolio Construction
 Defining Optimization Function
 LEAN Algorithm Framework
 Implementing Our Model
 Testing and Researching
 Summary
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 3
Reduce volatility, increase returns by
calculating optimal weight allocation of
a portfolio for minimum volatility.
Core Idea:
1) Create an estimate of portfolio returns and volatility.
2) Build portfolio of assets; allocating to each by weight.
3) Optimize weights to minimize the volatility in portfolio.
Classic Mean Variance Portfolio Construction
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 4
Classic Mean Variance Portfolio Construction
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 5
$-
$5.00
$10.00
$15.00
$20.00
$25.00
$30.00
$35.00
$40.00
Jan-18 Feb-18 Mar-18 Apr-18 May-18 Jun-18 Jul-18 Aug-18 Sep-18 Oct-18
Stock A Stock B
Ideal = 50-50
Classic Mean Variance Portfolio Construction
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 6
$-
$2.00
$4.00
$6.00
$8.00
$10.00
$12.00
Jan-18 Feb-18 Mar-18 Apr-18 May-18 Jun-18 Jul-18 Aug-18 Sep-18 Oct-18
Stock A Stock B Stock C
Stock D Stock E Stock F
Stock G Stock H
Most real world applications have portfolios of many assets. We are seeking
to find best balance of hundreds of assets.
Mean Variance Optimization Function
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 7
Optimizers experiment with portfolios; seeking to
minimize the objective function.
Classic Mean Variance Optimization the objective
function seeks to minimize expected volatility.
Redefining Our Objective
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 8
We will seek to optimize Sharpe Ratio instead of volatility; seeking to
maximize objective function:
𝑥 = m𝑎𝑥(
𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑃𝑜𝑟𝑡𝑓𝑜𝑙𝑖𝑜 𝑅𝑒𝑡𝑢𝑟𝑛
𝑃𝑜𝑟𝑡𝑓𝑜𝑙𝑖𝑜 𝑉𝑎𝑟𝑖𝑎𝑛𝑐𝑒
)
This target approximates the traditional Sharpe Ratio function.
(We’ll assume the risk free rate of return is zero).
𝑅 𝑝 = (𝑤𝐴, 𝑤 𝐵, 𝑤𝐶)
𝐸(𝑟𝐴)
𝐸(𝑟𝐵)
𝐸(𝑟𝐶)
= 𝑤𝐴 𝐸 𝑟𝐴 + 𝑤 𝐵 𝐸 𝑟𝐵 + 𝑤𝐶 𝐸 𝑟𝐶
With three risk assets in portfolio, the expected return of the portfolio:
We use the variance of each asset, combined with weights to find the variance of the
portfolio:
𝜎 𝑝
2
= 𝑤𝐴, 𝑤 𝐵, 𝑤𝐶
𝑉𝑎𝑟 𝑟𝐴 𝑐𝑜𝑣 𝑟𝐴, 𝑟𝐵 𝑐𝑜𝑣 𝑟𝐴, 𝑟𝐶
𝑐𝑜𝑣 𝑟𝐵, 𝑟𝐴 𝑉𝑎𝑟 𝑟𝐵 𝑐𝑜𝑣 𝑟𝐵, 𝑟𝐶
𝑐𝑜𝑣 𝑟𝐶, 𝑟𝐴 𝑐𝑜𝑣 𝑟𝐶, 𝑟𝐵 𝑉𝑎𝑟 𝑟𝐶
𝑤𝐴
𝑤 𝐵
𝑤𝐶
= 𝑤𝐴
2 𝑉𝑎𝑟 𝑟𝐴
2 + 𝑤 𝐵
2 𝑉𝑎𝑟 𝑟𝐵
2 + 𝑤𝐶
2 𝑉𝑎𝑟 𝑟𝐶
2
+ 2𝑤𝐴 𝑤 𝐵 𝑐𝑜𝑣 𝑟𝐴, 𝑟𝐵 + 2𝑤𝐴 𝑤𝐶 𝑐𝑜𝑣 𝑟𝐴, 𝑟𝐶 + 2𝑤 𝐵 𝑤𝐶 𝑐𝑜𝑣 𝑟𝐵, 𝑟𝐶
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 9
Portfolio Variables
Algorithm Framework Modules
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 10
Algorithm Framework Modules
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 11
Assumptions and Limitations
 Mean Variance Optimization requires expected returns and we provide historical
values. We’re making an assumption these returns will continue in the future.
 Most variance approximations assume a normal distribution.
 Any estimation error in the return prediction magnified.
 The resulting portfolios can be concentrated and nonsensical. In practice its more
common to use Black-Litterman method.
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 12
Code and Implementation
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 13
Backtest
Summary
 Using portfolio construction techniques we can automatically assign weights
to our portfolio assets.
 This reduces the number of variables we manually define; can improve
returns and lower volatility.
Next Steps – Investigate more robust portfolio construction techniques!
(E.g. Black-Litterman).
Total Trades Drawdown Net Profit Sharpe Ratio
270 12.9% 34% 0.555
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 14
www.quantconnect.com
Thank you.
Appendix
Our Research Environment
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 17
Coding the Idea, The Algorithm Lab
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 18
Going Live, Deploying to Live Trading
April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 19

More Related Content

PPT
SCM2013_Vermeylen_CasestudySupplyChainSixSigma
PDF
Gitacloud SAP IBP for Demand Webinar April 5th 2018
PDF
QuantConnect - Introduction to Pairs Trading
PPTX
Deep reinforcement for portfolio management
PDF
Converting_Scores_Into_Alphas
PDF
Nike Valuation
PPT
Optimum Investment Selection process-Nov 9-2013
PDF
Profitable Itemset Mining using Weights
SCM2013_Vermeylen_CasestudySupplyChainSixSigma
Gitacloud SAP IBP for Demand Webinar April 5th 2018
QuantConnect - Introduction to Pairs Trading
Deep reinforcement for portfolio management
Converting_Scores_Into_Alphas
Nike Valuation
Optimum Investment Selection process-Nov 9-2013
Profitable Itemset Mining using Weights

Similar to QuantConnect ETF Momentum Asset Allocation (17)

PDF
Improving Returns from the Markowitz Model using GA- AnEmpirical Validation o...
PDF
Constructing Private Asset Benchmarks
DOCX
AgendaComprehending risk when modeling investment (project) de.docx
PDF
Financial Accounting and Reporting a Global Perspective 4th Edition Stolowy S...
PPT
Mic Powerpoint 3
PDF
Fa0 a appendix_reports
PDF
QuantConnect - Using Options for Risk Control with Python
PDF
IRJET- Analysis of Various Machine Learning Algorithms for Stock Value Predic...
PDF
The Total Economic Impact Of NetApp Solutions For Cloud Service Providers
PDF
IRJET - Stock Recommendation System using Machine Learning Approache
PPTX
Classification of quantitative trading strategies webinar ppt
PDF
21 Toolkit_Attila Rebak_Feb 2012
PDF
Total Economic Impact™ IBM System Storage SAN, Volume Controller
DOC
A Study on Empirical Testing of Capital Asset Pricing Model
PDF
Uncertain Covariance
PPT
Optimum Investment Selection Process Feb 2011
PPT
Optimum Investment Selection Process Feb 2011
Improving Returns from the Markowitz Model using GA- AnEmpirical Validation o...
Constructing Private Asset Benchmarks
AgendaComprehending risk when modeling investment (project) de.docx
Financial Accounting and Reporting a Global Perspective 4th Edition Stolowy S...
Mic Powerpoint 3
Fa0 a appendix_reports
QuantConnect - Using Options for Risk Control with Python
IRJET- Analysis of Various Machine Learning Algorithms for Stock Value Predic...
The Total Economic Impact Of NetApp Solutions For Cloud Service Providers
IRJET - Stock Recommendation System using Machine Learning Approache
Classification of quantitative trading strategies webinar ppt
21 Toolkit_Attila Rebak_Feb 2012
Total Economic Impact™ IBM System Storage SAN, Volume Controller
A Study on Empirical Testing of Capital Asset Pricing Model
Uncertain Covariance
Optimum Investment Selection Process Feb 2011
Optimum Investment Selection Process Feb 2011
Ad

Recently uploaded (20)

PDF
Architecture types and enterprise applications.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PPTX
Tartificialntelligence_presentation.pptx
PDF
CloudStack 4.21: First Look Webinar slides
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
A novel scalable deep ensemble learning framework for big data classification...
PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
sustainability-14-14877-v2.pddhzftheheeeee
PDF
A contest of sentiment analysis: k-nearest neighbor versus neural network
PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
Developing a website for English-speaking practice to English as a foreign la...
DOCX
search engine optimization ppt fir known well about this
PDF
August Patch Tuesday
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Architecture types and enterprise applications.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Tartificialntelligence_presentation.pptx
CloudStack 4.21: First Look Webinar slides
Assigned Numbers - 2025 - Bluetooth® Document
A novel scalable deep ensemble learning framework for big data classification...
Final SEM Unit 1 for mit wpu at pune .pptx
DP Operators-handbook-extract for the Mautical Institute
sustainability-14-14877-v2.pddhzftheheeeee
A contest of sentiment analysis: k-nearest neighbor versus neural network
Enhancing emotion recognition model for a student engagement use case through...
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Developing a website for English-speaking practice to English as a foreign la...
search engine optimization ppt fir known well about this
August Patch Tuesday
WOOl fibre morphology and structure.pdf for textiles
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Ad

QuantConnect ETF Momentum Asset Allocation

  • 1. Momentum Based ETF Portfolio Rebalancing Optimizing Portfolio Construction For Optimal Sharpe Ratio www.quantconnect.com Jared Broad CEO and Founder
  • 2. We’ve built a web algorithm lab where thousands of people test their ideas on financial data we provide; for free. LEAN ALGO TECHNOLOGY FINANCIAL DATA POWER COMPUTING What is QuantConnect? EQUITIES OPTIONS FUTURES FOREX CRYPTO April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 2
  • 3. Outline  Basics of Mean Variance Portfolio Construction  Defining Optimization Function  LEAN Algorithm Framework  Implementing Our Model  Testing and Researching  Summary April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 3
  • 4. Reduce volatility, increase returns by calculating optimal weight allocation of a portfolio for minimum volatility. Core Idea: 1) Create an estimate of portfolio returns and volatility. 2) Build portfolio of assets; allocating to each by weight. 3) Optimize weights to minimize the volatility in portfolio. Classic Mean Variance Portfolio Construction April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 4
  • 5. Classic Mean Variance Portfolio Construction April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 5 $- $5.00 $10.00 $15.00 $20.00 $25.00 $30.00 $35.00 $40.00 Jan-18 Feb-18 Mar-18 Apr-18 May-18 Jun-18 Jul-18 Aug-18 Sep-18 Oct-18 Stock A Stock B Ideal = 50-50
  • 6. Classic Mean Variance Portfolio Construction April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 6 $- $2.00 $4.00 $6.00 $8.00 $10.00 $12.00 Jan-18 Feb-18 Mar-18 Apr-18 May-18 Jun-18 Jul-18 Aug-18 Sep-18 Oct-18 Stock A Stock B Stock C Stock D Stock E Stock F Stock G Stock H Most real world applications have portfolios of many assets. We are seeking to find best balance of hundreds of assets.
  • 7. Mean Variance Optimization Function April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 7 Optimizers experiment with portfolios; seeking to minimize the objective function. Classic Mean Variance Optimization the objective function seeks to minimize expected volatility.
  • 8. Redefining Our Objective April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 8 We will seek to optimize Sharpe Ratio instead of volatility; seeking to maximize objective function: 𝑥 = m𝑎𝑥( 𝐸𝑥𝑝𝑒𝑐𝑡𝑒𝑑 𝑃𝑜𝑟𝑡𝑓𝑜𝑙𝑖𝑜 𝑅𝑒𝑡𝑢𝑟𝑛 𝑃𝑜𝑟𝑡𝑓𝑜𝑙𝑖𝑜 𝑉𝑎𝑟𝑖𝑎𝑛𝑐𝑒 ) This target approximates the traditional Sharpe Ratio function. (We’ll assume the risk free rate of return is zero).
  • 9. 𝑅 𝑝 = (𝑤𝐴, 𝑤 𝐵, 𝑤𝐶) 𝐸(𝑟𝐴) 𝐸(𝑟𝐵) 𝐸(𝑟𝐶) = 𝑤𝐴 𝐸 𝑟𝐴 + 𝑤 𝐵 𝐸 𝑟𝐵 + 𝑤𝐶 𝐸 𝑟𝐶 With three risk assets in portfolio, the expected return of the portfolio: We use the variance of each asset, combined with weights to find the variance of the portfolio: 𝜎 𝑝 2 = 𝑤𝐴, 𝑤 𝐵, 𝑤𝐶 𝑉𝑎𝑟 𝑟𝐴 𝑐𝑜𝑣 𝑟𝐴, 𝑟𝐵 𝑐𝑜𝑣 𝑟𝐴, 𝑟𝐶 𝑐𝑜𝑣 𝑟𝐵, 𝑟𝐴 𝑉𝑎𝑟 𝑟𝐵 𝑐𝑜𝑣 𝑟𝐵, 𝑟𝐶 𝑐𝑜𝑣 𝑟𝐶, 𝑟𝐴 𝑐𝑜𝑣 𝑟𝐶, 𝑟𝐵 𝑉𝑎𝑟 𝑟𝐶 𝑤𝐴 𝑤 𝐵 𝑤𝐶 = 𝑤𝐴 2 𝑉𝑎𝑟 𝑟𝐴 2 + 𝑤 𝐵 2 𝑉𝑎𝑟 𝑟𝐵 2 + 𝑤𝐶 2 𝑉𝑎𝑟 𝑟𝐶 2 + 2𝑤𝐴 𝑤 𝐵 𝑐𝑜𝑣 𝑟𝐴, 𝑟𝐵 + 2𝑤𝐴 𝑤𝐶 𝑐𝑜𝑣 𝑟𝐴, 𝑟𝐶 + 2𝑤 𝐵 𝑤𝐶 𝑐𝑜𝑣 𝑟𝐵, 𝑟𝐶 April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 9 Portfolio Variables
  • 10. Algorithm Framework Modules April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 10
  • 11. Algorithm Framework Modules April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 11
  • 12. Assumptions and Limitations  Mean Variance Optimization requires expected returns and we provide historical values. We’re making an assumption these returns will continue in the future.  Most variance approximations assume a normal distribution.  Any estimation error in the return prediction magnified.  The resulting portfolios can be concentrated and nonsensical. In practice its more common to use Black-Litterman method. April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 12
  • 13. Code and Implementation April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 13 Backtest
  • 14. Summary  Using portfolio construction techniques we can automatically assign weights to our portfolio assets.  This reduces the number of variables we manually define; can improve returns and lower volatility. Next Steps – Investigate more robust portfolio construction techniques! (E.g. Black-Litterman). Total Trades Drawdown Net Profit Sharpe Ratio 270 12.9% 34% 0.555 April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 14
  • 17. Our Research Environment April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 17
  • 18. Coding the Idea, The Algorithm Lab April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 18
  • 19. Going Live, Deploying to Live Trading April-2018 QuantConnect – Momentum Based ETF Portfolio Rebalancing Page 19

Editor's Notes

  • #2: Welcome everyone! Thank you for joining today! My name is Jared Broad and I am the CEO and Founder of QuantConnect. QuantConnect is a website platform which empowers you build automated investment strategies. We believe all investors deserve access to powerful investment tools and are trying to make it as easy as possible. We take care of all of the boring and mechanical aspects and leave you to focus on building and testing your investment strategy. Through our website community we’re finding the best and brightest minds from around the world and connecting them with the capital they need. Please not all examples discussed in this presentation are for purposes only we’ll be using are for illustration and research purposes only. Historical backtests do not guarantee future results. You should always research methods for your investments
  • #3: We have a web based algorithm development environment with free financial data for equities, futures, options, forex and crypto currencies. You can explore and create new algorithms! Behind the scenes we provide terabytes of financial data, covering US Equities, Options, Crypto, Futures and FX markets from tick to daily resolution. We make all of that data available for free for you to analyze and test out your ideas for investment opportunities. Our platform runs on LEAN; our open-source algorithmic trading engine. Lean is the core technology behind QuantConnect and drives all of the strategy modelling and live trading. Being open source means you can download our core technology and run it on your own servers without being locked into our service.
  • #4: In this webinar we’re going to give you a high level overview of mean variance portfolio construction; and then adjust it for our purposes to build a portfolio with momentum based weighting. We’ll build it in the QuantConnect LEAN Algorithm Framework – a modular approach for designing algorithms. This lets you plug in work of other people to quickly experiment! We’ll review the code implementation and perform some backtests on the results.
  • #6: Classic Mean Variance optimization suggests given two assets with very low correlations we can find the optimal combination of the two which cancels out and gives us the ideal portfolio. We’ve illustrated this here with two relatively simple assets (sine-stocks) which are perfect opposites. The combined portfolio is a near straight line.
  • #7: In reality we work with portfolio’s of more than 2 assets; and so finding the “perfect portfolio” takes a little work. To do this work we employ an optimizer library which with hundreds of portfolios to find the optimal balance of each one. These portfolios assign various weights to each asset; and then test the final portfolio against an objective function – the measure of our success. In Mean Variance optimization this objective function is the with the lowest volatility possible!
  • #10: Return of Portfolio = Return of each Asset * Weight.
  • #11: We have designed a framework for the foundation of the algorithm. This guides you in the best implementation of the algorithm. First we select the assets in the universe we’d like to trade with the Universe Selection Model; Once selected we generate trading signals on these assets with the Alpha Model; Finally we pipe these signals into the Portfolio Construction Model to generate the weighting for the assets. In this webinar we’re building a sharpe-weighted portfolio construction model. The universe is a fixed list of popular liquid ETF’s. We are assuming a constant Alpha Model for this case as it is ignored and we’re just using the historical returns for the signals. Next we’ll guide you through the code for how we implemented this in the website IDE.
  • #19: Here is where you take the code from your research environment and code it up into an algorithm.