I am new to using ETF data and the constituents filter and am having some issues with a NASDAQ 100 study. I need to pull the weights of the NASDAQ 100 at the start of each month and am using the QQQ ETF and ETF Constituents Model to do so. I am able to pull this information every time that new data is available but am having issues with the syntax of my scheduling function, which needs to return a list of the symbols by weight at the start of each month.
I also need to pull fundamental data on each symbol for a ranking system that will determine portfolio weighting vs. the underlying index. I specifically need to return ROIC, earnings revision ratio ((number of upwards revisions - number of downwards revisions/ number of Total EPS Revisions), and the current 5Yr. Avg. EPS estimate at the same time that my symbols list is updated by the scheduling function.
I have set aside the sections of code that are currently not functioning in the attached back test and would appreciate and help/insights. Feel free to ask any questions if my description was unclear. Thanks!
Mia Alissi
Based on the provided extracts, it seems like 'Harrison' is trying to use the ETF constituents filter to select the constituents of the QQQ ETF. However, the provided code in the
ETFConstituentsFilter
function is not correct. The function should return a list of symbols sorted by weight, but the current implementation is returning a list of all symbols for each constituent.Here is the corrected code:
This code sorts the constituents by weight in descending order and returns the symbols of the sorted constituents.
Regarding the fundamental data, the extracts provided do not contain information on how to retrieve ROIC, earnings revision ratio, and the current 5Yr. Avg. EPS estimate. However, QuantConnect does provide a way to select stocks based on corporate fundamental data powered by Morningstar®. This data includes approximately 5,000 tickers with 900 properties each. You can use a fundamental universe to select stocks based on this data.
Unfortunately, without more specific extracts or code related to the fundamental data 'Harrison' is trying to retrieve, I can't provide a more detailed answer. I would recommend 'Harrison' to refer to the QuantConnect Documentation for more information on how to use fundamental data in QuantConnect.
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.
Harrison Richard Burdge
Here are the two fixes I tried to force the algo to only debug once per month, I have commented both out as they are both causing errors when I try to run them. Any thoughts?
Mia Alissi
Based on the provided code, it seems like the issue might be with the indentation in the
ETFConstituentsFilter
method. Thereturn
statement is inside thefor
loop, which means it will return on the first iteration, effectively making the loop useless. Here's the corrected code:As for the second part of your question, to pull fundamental data on each symbol, you can use the
FineFundamental
object. However, the specific data you're looking for (ROIC, earnings revision ratio, and the current 5Yr. Avg. EPS estimate) might not be directly available. You might need to calculate these values yourself using the available data in theFineFundamental
object.To schedule the function to run at the start of each month, you can use the
Schedule
function in theInitialize
method. Here's an example:In this example,
Rebalance
is a method that you would define to handle the rebalancing of your portfolio. This method will be called at the start of each month, right after the market opens.Please note that the code snippets provided are based on the information available in the extracts and might need to be adjusted to fit your specific algorithm.
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.
Harrison Richard Burdge
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!