Overall Statistics
class CoarseFineFundamentalRegressionAlgorithm(QCAlgorithm):

    def Initialize(self):
        self.SetStartDate(2019,1,3)   #Set Start Date
        self.SetEndDate(2019,1,4)      #Set End Date
        self.SetCash(50000)            #Set Strategy Cash
        self.UniverseSettings.Resolution = Resolution.Minute
        # this add universe method accepts two parameters:
        # - coarse selection function: accepts an IEnumerable<CoarseFundamental> and returns an IEnumerable<Symbol>
        # - fine selection function: accepts an IEnumerable<FineFundamental> and returns an IEnumerable<Symbol>
        self.AddUniverse(self.CoarseSelectionFunction, self.FineSelectionFunction)


    # return a list of three fixed symbol objects
    def CoarseSelectionFunction(self, coarse):
        Coarse_filtered_stocks = [x for x in coarse if x.DollarVolume > 0 and x.Price > 0 and x.HasFundamentalData]
        self.Debug(' coarse # of stocks {}'.format(len(Coarse_filtered_stocks)))    
        return [stock.Symbol for stock in Coarse_filtered_stocks]


    # sort the data based on what trades on NYSE
    def FineSelectionFunction(self, fine):
        filtered_fine = [x for x in fine if x.CompanyReference.PrimaryExchangeID == "NYS"]
        self.Debug(' fine # of stocks {}'.format(len(filtered_fine)))
        return [ x.Symbol for x in filtered_fine]