Hi Jamie,
Yeah sure, it could be that I oversaw something, I can share my notebook with you
# 1 - Getting pipeline and returns a multi-index dataframe:
def make_pipeline():
avd_10 = AverageDollarVolume(window_length=10)
avd_30 = AverageDollarVolume(window_length=30)
# filter for the highest # and now we are masking it
high_dollar_volume = avd_30.percentile_between(90, 100)
sma_10 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=10, mask=high_dollar_volume) # factor
sma_30 = SimpleMovingAverage(inputs=[USEquityPricing.close], window_length=30, mask=high_dollar_volume) # factor
percent_diff = (sma_10 - sma_30)/sma_30 # factor
latest_close = USEquityPricing.close.latest
volume = USEquityPricing.volume.latest
# mean_crossover_filter = sma_10 < sma_30
return Pipeline(
columns={
'sma_10': sma_10,
'sma_30': sma_30,
'percent_diff': percent_diff,
'avd_10': avd_10,
'avd_30': avd_30,
'latest_close': latest_close,
'volume': volume
} ,screen=high_dollar_volume
)
# 2 - Running the pipeline, get 1 year data
pipe_line = run_pipeline(make_pipeline(),'2018-01-01', '2019-01-01')
pipe_line
# 3 - unstacking to get the latest close prices, note that this already gives NaN for certain assets. The data frame has 252 rows (# of trading days) and 1299
# columns (# of stocks)
pipe_line_latest_close = pipe_line.latest_close.unstack(level=-1)
pipe_line_latest_close
my idea was to add .dropna(axis=1) to get rid of these stocks that have NaN. What do you think?