I'm trying to create a CustomFactor that returns the zscore of the closes for the window length. I'm was attempting to use the mstat.zscore package from scipy but I'm getting some errors. Anyone got any ideas?
class LatestZScore(CustomFactor):
inputs = [USEquityPricing.close]
window_length = 120
def compute(self, today, assets, out, closes):
out[:] = zscore(closes) # <= What do?
I get the following from the above:
ValueError: could not broadcast input array from shape (120,7824) into shape (7824)