When I try to add pricing and volume data to my pipeline I keep getting this error:
"could not broadcast input array from shape (2,8247) into shape (8247) "
class Vol(CustomFactor):
inputs = [USEquityPricing.volume]
window_length = 5
def compute(self, today, assets, out, volume):
out[:] = np.mean(volume)
class Open_Pricing(CustomFactor):
inputs = [USEquityPricing.open]
window_length = 5
def compute(self, today, assets, out, open_price):
out[:] = open_price
class Close_Pricing(CustomFactor):
inputs = [USEquityPricing.close]
window_length = 5
def compute(self, today, assets, out, close_price):
out[:] = close_price
def make_pipeline():
pipe=Pipeline()
universe = QTradableStocksUS()
Vol_metric = Vol(window_length=5) #determines quantity of days
pipe.add(Vol_metric,'Vol_metric')
Open_price = Open_Pricing(window_length=2) #determines quantity of days
pipe.add(Open_price,'Open_price')
Close_price = Close_Pricing(window_length=2) #determines quantity of days
pipe.add(Close_price,'Close_price')
return pipe