Introduction

Based on the market cap, we can divide the stocks into large-cap, mid-cap and small-cap stocks. In each of those categories, we can subdivide them into value stocks and growth stocks. The growth stocks typically grow revenues faster than the market average and have relatively high P/E ratios and P/B ratios. The value stocks have relatively low P/E ratios and P/B ratios. There are six styles in total. We've demonstrated various momentum strategies to generate excess returns at the firm, industry, and country level. In this algorithm, we'll explore the momentum effect at the style index ETF level.

Method

We choose six index ETFs to represent different Equity styles (small-cap value, mid-cap value, large-cap value, small-cap growth, mid-cap growth, large-cap growth). After adding the assets, we save the momentum percent indicator in the dictionary self.momp for each style. The formation period of 12-month is used to gauge the value of momentum.

  1. def initialize(self):
  2. self.set_start_date(2001, 1, 1)
  3. self.set_end_date(2018, 8, 1)
  4. self.set_cash(100000)
  5. tickers = ["IJJ", # iShares S&P Mid-Cap 400 Value Index ETF
  6. "IJK", # iShares S&P Mid-Cap 400 Growth ETF
  7. "IJS", # iShares S&P Small-Cap 600 Value ETF
  8. "IJT", # iShares S&P Small-Cap 600 Growth ETF
  9. "IVE", # iShares S&P 500 Value Index ETF
  10. "IVW"] # iShares S&P 500 Growth ETF
  11. lookback = 12*20
  12. # Save all momentum indicator into the dictionary
  13. self.mom = dict()
  14. for ticker in tickers:
  15. symbol = self.add_equity(ticker, Resolution.DAILY).symbol
  16. self.momp[symbol] = self.MOMP(symbol, lookback)
+ Expand

Six ETFs are ranked based on their prior 12-month performance in the formation period. The algorithm goes long the top performing ETF and short the ETF at the bottom and holds the position for one month. The portfolio is rebalanced at the start of next month.

  1. def rebalance(self):
  2. # Order the MOMP dictionary by value
  3. sorted_momp = sorted(self.momp, key = lambda x: self.momp[x].current.value)
  4. # Liquidate the ETFs that are no longer selected
  5. for symbol in sorted_momp[1:-1]:
  6. if self.portfolio[symbol].invested:
  7. self.liquidate(symbol, 'No longer selected')
  8. self.set_holdings(sorted_momp[-1], -0.5) # Short the ETF with lowest MOMP
  9. self.set_holdings(sorted_momp[0], 0.5) # Long the ETF with highest MOMP


Reference

  1. Quantpedia - Momentum and Style Rotation Effect

Author

Jing Wu

August 2018