Hi,
Suppose i have the following CustomFactor:
class Momentum_121(CustomFactor):
window_length = 252
inputs = [USEquityPricing.close]
def compute(self, today, assets, out, price):
mom = price[-21]/price[0]-1
out[:] = mom.astype(float)
The variable "mom" will be an nparray of shape = (x,) where x = the number of stocks available.
Suppose i instead set my window_length = 252*2, and want to backfill the "mom" variable for each stock, going back 252 days. I.e., create an nparray of shape = (252,x), instead. I could then use this "mom" variable to do further computations before sending to "out[:]".
Any advice? Thank you.