public void CreateCollection() { LiveDataETLs ldata = new LiveDataETLs(); HistoryDataTopDetail hdatatop = new HistoryDataTopDetail(); foreach (var today_m in ldata.mongo_LiveDataETL.QueryMongo()) { HistoryDataCalculateDocument hdata = new HistoryDataCalculateDocument(); hdata._id = today_m._id; hdata.live = today_m.live; hdata.match_prop = new MatchModel(); hdata.match_prop.match_type = today_m.match_type; hdata.match_prop.match_time = today_m.match_time; hdata.match_prop.home_team = today_m.home_team; hdata.match_prop.away_team = today_m.away_team; hdata.match_prop.home_team_big = today_m.home_team_big; hdata.match_prop.away_team_big = today_m.away_team_big; hdata.match_prop.asia_odds = today_m.asia_odds; var host = hdatatop.mongo_HistoryDataTopHostDocument.QueryMongo() .Where(e => e._id == today_m._id) .Select(e => e.history_data_etl) .FirstOrDefault() .OrderByDescending(e => e.match_time) .ToList(); hdata.host_probability = ConvertHost(host, today_m.home_team_big); var away = hdatatop.mongo_HistoryDataTopAwayDocument.QueryMongo() .Where(e => e._id == today_m._id) .Select(e => e.history_data_etl) .FirstOrDefault() .OrderByDescending(e => e.match_time) .ToList(); hdata.away_probability = ConvertAway(away, today_m.away_team_big); var jz = hdatatop.mongo_HistoryDataTopJzDocument.QueryMongo() .Where(e => e._id == today_m._id) .Select(e => e.history_data_etl) .FirstOrDefault() .OrderByDescending(e => e.match_time) .ToList(); hdata.jz_probability = ConvertJz(jz, today_m.home_team_big, today_m.away_team_big); hdata.result_score = new PredictModel(); hdata.result_score.full_host_goals = today_m.full_home_goals; hdata.result_score.full_away_goals = today_m.full_away_goals; hdata.result_score.half_host_goals = today_m.half_home_goals; hdata.result_score.half_away_goals = today_m.half_away_goals; hdata.result_score.full_310value = get310value(today_m.full_home_goals, today_m.full_away_goals); hdata.result_score.half_310value = get310value(today_m.half_home_goals, today_m.half_away_goals); hdata.predict_score = new PredictModel();//这里还没有实现计算 mongo_HistoryDataCalculateDocument.MongoDropColCreateCol.Insert(hdata); } Console.WriteLine("HistoryDataCalculateDocument->mongo->ok"); }
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(); }