Hi
I wanted to know if there are ways where I can sleect and index like S & P as my universe or if I select by top dollar volume then only select equities as my universe and not ETFs.
Right now I am selecting my universe for backtest by this method
def CoarseSelectionFunction(self, coarse):
sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)
return [x.Symbol for x in sorted_by_dollar_volume[:1000]]
Mia Alissi
Yes, you can select only equities and filter out ETFs from your universe. You can do this by using fundamental data. ETFs do not have fundamental data like EV/EBITDA, so you can filter out stocks that do not have this data. Here is an example of how you can do this:
As for selecting an index like S&P 500, you can sort by market cap and take the top 500. However, this might not exactly replicate the S&P 500 as it also considers other factors.
For a more detailed example of how to select a universe that corresponds with the S&P500, you can refer to this example code from Github and the documentation on universes.
Sources:
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.
Tushar Verma
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!