Predicting stock price fluctuations is one of the important application scenarios of machine learning classification algo-rithms.According to the experience,since the data features of different stocks are not the same,the key parameter of KNN al-gorithm is adjusted when the prediction model is built.This study provides one mechanism to confirm the key parameter of KNN by the history stock data,and provides a perdition model by KNN algorithm with dynamic parameters.This model is ver-ified by different stock data,which is more accurate than any other models that all use the same parameter.