Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
KeyError '_29009'?

I am creating a pipeline to learn about how to use quantopian to do some research. My pipeline looks like

# Base Universe.  
base_universe = Q500US()

# Revenue Growth.  
revenue_growth = morningstar.operation_ratios.revenue_growth.latest

# Return on Invested Capital.  
roic = morningstar.operation_ratios.roic.latest

# earning yeilds = EPS/Price  
# earning_yield = morningstar.operation_ratios.earning_yield.latest  
eps_today = morningstar.earnings_report.diluted_eps.latest  

# Filtering top companies by revenue growth.  
high_revenue = revenue_growth.percentile_between(80,100, mask=base_universe)

# Filtering top companies by return on invested capital.  
high_roic = roic.percentile_between(80,100, mask=base_universe)

# Filter top companies by earning per share  
# high_eps = earning_yield.percentile_between(80, 100, mask=base_universe)  
high_eps = eps_today.percentile_between(80, 100, mask=base_universe)

# Setting filters.  
securities_of_high_growth = (high_revenue & high_roic & high_eps)

from quantopian.research import run_pipeline  
market_cap = morningstar.valuation.market_cap.latest  
pe = Fundamentals.forward_pe_ratio.latest  

pipeline = Pipeline(  
    columns={  
            'fpe': pe,  
             'market_cap': market_cap,  
        },  
        screen=securities_of_high_growth  
    )

pipeline_output = run_pipeline(  
    pipeline,  
    start_date='2017-01-01',  
    end_date='2017-12-31',  
)

# Display last 10 rows  
pipeline_output.tail(10)  

This pipeline when I ran it will results in KeyError: '_29009'. Not sure what I did wrong.

1 response

Probably best to use the 'Fundamentals' methods for data rather than 'morningstar'. It looks like your code actually uses both. Change to use all 'Fundamental' methods and it seems to work fine. Morningstar is being deprecated.

See attached notebook.