The market cap filter code on this page does not work:
https://www.quantconnect.com/tutorials/strategy-library/small-capitalization-stocks-premium-anomaly
After cloning the algorithm and running it I receive
'FineFundamental' object has no attribute 'MarketCap'
Can you help me find an alternative method to calculating MarketCap in the FineFundamentalFunction?
Xin Wei
Hi Jason,
We're sorry that the tutorial has errors. I've updated it. Please check out the changes in the code snippet below and the attached backtest. Let me know if you have any further questions.
market_cap = {} # Calculate the market cap and add the "MarketCap" property to fine universe object for i in fine: market_cap[i] = (i.EarningReports.BasicAverageShares.ThreeMonths * i.EarningReports.BasicEPS.TwelveMonths * i.ValuationRatios.PERatio) sorted_market_cap = sorted([x for x in fine if market_cap[x] > 0], key=lambda x: market_cap[x])
Jason Mark
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!