Introduction
This micro-study explores a factor-driven sector rotation strategy, leveraging insights from the Kavout Factor Bundle dataset to identify and capitalize on sector-specific opportunities. The strategy utilizes a unique approach, combining factor scores with sector-level analysis to create a dynamic portfolio allocation.
To run this strategy, subscribe to the Kavout Factor Bundle dataset.
The Strategy
The strategy relies on the Kavout Factor Bundle, which provides factor scores for US stocks across five key dimensions: momentum, size, value, low volatility, and short-term reversal, which are considered the most important factors in factor investing analysis. These scores represent a forecast of whether the stock is likely to generate positive returns based on these factors.
Instead of directly investing based on individual stock scores, the strategy focuses on sector-level insights. It calculates the sum of factor scores for all stocks within a sector and normalizes this value by the total number of stocks in that sector. This creates a sector-specific factor score, reflecting the collective strength of the factors within that sector.
The strategy then allocates capital proportionally to these sector-specific factor scores. Each sector receives an allocation based on its normalized factor score, and the capital within each sector is then equally distributed among its constituent stocks. This approach allows the strategy to capitalize on sector-specific opportunities while maintaining a diversified portfolio. We take 2x leverage to invest in this portfolio for additional return.
We apply a monthly rebalancing process. It identifies the top 50 stocks by market capitalization to ensure the liquidity and reliability of this strategy.
Implementation
To implement this strategy in QuantConnect, follow these steps:
1. Add the top 50 market cap US stocks to the universe in a monthly basis.
self.universe_settings.schedule.on(self.date_rules.month_start())
self._universe = self.add_universe(lambda fundamental: [f.symbol for f in sorted(fundamental, key=lambda f: f.market_cap, reverse=True)[:50]])
2. Schedule a monthly rebalance process.
self.schedule.on(self.date_rules.month_start(), self.time_rules.at(9, 30), self.rebalance)
3. Collect the factor scores for each member in the universe and then aggregate them into a sector level.
def rebalance(self):
factor_scores = {sector_code: [0, 0] for sector_code in [101, 102, 103, 104, 205, 206, 207, 308, 309, 310, 311]}
factors = self.history[KavoutCompositeFactorBundle](list(self._universe.members.keys), 1, Resolution.DAILY)
for row in factors:
for data in row:
factor_scores[self.securities[data.key].fundamentals.asset_classification.morningstar_sector_code][0] += data.value.growth + data.value.value_factor \
+ data.value.quality + data.value.momentum + data.value.low_volatility
factor_scores[self.securities[data.key].fundamentals.asset_classification.morningstar_sector_code][1] += 1
4. Invest equally within sector according to the normalized sector-aggregated score. Multiply the weight by 2 for 2x leverage investment.
factor_scores_sum = sum(abs(x[0]) for x in factor_scores.values())
if factor_scores_sum:
self.set_holdings([PortfolioTarget(x.key, 2 * factor_scores[x.value.fundamentals.asset_classification.morningstar_sector_code][0] / factor_scores_sum \
/ factor_scores[x.value.fundamentals.asset_classification.morningstar_sector_code][1]) for x in self._universe.members
if factor_scores[x.value.fundamentals.asset_classification.morningstar_sector_code][1] != 0])
Conclusion
This micro-study demonstrates the potential of a factor-driven sector rotation strategy, leveraging the insights of the Kavout Factor Bundle to identify and capitalize on sector-specific opportunities. The strategy effectively combines factor analysis with sector-level insights to create a dynamic portfolio allocation. By focusing on the collective strength of factors within each sector, rather than individual stock scores, the strategy aims to capitalize on sector-specific trends while maintaining a diversified portfolio.
The strategy's performance during the period from March 2023 to August 2024 is encouraging. It achieved a Sharpe ratio of 1.679, a compounded annual return of 52.867%, and a maximum drawdown of 17.9%, indicating a strong risk-adjusted return profile. The strategy has a beta of 1.727 due to the 2x leverage, but yielded 7% alpha as reward. These results highlight the potential for this strategy to generate consistent returns while managing risk effectively.
Avi Dix
Cloned it, but it does not work. I mean when I cloned it and ran it, there was no buying or selling.
Projectedxyz
Agreed, it seems like the main.py is incomplete, but also this algo depends on a premium data feed. Well worth the ROI if you can get it to run!
Â
https://www.quantconnect.com/datasets/kavout-composite-factor-bundle
Kersten Kriegbaum
Agreed, does nothing when I run it
Alexandre Catarino
Hi!
Thank you, projectedxyz .
Indeed, members need to subscribe to the Kavout Factor Bundle dataset. I have added this information to the Introduction.Â
Best regards,
Alex
Louis Szeto
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!