Random Number Generator (RNG)
Other Documentation
Naming Scheme
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:
1
bettingmarkets:
2
- description:
3
en: '{teams.away}'
4
- description:
5
en: '{teams.home}'
Copied!

Overview of 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

Internal Processing

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:
1
{module.member}
Copied!
All modules are listed in the substitutions variable in decode_variables::
1
substitutions = {
2
"teams": Teams,
3
"result": Result,
4
"handicaps": Handicaps,
5
"overunder": OverUnder,
6
}
Copied!
The modules themselves (capitalized first letter) are defined in the same file and can be as easy as:
1
class Result:
2
""" Defines a few variables to be used in conjuctions with {result.X}
3
"""
4
def __init__(self, **kwargs):
5
result = kwargs.get("result", [0, 0]) or [0, 0]
6
self.hometeam = result[0]
7
self.awayteam = result[1]
8
self.total = sum([float(x) for x in result])
9
# aliases
10
self.home = self.hometeam
11
self.away = self.awayteam
12
Copied!
or as complex as:
1
class Teams:
2
""" Defines a few variables to be used in conjuctions with {teams.X}
3
"""
4
def __init__(self, **kwargs):
5
teams = kwargs.get("teams", ["", ""]) or ["", ""]
6
self.home = " ".join([
7
x.capitalize() for x in teams[0].split(" ")])
8
self.away = " ".join([
9
x.capitalize() for x in teams[1].split(" ")])
Copied!
Export as PDF
Copy link