Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
BookieSports is a module that contains the management information for BOS. This management information describes the sports, event groups, events, betting market groups (BMGs) and markets that are used to be used by Bookie.
The files have multi-token support so all of the above data sets can be created differently for each token.
The configuration files are all in YAML format and the number of files varies according to the sports and events groups and teams supported.
The following is an example of a YAML file used for American Football:
The configuration files would need updating several times a year as it's not known long in advance what teams will be in certain leagues, or in the playoffs and also new sports or tokens could be added along with additional event and betting market groups.
for more details on the BookieSports schemata see:
class bookiesports.BookieSports(chain=None, override_cache=False, **kwargs)
Bases: dict
This class allows to read the data provided by BookieSports
On instantiation of this class the following procedure happens internally:
Open the directory that stores the sports
Load all Sports
For each sport, load the corresponding data subset (event groups, events, rules, participants, etc.)
Validate each data subset
Perform consistency checks
Instantiate a dictionary (self
)
As a result, the following call will return a dictionary with all the BookieSports:
Parameters:
Note: It is possible to overload a custom sports_folder by providing it to BookieSports as parameter.
BASE_FOLDER = '/home/docs/checkouts/readthedocs.org/user_builds/bookiesports/envs/latest/lib/python3.7/site-packages/bookiesports-0.4.10-py3.7.egg/bookiesports/bookiesports'
CHAIN_CACHE = {}
Singelton to store data and prevent re- reading if BookieSports is instantiated multiple times
DEFAULT_CHAIN = 'beatrice'
JSON_SCHEMA = None
Schema for validation of the data
SPORTS_FOLDER = None
chain_id
static list_chains()
static list_networks()
@deprecated, use list_chains
network
@deprecated, use self.index
network_name
@deprecated, use self.chain
static version()¶
chain (string) – One out ‘alice’, ‘beatrice’, or ‘charlie’ to identify which network we are working with. Can also be a relative path to a locally stored copy of a sports folder
override_cache (string) – if true, cache is ignored and sports folder is forcibly reloaded and put into cache
network (string) – deprecated, please use chain
bookiesports.datestring.date_to_string
(date_object=None)
rfc3339 conform string representation of a date can also be given as str YYYY-mm-dd HH:MM:SS
bookiesports.datestring.string_to_date
(date_string=None)
assumes rfc3339 conform string and creates date object
exception bookiesports.exceptions.SportsNotFoundError
Bases: Exception
exception bookiesports.normalize.EventGroupNotNormalizableException
Bases: bookiesports.normalize.NotNormalizableException
class bookiesports.normalize.IncidentsNormalizer
(chain=None)
Bases: object
This class serves as the normalization entry point for incidents. All events / event group and participant names are replaced with the counterpart stored in the BookieSports package.
DEFAULT_CHAIN
= 'beatrice'
default chosen chain for BookieSports
NOT_FOUND
= {}
As class variable to have one stream for missing normalization entries
NOT_FOUND_FILE
= None
If normalization errors should be written to file, set file here
normalize
(incident, errorIfNotFound=False)
static not_found
(key)
static use_chain
(chain, not_found_file=None)
exception bookiesports.normalize.NotNormalizableException
Bases: Exception
exception bookiesports.normalize.ParicipantNotNormalizableException
Bases: bookiesports.normalize.NotNormalizableException
exception bookiesports.normalize.SportNotNormalizableException
Bases: bookiesports.normalize.NotNormalizableException
For validation of the data format presented in the sports folder, a validation is performed.
The corresponding validation schemata are stored in the schema/ subdirectory and used internally when instantiating bookiesports.BookieSports.
Some BookieSports files (in particular name and description fields) allow the use of variables. Those are dynamic and filled in by bookie-sync, automatically.
As an example, the file MLB_ML_1.yaml defines betting markets for a Moneyline market group. The betting markets carry the name of the event participants. We encode this in BookieSports using variables:
teams:
{teams.home}: Home team
{teams.away}: Away team
result:
{teams.home}: Points for home team
{teams.away}: Points for away team
{teams.hometeam}: Points for home team
{teams.awayteam}: Points for away team
{teams.total}: Total Points
handicaps:
{teams.home}: Comparative (symmetric) Handicaps (e.g., +-2) for home team
{teams.away}: Comparative (symmetric) Handicaps (e.g., +-2) for away team
{teams.home_score}: Absolute handicap for home team (e.g., 2)
{teams.away_score}: Absolute handicap for away team (e.g., 0)
overunder:
{teams.value}: The over-/under value
The variable parsing is done in bos-sync (substitutions.py) and work through decode_variables
and a few classes that deal with the variables. This allows us to have complex variable substitutions.
The variables all consist of a module identifier and the actual member variable:
All modules are listed in the substitutions variable in decode_variables
::
The modules themselves (capitalized first letter) are defined in the same file and can be as easy as:
or as complex as:
The installation of BookieSports is very straightforward.
In the environment of bos-auto, for a new installation run:
pip3 install bookiesports
or for an existing installation run:
pip3 install bookiesports --upgrade
Then restart services.
The latest code can be found here:
After successful update of BOS, Witnesses should perform the following actions to synchronize Mainnet with the latest version of BookieSports.
Synchronization should be done as follows:
Open MINT.
Go to the MINT /proposals page (see below).
Click on the thumbs-up-and-down icon on the MINT top bar.
Approve the sync proposal by clicking the green 'approve' button.
Enter your password if prompted.
Note: Only after 50%+1 of Witnesses have approved the proposal, will it be executed and disappear from MINT so that subsequent Witnesses will not be able to see the proposal.
Note: Advanced features needs to be enabled within the .YAML configuration file for MINT in order to use this feature.
Example .YAML File:
For more information on MINT see: