pysbr.config package¶
Submodules¶
pysbr.config.config module¶
pysbr.config.sport module¶
-
class
pysbr.config.sport.ATP¶ Bases:
pysbr.config.sport.LeagueProvides access to ATP config files.
-
class
pysbr.config.sport.Baseball¶ Bases:
pysbr.config.sport.SportProvides access to baseball config files.
-
class
pysbr.config.sport.Basketball¶ Bases:
pysbr.config.sport.SportProvides access to basketball config files.
-
class
pysbr.config.sport.BrasileiroSerieA¶ Bases:
pysbr.config.sport.LeagueProvides access to Brasileiro Serie A config files.
-
class
pysbr.config.sport.Bundesliga¶ Bases:
pysbr.config.sport.LeagueProvides access to Bundesliga config files.
-
class
pysbr.config.sport.EFLLeagueOne¶ Bases:
pysbr.config.sport.LeagueProvides access to EFL League One config files.
-
class
pysbr.config.sport.EPL¶ Bases:
pysbr.config.sport.LeagueProvides access to EPL config files.
-
class
pysbr.config.sport.Eredivisie¶ Bases:
pysbr.config.sport.LeagueProvides access to Eredivisie config files.
-
class
pysbr.config.sport.Fighting¶ Bases:
pysbr.config.sport.SportProvides access to tennis config files.
-
class
pysbr.config.sport.Football¶ Bases:
pysbr.config.sport.SportProvides access to football config files.
-
class
pysbr.config.sport.Hockey¶ Bases:
pysbr.config.sport.SportProvides access to hockey config files.
-
class
pysbr.config.sport.LaLiga¶ Bases:
pysbr.config.sport.LeagueProvides access to La Liga config files.
-
class
pysbr.config.sport.League(sport_config, league_config)¶ Bases:
pysbr.config.sport.SportProvides access to league config files.
These files hold query-relevant information about a given league.
This is a base class not meant to be directly instantiated; see subclasses for each league.
-
league_id¶ The league’s id in SBR’s database.
- Type
int
-
league_name¶ The league’s name. May differ from the name given by SBR.
- Type
str
-
abbr¶ The standard abbreviation for the league. May differ from the abbreviation given by SBR.
- Type
str
-
league_config() → Dict[str, Union[int, str, List[Dict[str, Union[int, str]]]]]¶ Get the dictionary created from the league’s config file.
The dict holds values for ‘league id’, ‘name’, ‘abbreviation’. For leagues inheriting from TeamSport, it also holds a list of all teams in the league.
-
-
class
pysbr.config.sport.Ligue1¶ Bases:
pysbr.config.sport.LeagueProvides access to Ligue 1 config files.
-
class
pysbr.config.sport.MLB¶ Bases:
pysbr.config.sport.LeagueProvides access to MLB config files.
-
class
pysbr.config.sport.NBA¶ Bases:
pysbr.config.sport.TeamLeagueProvides access to NBA config files.
-
class
pysbr.config.sport.NCAAB¶ Bases:
pysbr.config.sport.TeamLeagueProvides access to NCAAB config files.
-
class
pysbr.config.sport.NCAAF¶ Bases:
pysbr.config.sport.TeamLeagueProvides access to NCAAF config files.
-
class
pysbr.config.sport.NFL¶ Bases:
pysbr.config.sport.TeamLeagueProvides access to NFL config files.
-
class
pysbr.config.sport.NHL¶ Bases:
pysbr.config.sport.TeamLeagueProvides access to NHL config files.
-
class
pysbr.config.sport.PrimeiraLiga¶ Bases:
pysbr.config.sport.LeagueProvides access to Primeira Liga config files.
-
class
pysbr.config.sport.SerieA¶ Bases:
pysbr.config.sport.LeagueProvides access to Serie A config files.
-
class
pysbr.config.sport.Soccer¶ Bases:
pysbr.config.sport.SportProvides access to soccer config files.
-
class
pysbr.config.sport.Sport(sport_config: Dict)¶ Bases:
pysbr.config.config.ConfigProvides access to sport and league config files.
These files hold query-relevant information about a given sport.
This is a base class not meant to be directly instantiated; see subclasses for each league and sport.
-
market_names¶ Map market id to name. Used by Query.list() and Query.dataframe() in order to translate from id to name.
- Type
Dict[int, str]
-
sport_id¶ The sport’s id in SBR’s database.
- Type
int
-
default_market_id¶ The sport’s default betting market id, where the id number is from SBR.
- Type
int
-
consensus_market_ids¶ Available markets for consensus history query.
- Type
List[int]
-
market_id(term: Union[int, str]) → int¶ Given provided search term, return matching market id.
If search term is string, search for matching betting market. If search term is int, assume that it is the ID, and return it.
This method is provided as a convenience so that you don’t need to remember market id numbers. Case is ignored for search terms.
A search dictionary is utilized so that you can use common abbrevations / spelling variants for markets instead of typing them out / worrying about format.
- Example search terms, which all point to the same market id:
‘1st half over/under’ ‘1st-half totals’ ‘1st half o/u’ ‘first half totals’ ‘first-half ou’ ‘1hou’ ‘1htot’ ‘1h ou’ ‘1h tot’ ‘1H OU’ ‘1H TOT’ ‘1HOU’
- Raises
TypeError – If a provided search term is not an int or str.
ValueError – If a provided search term string cannot be matched with a market.
-
market_ids(terms: Union[List[Union[str, int]], int, str]) → List[int]¶ Given provided search terms, return a list of matching market ids.
If search term is string, search for matching betting market. If search term is int, assume that it is the ID, and insert it into the list to be returned.
This method is provided as a convenience so that you don’t need to remember market id numbers. Case is ignored for search terms.
A search dictionary is utilized so that you can use common abbrevations / spelling variants for markets instead of typing them out / worrying about format.
- Example search terms, which all point to the same market id:
‘1st half over/under’ ‘1st-half totals’ ‘1st half o/u’ ‘first half totals’ ‘first-half ou’ ‘1hou’ ‘1htot’ ‘1h ou’ ‘1h tot’ ‘1H OU’ ‘1H TOT’ ‘1HOU’
- Raises
TypeError – If a provided search term is not an int or str.
ValueError – If a provided search term string cannot be matched with a market.
-
search_translations() → Dict[str, str]¶ Get the dict containing translations for search abbreviatons / spelling variants.
This is the dict that is used Sport.market_ids().
-
sport_config() → Dict[str, Union[int, List[Dict[str, Union[str, List[Dict[str, Union[int, str]]]]]]]]¶ Get the dictionary created from the sport’s config file.
The dict holds values for ‘sport id’ and ‘default market id’, as well as a list of all markets available on the sport.
-
-
class
pysbr.config.sport.TeamLeague(sport_config, league_config)¶ Bases:
pysbr.config.sport.LeagueAdditional methods for leagues with team information in their config files.
Class must be initialized with given sport and league config files.
This class should not be directly instantiated; use league subclasses.
‘id’, ‘abbreviation’, ‘sbr abbreviation’, ‘name’, ‘nickname’, and ‘location’ are keys provided for each team in the league config file.
-
team_id(term: Union[int, str]) → int¶ Given provided search term, return matching team id.
If search term is string, search for matching team. If search term is int, assume that it is the ID, and return it.
This method is provided as a convenience so that you don’t need to remember team id numbers. Case is ignored for search terms.
- Example search terms:
Seattle Seahawks Seattle Seahawks sea SEA
- Raises
TypeError – If a search term is not an int or str.
ValueError – If a search term is ambiguous, or cannot be matched with a team.
-
team_ids(terms: Union[int, str, List[Union[str, int]]]) → List[int]¶ Given provided search terms, return a list of matching team ids.
If search term is string, search for matching team. If search term is int, assume that it is the ID, and insert it into the list to be returned.
This method is provided as a convenience so that you don’t need to remember team id numbers. Case is ignored for search terms.
- Example search terms:
Seattle Seahawks Seattle Seahawks sea SEA
- Raises
TypeError – If a search term is not an int or str.
ValueError – If a search term is ambiguous, or cannot be matched with a team.
-
-
class
pysbr.config.sport.Tennis¶ Bases:
pysbr.config.sport.SportProvides access to tennis config files.
-
class
pysbr.config.sport.UCL¶ Bases:
pysbr.config.sport.LeagueProvides access to UCL config files.
-
class
pysbr.config.sport.UEFANationsLeague¶ Bases:
pysbr.config.sport.LeagueProvides access to UEFA Nations League config files.
-
class
pysbr.config.sport.UFC¶ Bases:
pysbr.config.sport.LeagueProvides access to UFC config files.
pysbr.config.sportsbook module¶
-
class
pysbr.config.sportsbook.Sportsbook¶ Bases:
pysbr.config.config.ConfigProvides access to sportsbook config file.
In the config file there is information provided for the 27 sportsbooks found on SBR.
Note that the id returned from lines-related queries is called ‘sportsbook id’ by this application, which is translated from ‘paid’, the name returned from SBR. There is another sportsbook id that is only used by the ‘Sportsbooks’ query, that is called ‘system sportsbook id’ by this application, which is translated from ‘sbid’, the name returned from SBR. The system sportsbook id is not used by other parts of the application.
-
names¶ Map sportsbook id to name. Used by Query.list() and Query.dataframe() in order to translate from id to name. The values are lists because some ids may point to multiple sportsbooks. In this case, the sportsbooks should be aliases for one another, and have equivalent lines.
- Type
Dict[int, List[str]]
-
id(term: Union[int, str]) → Optional[int]¶ Take provided search term and return matching sportsbook id.
If search term is string, search for matching sportsbook. If search term is int, assume that it is the ID, and return it.
This method is provided as a convenience so that you don’t need to remember sportsbook id numbers. Case is ignored for search terms.
- Example search terms:
‘pinnacle’ ‘PINNACLE’ ‘bodog’ ‘bodog sportsbook’ 20
- Raises
TypeError – If a provided search term is not an int or str.
ValueError – If a provided search term string cannot be matched with a sportsbook.
-
ids(terms: Union[List[Union[str, int]], int, str]) → List[int]¶ Take provided search terms and return list of matching sportsbook ids.
If search term is string, search for matching sportsbook. If search term is int, assume that it is the ID, and insert it into the list to be returned.
This method is provided as a convenience so that you don’t need to remember sportsbook id numbers. Case is ignored for search terms.
- Example search terms:
‘pinnacle’ ‘PINNACLE’ ‘bodog’ ‘bodog sportsbook’ 20
- Raises
TypeError – If a provided search term is not an int or str.
ValueError – If a provided search term string cannot be matched with a sportsbook.
-
sportsbook_config() → List[Dict[str, Union[int, str]]]¶ Get sportsbook config list.
Each list element is a dict representing a sportsbook, with ‘name’, n ‘short name’, ‘sportsbook id’ and ‘system sportsbook id’ as keys.
-