Skip to content

Instantly share code, notes, and snippets.

@thepycoach
Created December 5, 2020 23:15
Show Gist options
  • Select an option

  • Save thepycoach/57fa82c35dfe1853051a2fbd28ef1289 to your computer and use it in GitHub Desktop.

Select an option

Save thepycoach/57fa82c35dfe1853051a2fbd28ef1289 to your computer and use it in GitHub Desktop.
def beat_bookies(odds1, odds2, total_stake):
x, y = symbols('x y')
eq1 = Eq(x + y - total_stake, 0) # total_stake = x + y
eq2 = Eq((odds2*y) - odds1*x, 0) # odds1*x = odds2*y
stakes = solve((eq1,eq2), (x, y))
total_investment = stakes[x] + stakes[y]
profit1 = odds1*stakes[x] - total_stake
profit2 = odds2*stakes[y] - total_stake
benefit1 = f'{profit1 / total_investment * 100:.2f}%'
benefit2 = f'{profit2 / total_investment * 100:.2f}%'
dict_gabmling = {'Odds1':odds1, 'Odds2':odds2, 'Stake1':f'${stakes[x]:.0f}', 'Stake2':f'${stakes[y]:.0f}', 'Profit1':f'${profit1:.2f}', 'Profit2':f'${profit2:.2f}',
'Benefit1': benefit1, 'Benefit2': benefit2}
return dict_gabmling
total_stake = 100 #set your total stake
for frame in dict_surebet:
if len(dict_surebet[frame])>=1:
print('------------------SUREBETS Found! '+ frame +' (check team names)--------------------------------------------------')
print(dict_surebet[frame])
print('------------------Stakes-------------------------')
for i, value in enumerate(dict_surebet[frame]['sure_btts1']):
if value<1:
odds1 = float(dict_surebet[frame].at[i, 'btts_x'].split('\n')[0])
odds2 = float(dict_surebet[frame].at[i, 'btts_y'].split('\n')[1])
teams = dict_surebet[frame].at[i, 'Teams_x'].split('\n')
dict_1 = beat_bookies(odds1, odds2, total_stake)
print(str(i)+' '+'-'.join(teams)+ ' ----> '+ ' '.join('{}:{}'.format(x, y) for x,y in dict_1.items()))
for i, value in enumerate(dict_surebet[frame]['sure_btts2']):
if value<1:
odds1 = float(dict_surebet[frame].at[i, 'btts_x'].split('\n')[1])
odds2 = float(dict_surebet[frame].at[i, 'btts_y'].split('\n')[0])
teams = dict_surebet[frame].at[i, 'Teams_x'].split('\n')
dict_2 = beat_bookies(odds1, odds2, total_stake)
print(str(i) + ' ' + '-'.join(teams) + ' ----> ' + ' '.join('{}:{}'.format(x, y) for x, y in dict_2.items()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment