def WhuLei1(): WHUBalancedMean = np.mean([WHUOGoals.mean(), LEIDGoals.mean()]) LEIBalancedMean = np.mean([LEIOGoals.mean(), WHUDGoals.mean()]) q = 5 sim_poissonWHULEI(nums, WHUBalancedMean.mean(), LEIBalancedMean.mean()) distA, distB = sim_poissonWHULEI(10000) winPercent(distA, distB, q)
def sim_poissonWHULEI(nums, mean1=WHUOGoals.mean() + LEIDGoals.mean(), mean2=LEIOGoals.mean() + WHUDGoals.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 LeiMci1(): LEIBalancedMean = np.mean([LEIOGoals.mean(), MCIDGoals.mean()]) MCIBalancedMean = np.mean([MCIOGoals.mean(), LEIDGoals.mean()]) q = 3 sim_poissonLEIMCI(nums, LEIBalancedMean.mean(), MCIBalancedMean.mean()) distA, distB = sim_poissonLEIMCI(10000) winPercent(distA, distB, q)
def LeiCry1(): LEIBalancedMean = np.mean([LEIOGoals.mean(), CRYDGoals.mean()]) CRYBalancedMean = np.mean([CRYOGoals.mean(), LEIDGoals.mean()]) q = 8 sim_poissonLEICRY(nums, LEIBalancedMean.mean(), CRYBalancedMean.mean()) distA, distB = sim_poissonLEICRY(10000) winPercent(distA, distB, q)
def sim_poissonLEICRY(nums, mean1=LEIOGoals.mean() + CRYDGoals.mean(), mean2=CRYOGoals.mean() + LEIDGoals.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_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/Tipico33.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 == 2: col = 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:2]) AwayWinP2 = int(AwayWin[3: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 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) LIVBalancedMean = np.mean([LIVOGoals.mean(), NEWDGoals.mean()]) NEWBalancedMean = np.mean([NEWOGoals.mean(), LIVDGoals.mean()]) roundedNEW = round(NEWBalancedMean) roundedLIV = round(LIVBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Liverpool " + str(roundedLIV) + " : " + str(roundedNEW) + " Newcastle").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 3: 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="West Ham 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) WHUBalancedMean = np.mean([WHUOGoals.mean(), CHEDGoals.mean()]) CHEBalancedMean = np.mean([CHEOGoals.mean(), WHUDGoals.mean()]) roundedCHE = round(CHEBalancedMean) roundedWHU = round(WHUBalancedMean) Label(game_menu_frame2, text="Predicted Score line: West Ham " + str(roundedWHU) + " : " + str(roundedCHE) + " Chelsea").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 4: 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="Sheffield 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) SHUBalancedMean = np.mean([SHUOGoals.mean(), BRIDGoals.mean()]) BRIBalancedMean = np.mean([BRIOGoals.mean(), SHUDGoals.mean()]) roundedSHU = round(SHUBalancedMean) roundedBRI = round(BRIBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Sheffield " + str(roundedSHU) + " : " + str(roundedBRI) + " Brighton").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="Wolves 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) WOLBalancedMean = np.mean([WOLOGoals.mean(), BURDGoals.mean()]) BURBalancedMean = np.mean([BUROGoals.mean(), WOLDGoals.mean()]) roundedWOL = round(WOLBalancedMean) roundedBUR = round(BURBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Wolves " + str(roundedWOL) + " : " + str(roundedBUR) + " Burnley").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="Leeds 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) LEEBalancedMean = np.mean([LEEOGoals.mean(), MUNDGoals.mean()]) MUNBalancedMean = np.mean([MUNOGoals.mean(), LEEDGoals.mean()]) roundedLEE = round(LEEBalancedMean) roundedMUN = round(MUNBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Leeds " + str(roundedLEE) + " : " + str(roundedMUN) + " Man United").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 7: col = 3 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="Aston Villa vs West Brom", 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(), WBADGoals.mean()]) WBABalancedMean = np.mean([WBAOGoals.mean(), AVLDGoals.mean()]) roundedAVL = round(AVLBalancedMean) roundedWBA = round(WBABalancedMean) Label(game_menu_frame2, text="Predicted Score line: Aston Villa " + str(roundedAVL) + " : " + str(roundedWBA) + " West Brom ").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2) if q == 8: col = 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 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) LEIBalancedMean = np.mean([LEIOGoals.mean(), CRYDGoals.mean()]) CRYBalancedMean = np.mean([CRYOGoals.mean(), LEIDGoals.mean()]) roundedLEI = round(LEIBalancedMean) roundedCRY = round(CRYBalancedMean) Label(game_menu_frame2, text="Predicted Score line: Leicester " + str(roundedLEI) + " : " + str(roundedCRY) + " Crystal Palace").place(x=30, y=50) Betway(game_menu_frame2, q, col, row2)