KNN written with python Using pandas, numpy, scipy, tushare The stock data is gotten by tushare Using Mahalanobis distance instead of Euclidean distance Calculating the significance level to make sure the model really works Giving the operating advice for the next day