Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Searching a Universe

I'm new here so I apologize if this is an obvious question. I went through the sample Algo's and learned a few things. I am curious how to search an entire library to decide on a stock purchase. For example if don't want to just test a strategy one stock, but I want to search a universe for a stock that best meets these parameters.
I use Portfolio123.com as a tool where I am a custom ranking system and I can download .cvs files from it. Is there a way to bring this .csv file into Quantopian and then based on the 'ranking (from 100-0)' decide what stocks to purchase if they meet certain criteria and conditions? I would like to make the stocks in this ranking as my 'universe' to search stock with.

Thanks for your help!

Chris

7 responses

Hi Chris,

There are a few techniques you can use today to select your universe on Quantopian:

  • set_universe() which calls a precomputed percentile universe based on trailing quarterly ADV (average dollar volume).
  • get_fundamentals() which lets you write queries against fundamentals data to return a universe.
  • fetcher() which let's you pull in a universe definition file from a csv hosted on any public url, you could use this to pull in your portfolio123 universe today most likely.

We're also actively working on API enhancements to make this easier in the future -- in the interest of capturing relevant use cases please share (either here publicly or privately to [email protected]) the list of criteria you would need to recreate your portfolio123 screen here and we can try to help you get set up.

Best wishes, Jess

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.

Hello Jessica, although this is not my question, your answer was extremely insightful for my current Quantopian project. In particular, the get_fundamentals() function looks quite useful, but I'm not sure I quite understand it. Could you elaborate on its exact purpose? From what I understand it will create a universe based on customizable parameters, but how exactly?

Hi Jason,

Great - happy to help! get_fundamentals lets you call on the full range of fundamental data (sourced from Morningstar) that we've integrated into the Quantopian platform. It's pretty flexible -- you can write ad hoc queries to pull fundamental data fields and then use those values in raw or derived form to rank and filter the entire universe of stocks we cover on a daily basis - returning a subset of up to 500 stocks to your algorithm per day.

Check out the sample algorithm in the help docs as a starting point and please let us know if you have more questions.

Best, Jess

Hi Jason,
the documentation has a lot of detail that you might find helpful: https://www.quantopian.com/help/#ide-fundamentals

Also, Seong did a tutorial on the topic fundamentals: https://www.quantopian.com/posts/quantopian-tutorial-lesson-3-basic-fundamentals-with-piotroski-score-growth-stocks-and-uptrending-volatile-small-cap-algorithms

Hope that helps,
Josh

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.

Wow,

This is all very helpful. Thank you for the info. I will take a look and then use your suggestion to contact you based on what I've found out vs my P123 Screen. Thanks!

Chris

Thank you all. This was a tremendous help to me. Quantopian has really done a great job at evolving their platform and making features that are easy and useful. keep up the great work!

There's also the Quantopian research platform to consider, which if you are careful with memory management, allows screening over all of the stocks in the Quantopian database. Presently, there's no way to pipe the results over to the backtester (although you could do backtesting within the reseearch environment itself). But eventually, I'd hope that'll change, or the new API Jess mentioned will do the trick (although it wasn't clear to me if arbitrary and potentially computationally intensive screens would be supported).