The purpose of this paper is to analyze the relationship between commodity sales volume, commodity types, sales time, etc., and propose a decision model to predict future sales data through historical sales data to determine a reasonable pricing strategy. First, the collected data is preprocessed. Through correlation analysis, the most important influencing factors of commodity sales are obtained. Through the construction of XGBoost model to model the influence factors obtained, the wholesale prices of chili products (yuan/kg) from July 1 to 7, 2023 are 3.63, 6.68, 6.90, 5.44, 6.62, 6.90, 5.44, respectively. In order to further develop a reasonable pricing strategy, this paper constructs a model based on cosine annealing algorithm combined with dynamic pricing algorithm. Through this model, it is calculated that from July 1 to 7, 2023, the restocking quantity (kg) of chili products is 234.20, 95.85, 110.04, 179.77, 176.60, 110.04, respectively. 179.77. Profit (Yuan) is 148.81, 298.96, 347.82, 370.75, 287.54, 356.33, 383.00. By comparing the model with the actual data, the error of the model is small and the robustness is high, which provides an effective decision-making model for supermarkets to formulate commodity sales strategy.