Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Backtesting the trading of different stocks per day

Hello,

I am a newbie at Quantopian and I apologize if this question has been answered before (I did some searching and could not find a definitive answer). Suppose I have an external program that screens all stocks traded on US exchanges and then produces a Fetcher file for the ones that I am interested in (say 10 stocks per day). These 10 stocks could change completely every day (i.e., the 10 could be selected from a list of say 7,000+ stocks that are traded on US exchanges) and I would want to daytrade them through Quantopian. So I would be flat at the end of the day.

Now suppose I could reproduce the 10 stocks that would have been selected for each day for the past 2 years. Is there a way to backtest this strategy for 2 years with Quantopian? From all that I have read, I get the feeling that the stock symbols have to stay constant throughout a Quantopian backtest. I am just double checking.

Thanks for reading.

2 responses

Hello Carl,

I'd say probably "yes" you'll be able to set up a backtest. It turns out that via update_universe, you can dynamically increase (but not decrease)the number of securities available to the algorithm (see https://www.quantopian.com/posts/how-to-create-a-symbol-from-string). I'm not familiar with fetcher, but as you suggest, I think you could provide a new list of securities every day and use update_universe to load them.

Grant

I was unable to find that thread with the search terms I was using, so thank you so much for the link to that discussion! It appears that I might be able to do what I want but I won't know for sure until I code it up. Thanks again!