I want to sell all held positions if profit is greater than 7% , please validate below implementation

def SellProfitablePositions(self):
        """Sell all positions with unrealized profit greater than 7%, scheduled daily after market close."""
        self.Debug(f"SellProfitablePositions start at {self.Time}")
        profit_threshold = 0.07  # 7% profit threshold
        for symbol, holding in self.Portfolio.items():
            if holding.Invested and holding.UnrealizedProfitPercent > profit_threshold:
                self.Liquidate(symbol)
                self.Debug(f"Sold {symbol} with {holding.UnrealizedProfitPercent:.2%} profit at {self.Time}")
        self.Debug(f"SellProfitablePositions end at {self.Time}")