static void Main(string[] args) { #if abcd int overday = 365 * 4; using (LiveDataETLs lcb = new LiveDataETLs()) { lcb.CreateResultCollection(overday); lcb.CreateLiveCollection(); } GC.Collect(); #endif #if abcd using (HistoryDataTopDetail lcbs = new HistoryDataTopDetail()) lcbs.CreateCollection(); GC.Collect(); using (HistoryDataCalculate lcbs = new HistoryDataCalculate()) lcbs.CreateCollection(); GC.Collect(); DataMingForMatlab.DataMingForMatlabs.CreateSimCollection(); DataMingForMatlab.DataMingForMatlabs.DoSimulink(); using (StagingETLs sts = new StagingETLs()) sts.CreateLiveCollection(); GC.Collect(); #endif #if abc using (ScorePredict sp = new ScorePredict()) sp.CreateLiveCollection(); GC.Collect(); using (ScorePredictForCn sp = new ScorePredictForCn()) sp.CreateLiveCollection(); GC.Collect(); //预测结束 #endif #if abc //csv和email观察预测结果 string filename = @"ScorePredictForCn.csv"; ScorePredictForCn smo = new ScorePredictForCn(); var today_ma = smo.mongo_ScorePredictForCn.QueryMongo(); DataTable dt1 = today_ma.CopyDataTable(); DataTableToTxt.DataTable2TxtAll(dt1, filename); Console.WriteLine("ScorePredictForCnToTxt->mongo->ok"); SendPredictEmail.SendMail(filename); #endif #if abc //写入csv给R研究用 DataMingForRs.MatchNowToTxt(); DataMingForRs.MatchOverToTxt(); #endif Console.ReadKey(); }
public void CreateLiveCollection() { HistoryDataCalculate hdatacal = new HistoryDataCalculate(); var cals = hdatacal.mongo_HistoryDataCalculateDocument.QueryMongo() .Where(e => e.live == 1); foreach (var today_now in cals) { if (today_now.host_probability.match_count == 0 || today_now.away_probability.match_count == 0) continue; SimulinkMatchNowDocument smnd = new SimulinkMatchNowDocument(); smnd._id = today_now._id; smnd.match_time = (DateTime)today_now.match_prop.match_time; smnd.match_type = today_now.match_prop.match_type; smnd.home_team = today_now.match_prop.home_team; smnd.away_team = today_now.match_prop.away_team; smnd.home_team_big = (int)today_now.match_prop.home_team_big; smnd.away_team_big = (int)today_now.match_prop.away_team_big; smnd.asia_odds = today_now.match_prop.asia_odds; smnd.Hmatch_count = today_now.host_probability.match_count; smnd.Hhost_count = today_now.host_probability.host_count; smnd.Haway_count = today_now.host_probability.away_count; smnd.Htotal_wins = (double)today_now.host_probability.total_wins / smnd.Hmatch_count; smnd.Htotal_draws = (double)today_now.host_probability.total_draws / smnd.Hmatch_count; smnd.Htotal_loss = (double)today_now.host_probability.total_loss / smnd.Hmatch_count; smnd.Hhost_wins = (double)today_now.host_probability.host_wins / smnd.Hhost_count; smnd.Hhost_draws = (double)today_now.host_probability.host_draws / smnd.Hhost_count; smnd.Hhost_loss = (double)today_now.host_probability.host_loss / smnd.Hhost_count; smnd.Haway_wins = (double)today_now.host_probability.away_wins / smnd.Haway_count; smnd.Haway_draws = (double)today_now.host_probability.away_draws / smnd.Haway_count; smnd.Haway_loss = (double)today_now.host_probability.away_loss / smnd.Haway_count; smnd.Hht_total_wins = (double)today_now.host_probability.ht_total_wins / smnd.Hmatch_count; smnd.Hht_total_draws = (double)today_now.host_probability.ht_total_draws / smnd.Hmatch_count; smnd.Hht_total_loss = (double)today_now.host_probability.ht_total_loss / smnd.Hmatch_count; smnd.Hgoals_win_2o = (double)today_now.host_probability.goals_win_2o / smnd.Hmatch_count; smnd.Hgoals_win_1 = (double)today_now.host_probability.goals_win_1 / smnd.Hmatch_count; smnd.Hgoals_draw_0 = (double)today_now.host_probability.goals_draw_0 / smnd.Hmatch_count; smnd.Hgoals_loss_1 = (double)today_now.host_probability.goals_loss_1 / smnd.Hmatch_count; smnd.Hgoals_loss_2o = (double)today_now.host_probability.goals_loss_2o / smnd.Hmatch_count; smnd.Hmygoals_0 = (double)today_now.host_probability.mygoals_0 / smnd.Hmatch_count; smnd.Hmygoals_1 = (double)today_now.host_probability.mygoals_1 / smnd.Hmatch_count; smnd.Hmygoals_2 = (double)today_now.host_probability.mygoals_2 / smnd.Hmatch_count; smnd.Hmygoals_3o = (double)today_now.host_probability.mygoals_3o / smnd.Hmatch_count; smnd.Htotal_goals_0t1 = (double)today_now.host_probability.total_goals_0t1 / smnd.Hmatch_count; smnd.Htotal_goals_2t3 = (double)today_now.host_probability.total_goals_2t3 / smnd.Hmatch_count; smnd.Htotal_goals_4t6 = (double)today_now.host_probability.total_goals_4t6 / smnd.Hmatch_count; smnd.Htotal_goals_7o = (double)today_now.host_probability.total_goals_7o / smnd.Hmatch_count; smnd.Htotal_goals_double = (double)today_now.host_probability.total_goals_double / smnd.Hmatch_count; smnd.Htotal_goals_single = (double)today_now.host_probability.total_goals_single / smnd.Hmatch_count; smnd.Hscore_recent_1 = today_now.host_probability.score_recent_1; smnd.Hscore_recent_2 = today_now.host_probability.score_recent_2; smnd.Hscore_recent_3 = today_now.host_probability.score_recent_3; smnd.Hscore_recent_4 = today_now.host_probability.score_recent_4; smnd.Hscore_recent_5 = today_now.host_probability.score_recent_5; smnd.Hscore_recent_6 = today_now.host_probability.score_recent_6; smnd.Amatch_count = today_now.away_probability.match_count; smnd.Ahost_count = today_now.away_probability.host_count; smnd.Aaway_count = today_now.away_probability.away_count; smnd.Atotal_wins = (double)today_now.away_probability.total_wins / smnd.Amatch_count; smnd.Atotal_draws = (double)today_now.away_probability.total_draws / smnd.Amatch_count; smnd.Atotal_loss = (double)today_now.away_probability.total_loss / smnd.Amatch_count; smnd.Ahost_wins = (double)today_now.away_probability.host_wins / smnd.Ahost_count; smnd.Ahost_draws = (double)today_now.away_probability.host_draws / smnd.Ahost_count; smnd.Ahost_loss = (double)today_now.away_probability.host_loss / smnd.Ahost_count; smnd.Aaway_wins = (double)today_now.away_probability.away_wins / smnd.Aaway_count; smnd.Aaway_draws = (double)today_now.away_probability.away_draws / smnd.Aaway_count; smnd.Aaway_loss = (double)today_now.away_probability.away_loss / smnd.Aaway_count; smnd.Aht_total_wins = (double)today_now.away_probability.ht_total_wins / smnd.Amatch_count; smnd.Aht_total_draws = (double)today_now.away_probability.ht_total_draws / smnd.Amatch_count; smnd.Aht_total_loss = (double)today_now.away_probability.ht_total_loss / smnd.Amatch_count; smnd.Agoals_win_2o = (double)today_now.away_probability.goals_win_2o / smnd.Amatch_count; smnd.Agoals_win_1 = (double)today_now.away_probability.goals_win_1 / smnd.Amatch_count; smnd.Agoals_draw_0 = (double)today_now.away_probability.goals_draw_0 / smnd.Amatch_count; smnd.Agoals_loss_1 = (double)today_now.away_probability.goals_loss_1 / smnd.Amatch_count; smnd.Agoals_loss_2o = (double)today_now.away_probability.goals_loss_2o / smnd.Amatch_count; smnd.Amygoals_0 = (double)today_now.away_probability.mygoals_0 / smnd.Amatch_count; smnd.Amygoals_1 = (double)today_now.away_probability.mygoals_1 / smnd.Amatch_count; smnd.Amygoals_2 = (double)today_now.away_probability.mygoals_2 / smnd.Amatch_count; smnd.Amygoals_3o = (double)today_now.away_probability.mygoals_3o / smnd.Amatch_count; smnd.Atotal_goals_0t1 = (double)today_now.away_probability.total_goals_0t1 / smnd.Amatch_count; smnd.Atotal_goals_2t3 = (double)today_now.away_probability.total_goals_2t3 / smnd.Amatch_count; smnd.Atotal_goals_4t6 = (double)today_now.away_probability.total_goals_4t6 / smnd.Amatch_count; smnd.Atotal_goals_7o = (double)today_now.away_probability.total_goals_7o / smnd.Amatch_count; smnd.Atotal_goals_double = (double)today_now.away_probability.total_goals_double / smnd.Amatch_count; smnd.Atotal_goals_single = (double)today_now.away_probability.total_goals_single / smnd.Amatch_count; smnd.Ascore_recent_1 = today_now.away_probability.score_recent_1; smnd.Ascore_recent_2 = today_now.away_probability.score_recent_2; smnd.Ascore_recent_3 = today_now.away_probability.score_recent_3; smnd.Ascore_recent_4 = today_now.away_probability.score_recent_4; smnd.Ascore_recent_5 = today_now.away_probability.score_recent_5; smnd.Ascore_recent_6 = today_now.away_probability.score_recent_6; smnd.Jmatch_count = today_now.jz_probability.match_count; smnd.Jhost_count = today_now.jz_probability.host_count; smnd.Jaway_count = today_now.jz_probability.away_count; smnd.Jtotal_wins = today_now.jz_probability.total_wins; smnd.Jtotal_draws = today_now.jz_probability.total_draws; smnd.Jtotal_loss = today_now.jz_probability.total_loss; smnd.Jhost_wins = today_now.jz_probability.host_wins; smnd.Jhost_draws = today_now.jz_probability.host_draws; smnd.Jhost_loss = today_now.jz_probability.host_loss; smnd.Jaway_wins = today_now.jz_probability.away_wins; smnd.Jaway_draws = today_now.jz_probability.away_draws; smnd.Jaway_loss = today_now.jz_probability.away_loss; smnd.Jht_total_wins = today_now.jz_probability.ht_total_wins; smnd.Jht_total_draws = today_now.jz_probability.ht_total_draws; smnd.Jht_total_loss = today_now.jz_probability.ht_total_loss; smnd.Jgoals_win_2o = today_now.jz_probability.goals_win_2o; smnd.Jgoals_win_1 = today_now.jz_probability.goals_win_1; smnd.Jgoals_draw_0 = today_now.jz_probability.goals_draw_0; smnd.Jgoals_loss_1 = today_now.jz_probability.goals_loss_1; smnd.Jgoals_loss_2o = today_now.jz_probability.goals_loss_2o; smnd.Jmygoals_0 = today_now.jz_probability.mygoals_0; smnd.Jmygoals_1 = today_now.jz_probability.mygoals_1; smnd.Jmygoals_2 = today_now.jz_probability.mygoals_2; smnd.Jmygoals_3o = today_now.jz_probability.mygoals_3o; smnd.Jtotal_goals_0t1 = today_now.jz_probability.total_goals_0t1; smnd.Jtotal_goals_2t3 = today_now.jz_probability.total_goals_2t3; smnd.Jtotal_goals_4t6 = today_now.jz_probability.total_goals_4t6; smnd.Jtotal_goals_7o = today_now.jz_probability.total_goals_7o; smnd.Jtotal_goals_double = today_now.jz_probability.total_goals_double; smnd.Jtotal_goals_single = today_now.jz_probability.total_goals_single; smnd.Jscore_recent_1 = today_now.jz_probability.score_recent_1; smnd.Jscore_recent_2 = today_now.jz_probability.score_recent_2; smnd.Jscore_recent_3 = today_now.jz_probability.score_recent_3; smnd.Jscore_recent_4 = today_now.jz_probability.score_recent_4; smnd.Jscore_recent_5 = today_now.jz_probability.score_recent_5; smnd.Jscore_recent_6 = today_now.jz_probability.score_recent_6; mongocrud.MongoDropColCreateCol.Insert(smnd); } }