Hello Community!
In his newest book, Trillions, Robin Wigglesworth describes “custom indexes”. For example, if you are religious and you don’t want to invest in guns, alcoholic beverages, or tobacco, you could invest in the S&P500 while excluding stocks from those industries.
We can easily implement this strategy using QuantConnect Lean, ETF Constituents, and Morningstar Fundamental data. First, we find the weight of each security in the SPY ETF that is part of the undesired industry. We then buy SPY and short the undesired stocks. We short the undesired stocks using the same weight they have in the SPY ETF to remove their presence in our portfolio.
The 26th UN Climate Change Conference, COP26, has inspired us to explore the following hypothesis: what if we invest in a custom index that excluded stocks from the Oil and Gas industry since the Paris Agreement (April 22nd, 2016)?
We have found that our index outperformed SPY with a Sharpe Ratio of 0.914 and a maximum drawdown of 32.2%, against the respective values of 0.88 and 34.3% from the benchmark.
Refer to the attached backtest.
James Hawkins
This is very interesting, Alex! Thanks for sharing.
Curious to know how this strategy would perform using the UPRO 3x SP500 bull ETF instead. Also, since UPRO is 3x, would that mean the shorted stocks would need to have their positions increased by 3x as well?
James Hawkins
I just had a realization - this model doesn't seem to take into consideration the borrowing cost associated with shorting the shares let alone any potential margin call associated with the short positions. Perhaps it would best to simply remove these stocks from the SP500 universe and rebalance the remaining stocks and just go long? It wouldn't be the most accurate representation do to partial shares, but it would avoid the margin cost/call scenarios.
Varad Kabade
Hi James
The constituents of leveraged ETFs are the derivatives product from their underlying index/equity. For UPRO, that's mostly SP500 swaps/futures.
Therefore, using the ETF constituents dataset cannot fetch its underlying equities. You'll have to use SPY to fetch the underlying, invest 3x the corresponding weights. Note that you'll need a custom buying power model (example) for sufficient margin.
We use the approach of buying SPY and shorting the rejected assets as it minimizes the transaction fee. Nonetheless, it would indeed have concerns on margin. It might be worth exploration on the rebalancing approach that normalizes the weighted sum up to 1, or an index tracking portfolio tracks the SPY with a minimum number of assets without the rejected assets.
Best
Varad Kabade
Alexandre Catarino
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!