How can I select all ETFs during universe selection?
Don't have an account? Join QuantConnect Today
QuantConnect Community Discussions
QUANTCONNECT COMMUNITY
LEAN is the open-source algorithmic trading engine powering QuantConnect. Founded in 2012 LEAN has been built by a global community of 180+ engineers and powers more than 300+ hedge funds today.
Join QuantConnect's Discord server for real-time support, where a vibrant community of traders and developers awaits to help you with any of your QuantConnect needs.
The Open-Quant League is a quarterly competition between universities and investment clubs for the best-performing strategy. The previous quarter's code is open-sourced, and competitors must adapt to survive.
Query on selecting all ETFs during universe selection in QuantConnect.
Continue ReadingRefer to our Research Guidelines for high quality research posts.
Create an account on QuantConnect for the latest community delivered to your inbox.
Sign Up Today
|
|
|||||||
|
|
||||||||
|
How can I select all ETFs during universe selection?
Michael Boguslaw | June 2020
How can I select all ETFs during universe selection?
QuantConnectâ„¢ 2025. All Rights Reserved
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.
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.
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.
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.
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
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.
Diego Munoz
In comparison, if i remove the 'not' from CoarseSelectionFunction, then I am returned a complete 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.
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.
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.
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
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.
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
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!