private void CalculateData() { //对每个股票进行分析 StockSQL.DeleteRule(); analyse_now = 0; foreach (StockData stockheader in StockApp.allstock.Values) { //初始化股票 StockData stock = StockSQL.GetStockDetail_2(stockheader.code, stockheader.name); UtilLog.AddInfo(TAG, "Start to calculate " + stock.code); int stock_length = stock.items.Length; //第几个分析的股票 analyse_now++; CalBuy(stock); CalSell(stock); prog.SetProgress(analyse_now * 100 / analyse_total); //释放内存 if (analyse_now % 100 == 0) { UtilLog.AddInfo(TAG, "Start to free memory"); GC.Collect(); UtilLog.AddInfo(TAG, "Free memory done!"); System.Threading.Thread.CurrentThread.Join(500); } UtilLog.AddInfo(TAG, analyse_now + "/" + analyse_total + ":" + stock.name + "(" + stock.code + ")" + " calculate finished "); } RuleScore.SetRuleScore(); RuleScore.SetAllPreScore(); lbl_status.Text = "Calculation Done"; }
private void truncateToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Confirm truncate!!!!!!? It'll take long time to regenerate", "Delete Stock", MessageBoxButtons.OKCancel); if (result == DialogResult.OK) { StockSQL.DeleteRule(); //rulebuy, rullsell StockSQL.DeleteStock(); //header, item, attribute, kpi, dapan StockSQL.DeleteAnalysis(); StockSQL.DeleteSimulate(); MessageBox.Show("Reset Database Done!"); } }