I want to filter x.EarningReports.BasicAverageShares  > 100000

but converting to a number fail. What kind of result is giving?

 ----- Also is there a field to get the marketcap?

def CoarseSelectionFunction(self, coarse):
        filtered_coarse = [x for x in coarse if x.HasFundamentalData and x.Volume > self.minVolume and x.Price > self.minPrice]
        return [i.Symbol for i in filtered_coarse]

    def FineSelectionFunction(self, fine):
        filtered_fine = [x for x in fine if (x.EarningReports.BasicAverageShares and not (x.EarningReports.BasicAverageShares is None) ) ]
        filtered_fine2 = [x for x in filtered_fine if float( x.EarningReports.BasicAverageShares) > 100000 ]
        return [i.Symbol for i in filtered_fine2]

Update Backtest

Some fundamental variables have different time periods. You should specify the period. For example, 

x.EarningReports.BasicAverageShares.ThreeMonths > 100000

In terms of market cap, you could use BasicAverageShares and the current price data (by history request) to calculate the market cap. Here is an example

Thanks Jing! . help me a lot.

Last question:

What is the difference between using ThreeMonths or oneMonth or any other period? I'm interested in getting the most recent update to the day running on the backtest


Update 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.


This discussion is closed