How can I select all ETFs during universe selection?
QUANTCONNECT COMMUNITY
How can I select all ETFs during universe selection?
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.
Alexandre Catarino
Hi Michael Bloomfield ,
Coarse Universe doesn't have an attribute that can be used to filter ETFs. However, since ETFs don't have fundamental data, we can get closer by using the following code to filter down to all ETFs and a few small NASDAQ tickers which also have no fundamental data:
def SelectCoarse(self, coarse): return [c.Symbol for c in coarse if not c.HasFundamentalData and c.Price > 10 and c.DollarVolume > 10000000 ]
You may need/want to tweak the Price and DollarVolume thresholds.Â
Diego Munoz
Hi, Alexandre Catarino I attempted this SelectCoarse method, but when I run backtests, I am returned empty graphs. In contrast, if I use the same SelectCoarse method but remove the 'not' (if c.HasFundamentalData), then the backtest works perfectly.Â
If I could get some assistance, I would greatly appreciate it! Thank you.
Diego Munoz
Here is my script. This is a basic portfolio rebalancing script that (hopefully soon will) allocate 20% weight to each ETF in our universe. The backtest returns empty results
I am new to QuantConnect so thank you in advance for helping me learn how to select Universes! Alexandre Catarino Michael BoguslawÂ
Diego Munoz
In comparison, if i remove the 'not' from CoarseSelectionFunction, then I am returned a complete backtest.
Diego Munoz
Alexandre CatarinoÂ
Also, I found a comment you made in a different thread that said how ETFs selected by the LiquidETFUniverse() method or VolatilityETF() method cannot be further filtered. Did I misinterpret, or is this still the case?Â
For example, if I want to select the top 5 ETFs with the greatest daily dollar volume and allocate 15% of my portfolio to each to keep 25% of my portfolio at all times in cash. Is this possible using the universe selection method of LiquidETFUniverser()?
I apologize if this has been already cleared before but I'm having trouble finding a solution.Â
Thank you in advance for your time.Â
Â
Shile Wen
Hi Diego,
What you described is not possible at the moment. However, we can replicate something similar by creating Identity indicators for the price and volume, from which we can get the Dollar Volume using IndicatorExtensions.Times on the price and volume. Then before trading, we can sort the Symbols by the value of this indicator. I've shown an example in the attached backtest.
Best,
Shile Wen
Diego Munoz
Hi Shile WenÂ
Â
Thank you for the wonderful explanation and accompanying backtest script. This has cleared up fundamental misconceptions I had with my ETF selection.
Â
Diego
Michael Boguslaw
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!