How I made $ 30 from sports betting

Hello, Habr! In this article, I will explain how I made money from sports betting using Python and basic math. Who cares, welcome under the cut!



1



Bookmaker fork



There is such a term in sports betting as the bookmaker's fork. A surebet is a situation when the difference in the odds in two or more bookmakers allows you to place a bet on each mutually exclusive outcome with different bookmakers and remain in profit for any result. We will start looking for these surebets.



How it works?



, 16.07 . . marathonbet:



2



plusminus:



3



: 1/K1 +1/K2 1, , , ,

K1 —

K2 — .

. marathonbet , plusminus , , 1/1.125+ 1/3.92 = 1.1439909297052153. , : 1/5.7 + 1/1.24 = 0.9818902093944539 , .



?



, , : ? :

summa_min = (K1 x summa_max)/K2, K1<K2;

summa_max — , ;

summa_min — , .

. , , 100$, summa_min = ( 1.24 x100)/5.7; summa_min = 21.75438596491228$. , 5.7 21.75438596491228$, 1.24 100$, 2.2456140350877263$. , 21.75438596491228$ , , .





, , , , . :



import requests
from bs4 import BeautifulSoup
from difflib import SequenceMatcher
from collections import defaultdict


html- :



def get_html(url):
    r = requests.get(url)
    return r.text


marathonbet:



def get_all_event_marathonbet(html):
    all_players = []
    all_K = []
    soup = BeautifulSoup(html, 'lxml')
    all_event = soup.find('div',
    class_ = "sport-category-content").find_all('div',
                                class_='bg coupon-row')
    for players in all_event:
        players = players['data-event-name'].\
            replace('- ', '.').split('.')
        player_1 = players[1].strip()
        player_2 = players[3].strip()
        all_players.append(player_1)
        all_players.append(player_2)

    for g in all_event:
        K1 = g.find('td',colspan="1").find('span',
        class_="selection-link active-selection").text
        K2 = g.find('td', colspan="1").find('span',
        class_="selection-link active-selection").\
            findNext('span').text
        all_K.append(K1)
        all_K.append(K2)

    return all_players, all_K


, github. , , :



def create_arr_couple(arr_players):
    arr_couple = []
    for i in range(0, len(arr_players), 2):
        arr_couple.append(arr_players[i] + ' V '
                          + arr_players[i + 1])
    return arr_couple


, : {' V ': ['1.24', '3.92']}. :



def create_dict(arr_couple, arr_key):
    cat = defaultdict(list)
    scet = 0
    try:
        for i in range(len(arr_couple)):
            cat[arr_couple[i]].append(arr_key[scet])
            cat[arr_couple[i]].append(arr_key[scet + 1])
            scet += 2
        return dict(cat)
    except IndexError:
        print('ERROR!')


4 , :

1) :



def similar(a, b):
    return SequenceMatcher(None, a, b).ratio()


0 1, , , -. , Sarmiento , .



2) 1/K1 +1/K2 :



def find_vilka(K1, K2):
    return 1/float(K1)+1/float(K2)


3) , :



def profit(K, summa_max,summa_min):
    print(" : "+
          str((float(K)*summa_max)-summa_min-summa_max))


4) , :



def raschet_vilki(K1,K2,summa_max = 100):

    if K1<K2:
        summa_min = (float(K1)*summa_max)/float(K2)
        print('  {}'.format(K1)+
              '  {} '.format(summa_max))
        print('  {}'.format(K2) + 
              '  {} '.format(summa_min))

        profit(K1, summa_max, summa_min)

    else:
        summa_min = (float(K2) * summa_max) / float(K1)
        print('  {}'.format(K1) + 
              '  {} '.format(summa_min))
        print('  {}'.format(K2) + 
              '  {} '.format(summa_max))

        profit(K2, summa_max, summa_min)




Thus, in a little more than a month I managed to earn $ 30 with an investment of $ 120. Yes, this is not much, given that the program was written for two bookmakers, only for tennis and I monitored the odds for matches 3-5 times a day. On average, I managed to find two forks a day. Basically, there were surebets from 0. 97 and higher, which, respectively, brought only a couple of percent of the bet.




All Articles