Back to Posts
Listen to Thread

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?

Thanks.

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.

Dan

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.

Log in to reply to this thread.
Not a member? Sign up!