Is there any function available to get AdanceDeclineRatio for all tradable US stocks  ? If function is not available, Is below method is correct implementation ?

 

# Selecting the universe. This example uses CoarseSelectionFunction for simplicity
        self.UniverseSettings.Resolution = Resolution.Daily
        self.AddUniverse(self.CoarseSelectionFunction)
        self.yesterdayPrices = {}
def CoarseSelectionFunction(self, coarse):
        # Filtering criteria can be adjusted as needed
        filtered = [c.Symbol for c in coarse if c.Price > 10 and c.DollarVolume > 10000000]
        return filtered

    def OnData(self, data):
        advancers = 0
        decliners = 0
        
        for symbol in self.yesterdayPrices:
            if symbol in data and data[symbol] is not None:
                today_price = data[symbol].Close
                yesterday_price = self.yesterdayPrices[symbol]
                
                if today_price > yesterday_price:
                    advancers += 1
                elif today_price < yesterday_price:
                    decliners += 1

        # Calculate and log the difference
        difference = advancers - decliners
        self.Log(f"Advance-Decline Difference: {difference}")

        # Update yesterday's prices
        for symbol in data.Keys:
            self.yesterdayPrices[symbol] = data[symbol].Close