Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Small Cap U.S. stocks

Hi all,

How do I set the stocks that my algorithm looks for to just small cap (<$3.5B) companies?

Thanks in advance!

2 responses

Use pipeline to get any data you need as well as filter to the desired market cap. Maybe something like this

def make_pipeline():

    # Create a universe filter which defines our baseline set of securities  
    us_equity_universe = Filters.default_us_equity_universe_mask()  


    # Create any basic data factors that your logic will use.  
    mkt_cap = MarketCap(mask=us_equity_universe)

    # Define the columns and any screen which we want our pipeline to return  
    return Pipeline(  
            columns = {  
            'mkt_cap' : mkt_cap,  
            },  
            screen = (mkt_cap > SMALL_MKT_CAP_MIN) & (mkt_cap < SMALL_MKT_CAP_MAX)  
            )

See the attached algorithm. Note the log which records the lowest and highest market cap stock each day.

Thanks!

I am a noob, so how would I go about creating a mean reversion test to buy and sell the small cap stocks?