Game Odds
Odds Class Documentation
Represents the overall betting odds for a specific game/event.
This class handles parsing and organizing odds data from various providers, including
standardized ones (like ESPN BET) and custom formats (like Bet365). It creates instances
of Odds
, OddsBet365
, and BetValue
to model the odds for home and away teams.
Attributes:
Name | Type | Description |
---|---|---|
odds_json |
dict
|
Raw JSON data containing odds information. |
espn_instance |
PYESPN
|
The ESPN API instance used for team lookups and related methods. |
event_instance |
Event
|
The parent event associated with these odds. |
provider |
str
|
Name of the odds provider. |
over_under |
float or None
|
The total points line for the game. |
details |
str or None
|
Any extra details provided with the odds. |
spread |
float or None
|
The point spread for the game. |
over_odds |
float or None
|
Odds associated with the over. |
under_odds |
float or None
|
Odds associated with the under. |
money_line_winner |
str or None
|
The team favored in the moneyline bet. |
spread_winner |
str or None
|
The team favored against the spread. |
home_team_odds |
Odds or OddsBet365
|
Odds object for the home team. |
away_team_odds |
Odds or OddsBet365
|
Odds object for the away team. |
open |
BetValue
|
Opening odds. |
current |
BetValue
|
Current odds. |
close |
BetValue
|
Closing odds (if available for provider). |
Source code in pyespn/classes/betting.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
|
espn_instance
property
PYESPN: the espn client instance associated with the class
__init__(odds_json, espn_instance, event_instance)
Initializes a GameOdds instance with raw odds data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
odds_json
|
dict
|
The JSON data representing odds for the event. |
required |
espn_instance
|
PYESPN
|
The ESPN API interface for additional data lookups. |
required |
event_instance
|
Event
|
The associated Event instance. |
required |
Source code in pyespn/classes/betting.py
__repr__()
Returns a string representation of the GameOdds instance.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A formatted string showing the odds provider name. |
to_dict()
Converts the GameOdds instance to its original JSON dictionary.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The game odds's raw JSON data. |