I would like to study the book to price ratio on tech stocks. For some reason the z-score is producing a lot of nans and alphales is dropping nearly 30% of the data.
Am I doing something wrong? Thanks.
I would like to study the book to price ratio on tech stocks. For some reason the z-score is producing a lot of nans and alphales is dropping nearly 30% of the data.
Am I doing something wrong? Thanks.
try this:
# Make Pipeline
def make_pipeline():
# Create Pipeline
pipe = Pipeline()
universe = Q500US()
# My factor
myfactor = BookToPrice()
# Returns
returns = Returns(inputs=[USEquityPricing.close], window_length=2)
universe = universe & myfactor.notnull()
# Factor Rank
myfactor_rank = myfactor.zscore(mask=universe)
# Pipeline to return
return Pipeline(
columns={
'myfactor': myfactor,
'myfactor_rank': myfactor_rank,
'sector' : Sector()
},
screen = (universe & tech)
)
results = run_pipeline(make_pipeline(), begin_period, end_period)
results.fillna(value=0);