def BriEve1(): BRIBalancedMean1 = np.mean([BRIOGoals.mean(), EVEDGoals.mean()]) EVEBalancedMean1 = np.mean([EVEOGoals.mean(), BRIDGoals.mean()]) q = 9 sim_poissonBRIEVE(nums, BRIBalancedMean1.mean(), EVEBalancedMean1.mean()) distA, distB = sim_poissonBRIEVE(10000) winPercent(distA, distB, q)
def sim_poissonBRIEVE(nums, mean1=BRIOGoals.mean() + EVEDGoals.mean(), mean2=EVEOGoals.mean() + BRIDGoals.mean()): n = 1 while n < nums: dist1 = nr.poisson(lam=mean1, size=n) dist2 = nr.poisson(lam=mean2, size=n) n = n + 1 return (dist1, dist2)
def EveCry1(): EVEBalancedMean = np.mean([EVEOGoals.mean(), CRYDGoals.mean()]) CRYBalancedMean = np.mean([CRYOGoals.mean(), EVEDGoals.mean()]) q = 9 sim_poissonEVECRY(nums, EVEBalancedMean.mean(), CRYBalancedMean.mean()) distA, distB = sim_poissonEVECRY(10000) winPercent(distA, distB, q)
def EveAvl1(): EVEBalancedMean = np.mean([EVEOGoals.mean(), AVLDGoals.mean()]) AVLBalancedMean = np.mean([AVLOGoals.mean(), EVEDGoals.mean()]) q = 4 sim_poissonEVEAVL(nums, EVEBalancedMean.mean(), AVLBalancedMean.mean()) distA, distB = sim_poissonEVEAVL(10000) winPercent(distA, distB, q)
def sim_poissonEVECRY(nums, mean1=EVEOGoals.mean() + CRYDGoals.mean(), mean2=CRYOGoals.mean() + EVEDGoals.mean()): n = 1 while n < nums: dist1 = nr.poisson(lam=mean1, size=n) dist2 = nr.poisson(lam=mean2, size=n) n = n + 1 return (dist1, dist2)
def TipicoFirstGame(game_menu_frame2, q): driver_path = r"C:\Users\ellio\Downloads\chromedriver.exe" brave_path = r"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" option = webdriver.ChromeOptions() option.binary_location = brave_path browser = webdriver.Chrome(executable_path=driver_path, options=option) browser.get( "file:///C:/Users/ellio/OneDrive/Documents/AA Project/aaa/TipicoWebsite/Premier League Wetten - englische " "Fussball Wetten mit top Quoten.html") col_names = ['Tipp 1', 'Tipp X', 'Tipp 2'] lst_odds_tipp1 = [] lst_odds_tippX = [] lst_odds_tipp2 = [] time.sleep(3) for i in range(1, 10): odds_tipp1 = browser.find_element_by_xpath('/html/body/div[1]/main/main/section/div/div/div[2]/div/a[' + str( q) + ']/div[3]/div/div/button[1]/span').text odds_tippX = browser.find_element_by_xpath('/html/body/div[1]/main/main/section/div/div/div[2]/div/a[' + str( q) + ']/div[3]/div/div/button[2]/span').text odds_tipp2 = browser.find_element_by_xpath('/html/body/div[1]/main/main/section/div/div/div[2]/div/a[' + str( q) + ']/div[3]/div/div/button[3]/span').text lst_odds_tipp1.append(odds_tipp1) lst_odds_tippX.append(odds_tippX) lst_odds_tipp2.append(odds_tipp2) df = pd.DataFrame(np.column_stack([lst_odds_tipp1, lst_odds_tippX, lst_odds_tipp2]), columns=col_names) df.style.hide_index() if q == 1: row = 1 row2 = 1 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Man City vs Leeds United", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place( x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) MCIBalancedMean = np.mean([MCIOGoals.mean(), LEEDGoals.mean()]) LEEBalancedMean = np.mean([LEEOGoals.mean(), MCIDGoals.mean()]) roundedMCI = round(MCIBalancedMean) roundedLEE = round(LEEBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Man City " + str(roundedMCI) + " : " + str( roundedLEE) + " Leeds United").place(x=30, y=50) Betway(game_menu_frame2, q, row, row2) if q == 2: row = 2 row2 = 1 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Liverpool vs Aston Villa", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a Draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) AVLBalancedMean = np.mean([AVLOGoals.mean(), LIVDGoals.mean()]) LIVBalancedMean = np.mean([LIVOGoals.mean(), AVLDGoals.mean()]) roundedLIV = round(LIVBalancedMean) roundedAVL = round(AVLBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Liverpool " + str(roundedLIV) + " : " + str( roundedAVL) + " Aston Villa").place(x=30, y=50) Betway(game_menu_frame2, q, row, row2) if q == 3: row = 3 row2 = 1 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Crystal Palace vs Chelsea", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place( x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) CRYBalancedMean = np.mean([CRYOGoals.mean(), CHEDGoals.mean()]) CHEBalancedMean = np.mean([CHEOGoals.mean(), CRYDGoals.mean()]) roundedCRY = round(CRYBalancedMean) roundedCHE = round(CHEBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Crystal Palace " + str(roundedCRY) + " : " + str( roundedCHE) + " Chelsea").place( x=30, y=50) Betway(game_menu_frame2, q, row, row2) if q == 4: row = 1 row2 = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Burnley vs Newcastle", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place( x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) BURBalancedMean = np.mean([BUROGoals.mean(), NEWDGoals.mean()]) NEWBalancedMean = np.mean([NEWOGoals.mean(), BURDGoals.mean()]) roundedBUR = round(BURBalancedMean) roundedNEW = round(NEWBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Burnley " + str(roundedBUR) + " : " + str(roundedNEW) + " Newcastle").place( x=30, y=50) Betway(game_menu_frame2, q, row, row2) if q == 5: row = 2 row2 = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="West Ham vs Leicester", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) WHUBalancedMean = np.mean([WHUOGoals.mean(), LEIDGoals.mean()]) LEIBalancedMean = np.mean([TOTOGoals.mean(), WHUDGoals.mean()]) roundedWHU = round(WHUBalancedMean) roundedLEI = round(LEIBalancedMean) Label(game_menu_frame2, text="Predicted Score line: West Ham United " + str(roundedWHU) + " : " + str( roundedLEI) + " Leicester").place(x=30, y=50) Betway(game_menu_frame2, q, row, row2) if q == 6: row2 = 2 row = 3 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Tottenham vs Man United", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) TOTBalancedMean = np.mean([TOTOGoals.mean(), MUNDGoals.mean()]) MUNBalancedMean = np.mean([MUNOGoals.mean(), TOTDGoals.mean()]) roundedTOT = round(TOTBalancedMean) roundedMUN = round(MUNBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Tottenham " + str(roundedTOT) + " : " + str( roundedMUN) + " Man United").place( x=30, y=50) Betway(game_menu_frame2, q, row, row2) if q == 7: row2 = 2 row = 4 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Sheffield United vs Arsenal", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) SHUBalancedMean = np.mean([SHUOGoals.mean(), ARSDGoals.mean()]) ARSBalancedMean = np.mean([ARSOGoals.mean(), SHUDGoals.mean()]) roundedSHU = round(SHUBalancedMean) roundedARS = round(ARSBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Sheffield United " + str(roundedSHU) + " : " + str( roundedARS) + " Arsenal").place(x=30, y=50) Betway(game_menu_frame2, q, row, row2) # These values have no Betway data as it wasn't available if q == 8: row2 = 2 row = 3 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="West Brom vs Southampton", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) WBABalancedMean = np.mean([WBAOGoals.mean(), SOUDGoals.mean()]) SOUBalancedMean = np.mean([SOUOGoals.mean(), WBADGoals.mean()]) roundedWBA = round(WBABalancedMean) roundedSOU = round(SOUBalancedMean) Label(game_menu_frame2, text="Predicted Score line: West Brom " + str(roundedWBA) + " : " + str( roundedSOU) + " Southampton").place(x=30, y=50) Betway(game_menu_frame2, q, row, row2) if q == 9: row2 = 2 row = 3 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Brighton vs Everton", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) BRIBalancedMean = np.mean([BRIOGoals.mean(), EVEDGoals.mean()]) EVEBalancedMean = np.mean([EVEOGoals.mean(), BRIDGoals.mean()]) roundedBRI = round(BRIBalancedMean) roundedEVE = round(EVEBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Brighton " + str(roundedBRI) + " : " + str( roundedEVE) + " Everton").place(x=30, y=50) Betway(game_menu_frame2, q, row, row2) else: ModelOutput(game_menu_frame2)
def TipicoFirstGame(game_menu2, game_menu_frame2, q): driver_path = r"C:\Users\ellio\Downloads\chromedriver.exe" brave_path = r"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" option = webdriver.ChromeOptions() option.binary_location = brave_path browser = webdriver.Chrome(executable_path=driver_path, options=option) browser.get( "file:///C:/Users/ellio/OneDrive/Documents/AA Project/aaa/TipicoWebsite/gw 30 eg tipico.html" ) # https://sports.tipico.de/de/alle/1101/1201,32201,30201/1301,36301,42301 col_names = ['Tipp 1', 'Tipp X', 'Tipp 2'] lst_odds_tipp1 = [] lst_odds_tippX = [] lst_odds_tipp2 = [] time.sleep(5) for i in range(1, 10): odds_tipp1 = browser.find_element_by_xpath( '/html/body/div[1]/main/main/section/div/div/div[2]/div/a[' + str(q) + ']/div[3]/div/div/button[1]/span').text odds_tippX = browser.find_element_by_xpath( '/html/body/div[1]/main/main/section/div/div/div[2]/div/a[' + str(q) + ']/div[3]/div/div/button[2]/span').text odds_tipp2 = browser.find_element_by_xpath( '/html/body/div[1]/main/main/section/div/div/div[2]/div/a[' + str(q) + ']/div[3]/div/div/button[3]/span').text lst_odds_tipp1.append(odds_tipp1) lst_odds_tippX.append(odds_tippX) lst_odds_tipp2.append(odds_tipp2) df = pd.DataFrame(np.column_stack( [lst_odds_tipp1, lst_odds_tippX, lst_odds_tipp2]), columns=col_names) df.style.hide_index() # Depending on the fixture, a different X path is needed to be inputted if q == 1: row = 1 row2 = 1 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0:1]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0:1]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Chelsea vs West Brom ", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's probability ").place(x=50, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=50, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=50, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=50, y=175) # If my model has a value higher than the bookmakers plus 8% then it recommends betting if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=50, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=50, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a Draw").place(x=50, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=50, y=200) # Predicts a scoreline by comparing finding the mean of each teams offense and defence strength CHEBalancedMean1 = np.mean([CHEOGoals.mean(), WBADGoals.mean()]) WBABalancedMean1 = np.mean([WBAOGoals.mean(), CHEDGoals.mean()]) roundedChe = round(CHEBalancedMean1) roundedWBA = round(WBABalancedMean1) Label(game_menu_frame2, text="Predicted Score line: Chelsea " + str(roundedChe) + " : " + str(roundedWBA) + " West Brom").place(x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) # Repeats for all fixtures using the different X-Path values set if q == 2: row = 1 row2 = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Leeds United vs Sheffield United", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) SHUBalancedMean = np.mean([SHUOGoals.mean(), LEEDGoals.mean()]) LEEBalancedMean = np.mean([LEEOGoals.mean(), SHUDGoals.mean()]) roundedLEE = round(LEEBalancedMean) roundedSHU = round(SHUBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Leeds United " + str(roundedLEE) + " : " + str(roundedSHU) + " Sheffield united").place(x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) if q == 3: row = 1 row2 = 3 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Leicester City vs Manchester City", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a Draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) LEIBalancedMean = np.mean([LEIOGoals.mean(), MCIDGoals.mean()]) MCIBalancedMean = np.mean([MCIOGoals.mean(), LEIDGoals.mean()]) roundedLEI = round(LEIBalancedMean) roundedMCI = round(MCIBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Leicester City " + str(roundedLEI) + " : " + str(roundedMCI) + " Manchester City").place(x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) if q == 4: row = 1 row2 = 4 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Arsenal vs Liverpool", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) ARSBalancedMean = np.mean([ARSOGoals.mean(), LIVDGoals.mean()]) LIVBalancedMean = np.mean([LIVOGoals.mean(), ARSDGoals.mean()]) roundedARS = round(ARSBalancedMean) roundedLIV = round(LIVBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Arsenal " + str(roundedARS) + " : " + str(roundedLIV) + " Liverpool").place(x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) game_menu2.mainloop() if q == 5: row2 = 1 row = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Southampton vs Burnley", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) ARSBalancedMean = np.mean([ARSOGoals.mean(), LIVDGoals.mean()]) LIVBalancedMean = np.mean([LIVOGoals.mean(), ARSDGoals.mean()]) roundedARS = round(ARSBalancedMean) roundedLIV = round(LIVBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Southampton " + str(roundedARS) + " : " + str(roundedLIV) + " Burnley").place(x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) game_menu2.mainloop() if q == 6: row2 = 2 row = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Newcastle United vs Tottenham Hotspur", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) NEWBalancedMean = np.mean([NEWOGoals.mean(), TOTDGoals.mean()]) TOTBalancedMean = np.mean([TOTOGoals.mean(), NEWDGoals.mean()]) roundedNEW = round(NEWBalancedMean) roundedTOT = round(TOTBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Newcastle United " + str(roundedNEW) + " : " + str(roundedTOT) + " Tottenham Hotspur").place(x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) game_menu2.mainloop() if q == 7: row2 = 3 row = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Aston Villa vs Fulham", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) AVLBalancedMean = np.mean([AVLOGoals.mean(), FULDGoals.mean()]) FULBalancedMean = np.mean([FULOGoals.mean(), AVLDGoals.mean()]) roundedAVL = round(AVLBalancedMean) roundedFUL = round(FULBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Aston Villa " + str(roundedAVL) + " : " + str(roundedFUL) + " Fulham").place(x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) game_menu2.mainloop() if q == 8: row2 = 4 row = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Manchester United vs Brighton", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) MUNBalancedMean = np.mean([MUNOGoals.mean(), BRIDGoals.mean()]) BRIBalancedMean = np.mean([BRIOGoals.mean(), MUNDGoals.mean()]) roundedMUN = round(MUNBalancedMean) roundedBRI = round(BRIBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Manchester United " + str(roundedMUN) + " : " + str(roundedBRI) + " Brighton").place( x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) game_menu2.mainloop() if q == 9: row2 = 1 row = 3 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Everton vs Crystal Palace", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) EVEBalancedMean = np.mean([EVEOGoals.mean(), CRYDGoals.mean()]) CRYBalancedMean = np.mean([CRYOGoals.mean(), EVEDGoals.mean()]) roundedEVE = round(EVEBalancedMean) roundedCRY = round(CRYBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Everton " + str(roundedEVE) + " : " + str(roundedCRY) + " Crystal Palace").place(x=30, y=50) Betway(game_menu2, game_menu_frame2, q, row, row2) game_menu2.mainloop() else: ModelOutput(game_menu2, game_menu_frame2)
def TipicoFirstGame(game_menu_frame2, q): driver_path = r"C:\Users\ellio\Downloads\chromedriver.exe" brave_path = r"C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" option = webdriver.ChromeOptions() option.binary_location = brave_path browser = webdriver.Chrome(executable_path=driver_path, options=option) browser.get( "file:///C:/Users/ellio/OneDrive/Documents/AA Project/aaa/TipicoWebsite/Tipico34.html" ) col_names = ['Tipp 1', 'Tipp X', 'Tipp 2'] lst_odds_tipp1 = [] lst_odds_tippX = [] lst_odds_tipp2 = [] time.sleep(3) for i in range(1, 10): odds_tipp1 = browser.find_element_by_xpath( '/html/body/div[1]/main/main/section/div/div[1]/div[2]/div/div/a[' + str(q) + ']/div[3]/div/div/button[1]/span').text odds_tippX = browser.find_element_by_xpath( '/html/body/div[1]/main/main/section/div/div[1]/div[2]/div/div/a[' + str(q) + ']/div[3]/div/div/button[2]/span').text odds_tipp2 = browser.find_element_by_xpath( '/html/body/div[1]/main/main/section/div/div[1]/div[2]/div/div/a[' + str(q) + ']/div[3]/div/div/button[3]/span').text lst_odds_tipp1.append(odds_tipp1) lst_odds_tippX.append(odds_tippX) lst_odds_tipp2.append(odds_tipp2) df = pd.DataFrame(np.column_stack( [lst_odds_tipp1, lst_odds_tippX, lst_odds_tipp2]), columns=col_names) df.style.hide_index() if q == 1: col = 1 row2 = 1 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0:1]) HomeWinP2 = int(HomeWin[3:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = (HomeSub1 * 100) / 10 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Crystal Palace vs Man City", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) MCIBalancedMean = np.mean([MCIOGoals.mean(), CRYDGoals.mean()]) CRYBalancedMean = np.mean([CRYOGoals.mean(), MCIDGoals.mean()]) roundedCRY = round(CRYBalancedMean) roundedMCI = round(MCIBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Crystal Palace " + str(roundedCRY) + " : " + str(roundedMCI) + " Man City").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 2: col = 2 row2 = 1 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Brighton vs Leeds", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a Draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) LEEBalancedMean = np.mean([LEEOGoals.mean(), BRIDGoals.mean()]) BRIBalancedMean = np.mean([BRIOGoals.mean(), LEEDGoals.mean()]) roundedBRI = round(BRIBalancedMean) roundedLEE = round(LEEBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Brighton " + str(roundedBRI) + " : " + str(roundedLEE) + " Leeds").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 3: col = 3 row2 = 1 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Chelsea vs Fulham", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) CHEBalancedMean = np.mean([CHEOGoals.mean(), FULDGoals.mean()]) FULBalancedMean = np.mean([FULOGoals.mean(), CHEDGoals.mean()]) roundedCHE = round(CHEBalancedMean) roundedFUL = round(FULBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Chelsea " + str(roundedCHE) + " : " + str(roundedFUL) + " Fulham").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 4: col = 4 row2 = 1 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Everton vs Aston Villa", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) EVEBalancedMean = np.mean([EVEOGoals.mean(), AVLDGoals.mean()]) AVLBalancedMean = np.mean([AVLOGoals.mean(), EVEDGoals.mean()]) roundedEVE = round(EVEBalancedMean) roundedAVL = round(AVLBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Everton " + str(roundedEVE) + " : " + str(roundedAVL) + " Aston Villa").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 5: col = 1 row2 = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Newcastle vs Arsenal", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) NEWBalancedMean = np.mean([NEWOGoals.mean(), ARSDGoals.mean()]) ARSBalancedMean = np.mean([ARSOGoals.mean(), NEWDGoals.mean()]) roundedNEW = round(NEWBalancedMean) roundedARS = round(ARSBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Newcastle " + str(roundedNEW) + " : " + str(roundedARS) + " Arsenal").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 6: col = 2 row2 = 2 HomeWin = df.loc[0, 'Tipp 1'] HomeWinP1 = int(HomeWin[0]) HomeWinP2 = int(HomeWin[2:4]) HomeWinP2New = HomeWinP2 / 100 HomeFinal = HomeWinP1 + HomeWinP2New HomeSub1 = 1 / HomeFinal HomeFinalNew = HomeSub1 * 100 AwayWin = df.loc[0, 'Tipp 2'] AwayWinP1 = int(AwayWin[0]) AwayWinP2 = int(AwayWin[2:4]) AwayWinP2New = AwayWinP2 / 100 AwayFinal = AwayWinP1 + AwayWinP2New AwaySub1 = 1 / AwayFinal AwayFinalNew = AwaySub1 * 100 Draw = df.loc[0, 'Tipp X'] DrawP1 = int(Draw[0]) DrawP2 = int(Draw[2:4]) DrawP2New = DrawP2 / 100 DrawFinal = DrawP1 + DrawP2New DrawSub1 = 1 / DrawFinal DrawFinalNew = DrawSub1 * 100 Label(game_menu_frame2, text="Man United vs Liverpool", bd=2, fg='#000000', pady=5, font=('Arial', 14, 'bold')).pack() Label(game_menu_frame2, text="Tipico's Probability ").place(x=30, y=100) Label(game_menu_frame2, text="Home win: " + str(float("{0:.2f}".format(HomeFinalNew)))).place(x=30, y=125) Label(game_menu_frame2, text="Away win: " + str(float("{0:.2f}".format(AwayFinalNew)))).place(x=30, y=150) Label(game_menu_frame2, text="Draw: " + str(float("{0:.2f}".format(DrawFinalNew)))).place(x=30, y=175) if Team1WinPercent > HomeFinalNew + 8: Label(game_menu_frame2, text="Bet on a Home win").place(x=30, y=200) elif Team2WinPercent > AwayFinalNew + 8: Label(game_menu_frame2, text="Bet on an Away win").place(x=30, y=200) elif DrawPercent > DrawFinalNew + 8: Label(game_menu_frame2, text="Bet on a draw").place(x=30, y=200) else: Label(game_menu_frame2, text="Ignore this bet").place(x=30, y=200) LIVBalancedMean = np.mean([LIVOGoals.mean(), MUNDGoals.mean()]) MUNBalancedMean = np.mean([MUNOGoals.mean(), LIVDGoals.mean()]) roundedLIV = round(LIVBalancedMean) roundedMUN = round(MUNBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Man United " + str(roundedMUN) + " : " + str(roundedLIV) + " Liverpool ").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2)