public decimal BackTest() { // for each instance that has a line #if DEBUG DataSet ds = tflWS.GetGames(2005, 13); #else DataSet ds = tflWS.GetAllGames(); #endif DataTable dt = ds.Tables["sched"]; foreach (DataRow dr in dt.Rows) { NFLGame game = new NFLGame(dr); NFLBet bet = IsBettable(game); if (bet != null) { switch (bet.Result()) { case "Win": M_wins++; break; case "Loss": Losses++; break; case "Push": Pushes++; break; } } } return(Utility.Clip(M_wins, Losses, Pushes)); }
public decimal BackTest() { // for each instance that has a line #if DEBUG var ds = TflWs.GetGames(2005, 13); #else DataSet ds = TflWs.GetAllGames(); #endif var dt = ds.Tables["sched"]; foreach (DataRow dr in dt.Rows) { var game = new NFLGame(dr); // TODO: cant do this for past games as the results are already built into the current ratings var bet = IsBettable(game); if (bet != null) { switch (bet.Result()) { case "Win": M_wins++; break; case "Loss": Losses++; break; case "Push": Pushes++; break; } } } //return DataLibrarian.Clip( M_wins, Losses, Pushes ); return(0.0M); }
private void LoadTeam(NflTeam team, string teamCode) { var ep = new EpMetric(); var metricsHt = new Hashtable(); var dg = _tflWs.GetAllGames(teamCode, Season); var games = dg.Tables["sched"]; foreach (DataRow drg in games.Rows) { var g = new NFLGame(drg); if (!g.IsRecent()) { continue; } if (!g.MetricsCalculated) { g.TallyMetrics(String.Empty); } var hashCode = string.Format("{0}{1}{2}", teamCode, g.Season, g.Week); if (g.IsHome(teamCode)) { ep.HomeTeam = teamCode; ep.OffTDp = g.HomeTDp; ep.OffTDr = g.HomeTDr; ep.OffSakAllowed = g.HomeSaKa; ep.DefTDp = g.AwayTDp; ep.DefTDr = g.AwayTDr; ep.DefSak = g.AwaySaKa; ep.HomePasses = g.HomePasses; ep.HomeRuns = g.HomeRuns; } else { ep.AwayTeam = g.AwayTeam; ep.OffTDp = g.AwayTDp; ep.OffTDr = g.AwayTDr; ep.OffSakAllowed = g.AwaySaKa; ep.DefTDp = g.HomeTDp; ep.DefTDr = g.HomeTDr; ep.DefSak = g.HomeSaKa; ep.AwayPasses = g.AwayPasses; ep.AwayRuns = g.AwayRuns; } if (DoBreakdowns) { AddBreakdown(teamCode, ep, g); } if (ep.Total() <= 0) { continue; } ep.WeekSeed = Utility.WeekSeed(g.Season, g.Week); if (!metricsHt.ContainsKey(hashCode)) { metricsHt.Add(hashCode, ep); } } team.SetMetrics(metricsHt); #if DEBUG //Utility.PrintIndexAndKeysAndValues( metricsHt ); #endif }