Hi I am getting an issue when trying to access the average volume from USEquityPricing.volume
it is not printing out any of the corresponding volume, I'm not sure if my custom factor is setup correctly
class VolumeTV(CustomFactor): #custom factor
inputs = [USEquityPricing.volume]
window_length = 10
def compute(self, today, assets,out,volume):
# Volume_TV=np.mean(volume,out=out, axis=0)
print("NP Average")
out[:]=Volume_TV
# print(np.mean(volume,out=out, axis=0))
def make_pipeline():
pipe = Pipeline()
#attach_pipeline(pipe, name='my_pipeline')
#Screen out penny stocks and low liquidity securities.
# Prive range Factor#
stock_prices = PriceRange(window_length=10)
# Time Volume Factor#
TimeVolRank = VolumeTV(window_length=10)
print("Time volume Rank",TimeVolRank)
is_liquid = TimeVolRank.rank(ascending=False) < 1000
# Create the mask that we will use for our percentile methods.
volumeTV = VolumeTV()
base_universe = (is_liquid)
Current_Volume =volumeTV
#Average_Volume =
return pipe
def before_trading_start(context, data):
"""
"""
# Access results using the name passed to `attach_pipeline`.
results = pipeline_output('factors')
print results.head(5)