Universe consisting of all SPY stocks

How can I get a Universe consisting of all stocks which are part of common indices, such as SPY, or Nasdaq100? 

symbols = [ Symbol.Create("SPY", SecurityType.Equity, Market.USA) ]

# set algorithm framework models

Only selects the SPY etf.

This should be a standard problem, but I could not find anything in the examples.

Update Backtest

Great to see you're using the algorithm framework! The algorithm framework breaks down designing a strategy into Universe Selection, Alpha Creation, Portfolio Construction, Execution and Risk Management. Universe Selection, lets you select a universe with self.SetUniverseSelection(_universe_selection_model). In the code above you selected the manual selection model, which provides a fixed amount of assets. That is the reason why SPY is the only selection. Changing the model to the fundamental selection model will allow you to determine the universe off of coarse price and fundemental data. The bottom link shows an implementation of this very similar to what is trying to be achieved. Note that this is one of a few models that will be needed for the algorithm framework to work.

Update Backtest


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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed