public void UpdateAvgMaxMin() { SQL_Action sq = new SQL_Action("server=USER-PC\\SQLEXPRESS;database=ProssibilityDatabase;Integrated Security=SSPI"); List <string> company = new List <string>(); string command = @"SELECT company FROM [StockDatabase].[dbo].[standard_analysis] group by company order by company"; gd.GetData(command, ref company); int[] days = { 5, 10, 20, 60 }; for (int j = 2; j < 7; j++) { for (int i = 0; i < company.Count; i++) { this.company = company[i]; GetData(); int index = int.Parse(company[i].Trim()) * days[1] * (-j) * 3 - j * 51; command = index + "," + company[i].Trim() + ",0," + j; for (int k = 0; k < days.Length; k++) { command += "," + AccumulateDrop((-1) * j, days[k]); } sq.AddData("[ProssibilityDatabase].[dbo].[AvgExpectation]", command); } } }
public void UpdatePossibilityAboutRoseaDay() { List <string> company = new List <string>(); InsertText IT = new InsertText(); SQL_Action sq = new SQL_Action("server=USER-PC\\SQLEXPRESS;database=ProssibilityDatabase;Integrated Security=SSPI"); string command = @"SELECT company FROM [StockDatabase].[dbo].[standard_analysis] group by company order by company"; gd.GetData(command, ref company); int[] temp = null; //for (int j = 0; j < 7; j++) //{ int j = 6; for (int i = 0; i < company.Count; i++) { this.company = company[i].Trim(); this.FirstDayRatio = j; this.DownFirstRatio = j + 1; //this.NextDayRatio = k; StockDownDay(ref temp); command = IT.RisePossibility(company[i], temp, this.startDate, this.endDate, j, this.DownFirstRatio, false); sq.AddData("[ProssibilityDatabase].[dbo].[PossibilityAboutRoseAndDrop]", command); } Console.WriteLine("加入成功 "); //} }
public string FuturePoss(int[][] data, string StartTime, string EndTime, int IsRise, int dif) { SQL_Action sq = new SQL_Action("server=USER-PC\\SQLEXPRESS;database=ProssibilityDatabase;Integrated Security=SSPI"); string[] Now = DateTime.Now.ToString("u").Trim('z').Trim('Z').Split(' '); int Index = int.Parse(StartTime.Split('-')[2]) + int.Parse(EndTime.Split('-')[2]) * (int.Parse(Now[0].Split('-')[2]) + 5) + dif; for (int i = 0; i < 3; i++) { string command = Index + ",'" + StartTime + "','" + EndTime + "','" + Now[0] + "'," + IsRise + "," + dif; command += "," + (i + 1); double AllData = 0; double Poss = 1; for (int j = 0; j < 10; j++) { command += "," + data[i][j]; AllData += data[i][j]; } command += ",0"; for (int j = 1; j < 10; j++) { Poss -= (data[i][j - 1] / AllData); double RisPoss = 1 - Poss; command += "," + RisPoss; } sq.AddData(@"[ProssibilityDatabase].[dbo].[PossibilityOfFuture]", command); } return(""); }