Back

Is there an easy way to exclude all index or ETF stocks with Coarse function for universe selection?

When using Coarse function for universe selection like this:

IEnumerable<Symbol> MyCoarseFilterFunction(IEnumerable<CoarseFundamental> coarse) {
var stocks = (from c in coarse
where c.DollarVolume > 30000000 &&
c.Price > 30
orderby c.DollarVolume descending
select c.Symbol).Take(100).ToList();
return stocks;
}

Is there an easy way to exclude all index or ETF stocks?

Or is there a way to find out if a symbol is actually an index or ETF with code?

Update Backtest







0

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.


Hey JL Lord,

You can filter out ETFs by picking stocks which have fundamental data. Since ETFs do not have fundamental data, it should filter out all ETFs.

IEnumerable<Symbol> MyCoarseFilterFunction(IEnumerable<CoarseFundamental> coarse) {
return (from c in coarse
where c.HasFundamentalData
where c.DollarVolume > 30000000 &&
c.Price > 30
orderby c.DollarVolume descending
select c.Symbol).Take(100);
}

 

0

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.


Thanks for the suggestion. I actually tested it earlier, but it seems filtering out some stocks that have no fundmental data as well, not just ETFs.

Now I manually add all the EFT symbols I could find to be excluded manually. If there is a better way in the future, just let me know here. Thanks.

0

There is a good reason to exclude ETF for universal seclection, isn't it? Anyone runs into the same situation?

0

Hey JL Lord,

Some stocks which don't have fundamental data, like some small cap NASDAQ stocks, may end up being filtered out of the universe. However the vast majority of equities will be available in your universe. In the end, it is your decision whether you wish to make that sacrifice.

0

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.


Update Backtest





0

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.


Loading...

This discussion is closed