jemorriso / PySBR

MIT License
77 stars 24 forks source link

Filter by bookie functionality not working?(We found just bookie name field incorrect due to sister sites/old names) #2

Closed jeremyjpj0916 closed 3 years ago

jeremyjpj0916 commented 3 years ago

Based on this snippit of code:

   # Example options found here: https://github.com/JeMorriso/PySBR/blob/main/pysbr/config/sportsbooks.yaml
    bookie_list = ['BetOnline', 'Bovada']
    game_type = ['moneyline']

    ### END OF Configurable variables ###

    dt = datetime.strptime(datetime.today().strftime('%Y-%m-%d'), '%Y-%m-%d')
    nfl = NFL()
    nba = NBA()
    sb = Sportsbook()
    e_nfl = EventsByDate(nfl.league_id, dt)
    e_nba = EventsByDate(nba.league_id, dt)
    cl_nfl = CurrentLines(e_nfl.ids(), nfl.market_ids(game_type), sb.ids(bookie_list))
    cl_nba = CurrentLines(e_nba.ids(), nba.market_ids(game_type), sb.ids(bookie_list))

I should not get getting match results like so from NBA:

        elif game.league == "NBA":
            print("NBA LEAGUE GAME PROCESSING")
            for match in cl_nba.list(e_nba):
                if match['event'].lower().find(str(game.team_chosen).lower()):  # match found
                    if match['american odds'] >= int(game.american_odds):
                        if isinstance(game.bookie_odds, int):  # If another bookie has better value replace again
                            if match['american odds'] > game.bookie_odds:
                                game.bookie = match['sportsbook']
                                game.bookie_odds = match['american odds']
                        else:
                            game.bookie = match['sportsbook']
                            game.bookie_odds = match['american odds']

image

Where SportsBetting is still in the list when I specifically filter for only ['BetOnline', 'Bovada']

Version Used: 0.2.1 Python Version: 3.9

jemorriso commented 3 years ago

Just looked into this and found that SportsBeting and BetOnline have the same ID because BetOnline was acquired by SportsBetting. So the lines should be the same, but the code needs to be fixed to return the correct name.

Same problem with Bodog and Bovada

jeremyjpj0916 commented 3 years ago

Ahh interesting. I can't say I have studied both sites(I know they are sibling sites) to see if the odds are identical between SportsBetting and BetOnline. WIll take a look around now just to confirm it.

Edit - Based on NFL and NBA I am going to say they are the same. Those pages they were identical.

jemorriso commented 3 years ago

Added 'sportsbook alias' key for duplicate ids.