Back to Community
How to get a certain stock's fundamental data?

Hi all,

I'm trying to get a certain stock's fundamental data through pipeline. Following is part of my code. However, the symbol_filter does not work. I have tried several options such as symbol_filter = (Fundamentals.primary_symbol.latest == stock_symbol). They all output empty data frame. Anyone know how to filter a specific symbol? Thanks a lot.

    if len(stock_symbol) != 0:  
        symbol_filter = (str(Fundamentals.primary_symbol.latest) is stock_symbol)  
    else:  
        symbol_filter = True

    screen = (  
        (universe_filter >= 1.0) &  
        (sma_200 > 5) &  
        piotroski.isfinite() &  
        symbol_filter  
    )

    return Pipeline(  
        {'piotroski': piotroski},  
        screen=screen,  
    )

2 responses

Use either the StaticAssets or StaticSids built in filter. See the docs at https://www.quantopian.com/help#built-in-filters.

Something like this

appl  = StaticAssets(symbols(['AAPL']))  
screen = (  
        (universe_filter >= 1.0) &  
        (sma_200 > 5) &  
        piotroski.isfinite() &  
        appl  
    )

    return Pipeline(  
        {'piotroski': piotroski},  
        screen=screen,  
    )

Wow~ Many thanks, Dan! It works!

I guess I need to spend more time reading the Quantopian reference :)