Odds
Odds Class Documentation
Represents betting odds for a specific team within a sporting event.
This class parses and stores betting-related data such as money lines, spreads, and associated odds types (open, current, and optionally close).
Attributes:
Name | Type | Description |
---|---|---|
odds_json |
dict
|
Raw JSON data for the odds entry. |
espn_instance |
PYESPN
|
The main ESPN API instance used for lookups. |
event_instance |
Event
|
The event this odds entry is associated with. |
gameodds_instance |
GameOdds
|
The higher-level odds grouping instance. |
favorite |
str
|
The name of the favorite team, if available. |
underdog |
str
|
The name of the underdog team, if available. |
money_line |
int or None
|
The money line value for this odds. |
spread_odds |
int or None
|
The spread odds value. |
team |
Team
|
The team associated with these odds. |
open |
OddsType
|
The opening odds. |
current |
OddsType
|
The most recent odds. |
close |
OddsType or None
|
The closing odds, if provided (e.g., for ESPN BET). |
Source code in pyespn/classes/betting.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 |
|
espn_instance
property
PYESPN: the espn client instance associated with the class
__init__(odds_json, espn_instance, event_instance, gameodds_instance)
Initializes an Odds instance from provided JSON data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
odds_json
|
dict
|
The raw JSON containing odds data for a team. |
required |
espn_instance
|
PYESPN
|
The parent API instance. |
required |
event_instance
|
Event
|
The sporting event this odds data belongs to. |
required |
gameodds_instance
|
GameOdds
|
The containing game odds context. |
required |
Source code in pyespn/classes/betting.py
__repr__()
Returns a string representation of the Odds instance.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
A string identifying the associated team. |
to_dict()
Converts the Odds instance to its original JSON dictionary.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
The odds's raw JSON data. |