Can anyone help me understand how this CrossSectionalMomentum factor works? The shift(100) should result in the first 100 entries in R to be nan right? Also, R.T - R.T.mean() should result in zero?
class CrossSectionalMomentum(CustomFactor):
inputs = [USEquityPricing.close]
window_length = 252
def compute(self, today, assets, out, prices):
prices = pd.DataFrame(prices)
R = (prices / prices.shift(100))
out[:] = (R.T - R.T.mean()).T.mean()