Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Newcomer Question regarding stock screening to trade

I have yet to fully explore the capabilities of quantopian, but I was aiming to create an algorithm that could screen through stocks, and, based off of this selection, apply the sell and buy limits and all the other normal criteria once these stocks are selected. For example, one could determine stocks with certain ratios or amounts of cash flows using an algorithm and then use these to buy and sell in a portfolio. It seemed that all stocks had to be manually entered into the algorithm, but I am unsure as to if this site can determine the stocks for you as hedge funds do when using bloomberg terminal. I am new to this but any help would be appreciated

4 responses

Hi Ricky,

Welcome! There are 3 ways to reference securities in your algorithm and each method can trade up to 200 securities:

  1. Manual lookup using symbol or sid
  2. Call set_universe to create a basket of stocks
  3. Import your own list via Fetcher

To screen stocks, you'd like to use Fetcher with the universe_func field. Here is an example that screened through the financial sector stocks of the SP500: https://www.quantopian.com/posts/define-custom-universe-via-fetcher-using-the-new-universe-func-callback

Take a look and let me know if this helps! If you have a more specific example, I can work with you to help code the strategy.

Cheers,
Alisa

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hi Alisa,

Do you mean that we can analysis any amount of symbols in the algorithm but trade up to 200?

Hi Yingzhong, it looks like you found an old post! This answer was true in 2014, and has expanded as we've added new features. Today your algorithm can trade up to 500 securities.

Now you can use the Pipeline API to screen all the stocks in our database (over 8000 securities). You can create filters to narrow down the search, and select 500 stocks to trade.

You can use our built-in filters, create custom filters, and add other screeners like get_fundamentals to use fundamental data to specify your search. Here is more info: https://www.quantopian.com/help#pipeline-title

Awesome, thanks