I've noticed that despite having this line in my Coarse Selection Function, my backtest is picking up symbol MGM actually as MGG (foreign class of MGM) with the same price details as MGM. Not that this is a big issue for me, just something I noticed and thought I'd share.
if not stock.HasFundamentalData or stock.Price <= 1 or stock.Market != "usa":
2023-06-05 09:31:00 :MGG: Fill Price: $40.65, Total Risk: 4.18%, Stop Price: $38.952023-06-05 09:31:00 :MGG: Market Buy 24 shares | Day Open: 40.61, Previous LOD: 39.59
Mia Alissi
Based on the information provided in the extracts, it seems like you are using the
CoarseSelectionFunction
to filter out stocks based on certain criteria. However, the issue you're facing might be due to the fact that the symbol MGM is being picked up as MGG, which is a foreign class of MGM.The line of code you've shared is checking if the stock has fundamental data, if the stock price is greater than 1, and if the stock market is "usa". If any of these conditions are not met, the stock is not included in the selection.
However, this line of code does not specifically filter out foreign classes of stocks. It's possible that MGG is being included because it meets all the conditions in your filter.
Unfortunately, the extracts provided do not contain specific information on how to filter out foreign classes of stocks. You might need to add additional conditions to your filter to exclude these types of stocks.
If you need more help with this, I would recommend checking out the QuantConnect documentation or asking for help in the QuantConnect forum.
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.
Brandon Collins
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!