Back to Community
Looking at all securities

It looks like all of the examples (that I could find) for multi-sid algos all specify the sids ahead of time. Is there no way to just loop through all of the stocks that had ticks on that minute in the handle_data function?


6 responses

Hello Matt,

To my knowledge, you can only get access to 10 sids per algorithm. There are plans to remove this limitation (termed "universe selection"). Last I heard, once the upgrade goes through, up to ~600 sids would be accessible. Perhaps the Quantopian guys can fill in the details and timeline?

What do you need to do?

I was mostly just curious if this could be used to assess a strategy on a broad range of securities at one time, instead of having to rerun it with specific securities over and over. As an example, how does strategy X work for all penny stocks?

Grant is correct. The current limit is 10 sids per algorithm, and we are working to expand that through universe selection.

The way universe selection will work at first will be based on the dollar-volume of stocks. Once per quarter, we take the price of the stock and multiply it by the volume traded (aka the dollar volume of the stock). We then order the stocks by dollar volume. You can then call set_universe for a fraction of that, i.e "please return all stocks between 90.0th and 90.5th percentile." You can then run your algorithm on every sid returned by that set_universe call.

We have this working on our staging environment, but we haven't been satisfied with the performance - backtests take too long. That delayed the release of the feature while we went into a cycle of benchmarking performance, improving it, repeat the process, until we're happier with the performance. I'm hopeful that we'll have at least a basic version of this feature on production later this month.

In the longer term, we have big plans for improving our stock screening. We see stock screening as a form of static analysis where you slice and dice many data sources looking for an interesting signal to trade on. That vision of a static-analysis, early-idea-refinement tool will take many months for us to build. The set_universe feature is the first step in that direction. We want to get set_universe out and see how you all use it and what feedback you have for us. That will help steer the bigger effort.

Make sense? Let me know. Thanks for the question.



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.

Makes perfect sense. Thanks for the quick response.

Thanks Dan,

It's not clear if the planned universe selection feature will accomplish what Matt is proposing. Presently, the backtester reports overall returns, etc. for a portfolio. If I understand correctly, he is interested in applying an algorithm to numerous individual securities drawn from a set of securities (e.g. "penny stocks"). With universe selection, how would we be able to compare the results of the algorithm across individual securities?

First, Quantopian is awesome. I'm so glad I discovered it! I've been writing my own backtester for some time and I'm hoping Quantopian will replace it.

Yes, a larger universe would be great. I think the ability to test simultaneously multiple variables within ranges is the key to successful algos.