Hi I have the following code:
def make_pipeline():
#Step1. get all NYSE stocks
exchange = morningstar.share_class_reference.exchange_id.latest
nyse_filter = exchange.eq('NYS')
#Step 2. Top 100 traded NYSE stocks by dollar volume
dollar_volume = AverageDollarVolume(window_length=30)
high_dollar_volume2 = dollar_volume.top(100)
#Step 3. Create screen so that we can only have those top 100
top_100 = high_dollar_volume2
#step 4. Compute the returns over this period
returns = RateOfChangePercentage(inputs=[USEquityPricing.close], window_length=1, mask=high_dollar_volume2)
return Pipeline(columns={
'Stock': high_dollar_volume2,
'Daily Returns':returns},screen=top_100)
start = '2016-12-01'
end = '2016-12-31'
result_mean_reversion = run_pipeline(make_pipeline(), start, end)
once executed my daily returns column is showing 0 for all dates. I would just like the daily rate of change something like this:
returns = prices / prices.shift(-1) -1 however with the mask implemented. So why is my daily returns column showing 0 when window length is 1 and why if i was to use my own forumla such as prices/ prices.shift(-1) -1 would there by anyway to implement a mask to this? thank you