Hi there folks. I need help to define the stock universe I want to apply my trading idea to.
What code would I use to define the universe of stocks to just those within the SP500? When backtesting, would the universe use the stocks that are no longer in the SP500 today, or does the backtest just grab today's SP500 stocks and go back in time?
Jared Broad
Hi Tucker; although we don't have the S&P500 index (the S&P fees are very high) the stocks you select in a universe are using the values on the day (i.e. prices, volumes from yesterday).
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.
Tucker Barnston
OK. My goal was to study index constituents to generate trading signals for the index. Can the universe be defined by criteria like industry/sector/marketcap?
Alexandre Catarino
A universe should be defined by a combination of a coarse universe and a fine universe, where the coarse universe will serve as a pre-filter. The coarse universe selection criteria can be based on:
class CoarseFundamental { public long Volume; // Traded shares public decimal DollarVolume; // Traded shares x Price public decimal Price; // Yesterday close price public Symbol Symbol; // Asset symbol }
After you selected about 100 symbols with the coarse universe criteria, you can define a universe with the fine universe data. The avaliable data informatin can be found here.
Caleb Sandfort
If I sort by say DollarVolume in the coarse selection, will it still be sorted in fine selection?
Alexandre Catarino
If the list of symbols returned by the coarse selection function is sorted on field X, we would expect the elements in the fine parameter of the fine selection function to be in the same order.
Tucker Barnston
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!