I was trying to find a market PE by using SPY's PE ratio. (Q500US would be nicer but not working and sid(8554) not working either)
The algo then pick stocks with its stock_PE > market_PE using the eval and return a boolean to pipeline.
def make_pipeline():
base_universe = Q500US()
market_pe = Fundamentals.pe_ratio(input = symbol('SPY'), window_length = 1)
stock_pe = Fundamentals.pe_ratio.latest
eval = stock_pe > marekt_pe
return Pipeline(
columns={
'eval': eval
},screen=(base_universe)
)
It come back with symbol not defined.
Checked the tutorials and browsed over the posts in forum, didn't seem to find a solution.
Question: how to get the market PE?