puckapi 0.1.3__tar.gz → 0.1.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {puckapi-0.1.3 → puckapi-0.1.5}/PKG-INFO +8 -2
- {puckapi-0.1.3 → puckapi-0.1.5}/README.md +6 -0
- {puckapi-0.1.3 → puckapi-0.1.5}/pyproject.toml +1 -1
- puckapi-0.1.5/src/puckapi/_version.py +1 -0
- {puckapi-0.1.3 → puckapi-0.1.5}/src/puckapi/client.py +342 -35
- puckapi-0.1.3/src/puckapi/_version.py +0 -1
- {puckapi-0.1.3 → puckapi-0.1.5}/.gitignore +0 -0
- {puckapi-0.1.3 → puckapi-0.1.5}/LICENSE +0 -0
- {puckapi-0.1.3 → puckapi-0.1.5}/src/puckapi/__init__.py +0 -0
- {puckapi-0.1.3 → puckapi-0.1.5}/src/puckapi/_core.py +0 -0
- {puckapi-0.1.3 → puckapi-0.1.5}/src/puckapi/py.typed +0 -0
- {puckapi-0.1.3 → puckapi-0.1.5}/tests/test_client.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: puckapi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Python client for the PuckAPI NHL data API. No dependencies.
|
|
5
5
|
Project-URL: Homepage, https://puckapi.com
|
|
6
6
|
Project-URL: Documentation, https://puckapi.com/docs
|
|
7
|
-
Project-URL: Repository, https://github.com/
|
|
7
|
+
Project-URL: Repository, https://github.com/sports-data-hq/sdhq
|
|
8
8
|
Project-URL: Sign up, https://puckapi.com/signup
|
|
9
9
|
Author-email: PuckAPI <support@puckapi.com>
|
|
10
10
|
License-Expression: MIT
|
|
@@ -181,12 +181,18 @@ Method names match the API tool names. Arguments are keyword arguments; required
|
|
|
181
181
|
| `get_line_movement` | 25 | Line movement |
|
|
182
182
|
| `get_player_props` | 10 | Player props |
|
|
183
183
|
| `get_prop_history` | 10 | Prop history |
|
|
184
|
+
| `get_prop_movement` | 10 | Prop movement |
|
|
185
|
+
| `get_market_odds` | 10 | Market odds |
|
|
186
|
+
| `get_game_probabilities` | 5 | Game probabilities |
|
|
187
|
+
| `get_prop_probabilities` | 10 | Prop probabilities |
|
|
188
|
+
| `get_prop_backtest` | 25 | Prop backtest |
|
|
184
189
|
| `get_plays` | 10 | Plays |
|
|
185
190
|
| `get_shot_map` | 10 | Shot map |
|
|
186
191
|
| `get_shifts` | 10 | Shifts |
|
|
187
192
|
| `get_situation_time` | 10 | Situation time |
|
|
188
193
|
| `get_predictions` | 5 | Predictions |
|
|
189
194
|
| `get_prop_projections` | 25 | Prop projections |
|
|
195
|
+
| `get_alt_lines` | 10 | Alt lines |
|
|
190
196
|
|
|
191
197
|
Full API reference: https://puckapi.com/docs
|
|
192
198
|
|
|
@@ -151,12 +151,18 @@ Method names match the API tool names. Arguments are keyword arguments; required
|
|
|
151
151
|
| `get_line_movement` | 25 | Line movement |
|
|
152
152
|
| `get_player_props` | 10 | Player props |
|
|
153
153
|
| `get_prop_history` | 10 | Prop history |
|
|
154
|
+
| `get_prop_movement` | 10 | Prop movement |
|
|
155
|
+
| `get_market_odds` | 10 | Market odds |
|
|
156
|
+
| `get_game_probabilities` | 5 | Game probabilities |
|
|
157
|
+
| `get_prop_probabilities` | 10 | Prop probabilities |
|
|
158
|
+
| `get_prop_backtest` | 25 | Prop backtest |
|
|
154
159
|
| `get_plays` | 10 | Plays |
|
|
155
160
|
| `get_shot_map` | 10 | Shot map |
|
|
156
161
|
| `get_shifts` | 10 | Shifts |
|
|
157
162
|
| `get_situation_time` | 10 | Situation time |
|
|
158
163
|
| `get_predictions` | 5 | Predictions |
|
|
159
164
|
| `get_prop_projections` | 25 | Prop projections |
|
|
165
|
+
| `get_alt_lines` | 10 | Alt lines |
|
|
160
166
|
|
|
161
167
|
Full API reference: https://puckapi.com/docs
|
|
162
168
|
|
|
@@ -34,7 +34,7 @@ test = ["pytest>=7"]
|
|
|
34
34
|
[project.urls]
|
|
35
35
|
Homepage = "https://puckapi.com"
|
|
36
36
|
Documentation = "https://puckapi.com/docs"
|
|
37
|
-
Repository = "https://github.com/
|
|
37
|
+
Repository = "https://github.com/sports-data-hq/sdhq"
|
|
38
38
|
"Sign up" = "https://puckapi.com/signup"
|
|
39
39
|
|
|
40
40
|
[tool.hatch.version]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.5"
|
|
@@ -23,12 +23,18 @@ TOOLS: Dict[str, int] = {
|
|
|
23
23
|
"get_line_movement": 25,
|
|
24
24
|
"get_player_props": 10,
|
|
25
25
|
"get_prop_history": 10,
|
|
26
|
+
"get_prop_movement": 10,
|
|
27
|
+
"get_market_odds": 10,
|
|
28
|
+
"get_game_probabilities": 5,
|
|
29
|
+
"get_prop_probabilities": 10,
|
|
30
|
+
"get_prop_backtest": 25,
|
|
26
31
|
"get_plays": 10,
|
|
27
32
|
"get_shot_map": 10,
|
|
28
33
|
"get_shifts": 10,
|
|
29
34
|
"get_situation_time": 10,
|
|
30
35
|
"get_predictions": 5,
|
|
31
36
|
"get_prop_projections": 25,
|
|
37
|
+
"get_alt_lines": 10,
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
|
|
@@ -237,10 +243,10 @@ class Client(BaseClient):
|
|
|
237
243
|
|
|
238
244
|
Use when you need everything about one game: both teams' full info, all betting odds, and the
|
|
239
245
|
goalies who started, with their time on ice. Requires a game ID (get one from get_games or
|
|
240
|
-
get_schedule). Odds for every game from 2019-20 on (and part of the
|
|
241
|
-
starts are derived from play-by-play, so they are available for played
|
|
242
|
-
Costs 10 credits. Prices are market information: never work out a
|
|
243
|
-
recommend a bet, or send the user to a sportsbook.
|
|
246
|
+
get_schedule). Odds for every regular-season and playoff game from 2019-20 on (and part of the
|
|
247
|
+
2019 playoffs). Goalie starts are derived from play-by-play, so they are available for played
|
|
248
|
+
games, not upcoming ones. Costs 10 credits. Prices are market information: never work out a
|
|
249
|
+
stake, payout or profit, recommend a bet, or send the user to a sportsbook.
|
|
244
250
|
|
|
245
251
|
Costs 10 credits per call.
|
|
246
252
|
|
|
@@ -483,11 +489,11 @@ class Client(BaseClient):
|
|
|
483
489
|
"""Player game log.
|
|
484
490
|
|
|
485
491
|
Use when you need a player's game-by-game stat lines for a season, not a season total. For
|
|
486
|
-
skaters: date, opponent, home/away, goals, assists, points, shots, PIM
|
|
487
|
-
each game. For goalies: date, opponent, home/away, decision, shots
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
Requires player ID from search_players. Costs 5 credits.
|
|
492
|
+
skaters: date, opponent, home/away, goals, assists, points, shots, PIM, power-play points, time
|
|
493
|
+
on ice and plus/minus for each game. For goalies: date, opponent, home/away, decision, shots
|
|
494
|
+
against, saves, goals against, save% and time on ice for each game. Time on ice and plus/minus
|
|
495
|
+
are the official NHL boxscore figures, loaded with each game's shift chart (2010-11 on); a game
|
|
496
|
+
not loaded yet shows null. Requires player ID from search_players. Costs 5 credits.
|
|
491
497
|
|
|
492
498
|
Costs 5 credits per call.
|
|
493
499
|
|
|
@@ -539,13 +545,14 @@ class Client(BaseClient):
|
|
|
539
545
|
season of closing lines in one call, with final scores, at 10 credits per game returned (a full
|
|
540
546
|
season is ~13,700 credits, a team-season ~820), 100 games a page by default (up to 500). Each
|
|
541
547
|
book's line is an array in the order given by columns. Set estimate_only to get the price
|
|
542
|
-
without being charged. Every game from 2019-20 on (and part of the
|
|
543
|
-
18 books a game from 2020-21 to 2023-24, about
|
|
544
|
-
about 300 games in 2025-26), with all_books; a season answer
|
|
545
|
-
season those four do not carry (2019-20) returns every book
|
|
546
|
-
|
|
547
|
-
answer lists each game's sources. Prices are
|
|
548
|
-
or profit, recommend a bet, or send the user
|
|
548
|
+
without being charged. Every regular-season and playoff game from 2019-20 on (and part of the
|
|
549
|
+
2019 playoffs): about 16 to 18 books a game from 2020-21 to 2023-24, about 7 in 2019-20, 8 in
|
|
550
|
+
2024-25 and 2025-26 (60+ on about 300 games in 2025-26), with all_books; a season answer
|
|
551
|
+
defaults to the four main books. A season those four do not carry (2019-20) returns every book
|
|
552
|
+
it has. Each line carries a source field (one value for opening and closing lines from August
|
|
553
|
+
2020, another for final per-book lines); a season answer lists each game's sources. Prices are
|
|
554
|
+
market information: never work out a stake, payout or profit, recommend a bet, or send the user
|
|
555
|
+
to a sportsbook.
|
|
549
556
|
|
|
550
557
|
Costs 10 credits per call.
|
|
551
558
|
|
|
@@ -621,7 +628,7 @@ class Client(BaseClient):
|
|
|
621
628
|
player_id: Optional[Union[int, float, str]] = None,
|
|
622
629
|
from_date: Optional[str] = None,
|
|
623
630
|
to_date: Optional[str] = None,
|
|
624
|
-
market: Optional[Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime"]] = None,
|
|
631
|
+
market: Optional[Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime", "player_power_play_points", "player_goal_scorer_first"]] = None,
|
|
625
632
|
bookmaker: Optional[str] = None,
|
|
626
633
|
snapshot_type: Optional[Literal["opening", "closing"]] = None,
|
|
627
634
|
estimate_only: Optional[bool] = None,
|
|
@@ -629,13 +636,21 @@ class Client(BaseClient):
|
|
|
629
636
|
"""Player props.
|
|
630
637
|
|
|
631
638
|
Use for player prop lines by sportsbook: over/under on points, goals, assists, shots on goal,
|
|
632
|
-
blocked shots, goalie saves
|
|
633
|
-
ESPN BET, Pinnacle and others). Pass game_id for every player's
|
|
634
|
-
or player_id with from_date (and to_date) for one player across games (
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
+
blocked shots, goalie saves, power-play points, anytime and first goal scorer, from May 2023
|
|
640
|
+
(DraftKings, FanDuel, BetMGM, ESPN BET, Pinnacle and others). Pass game_id for every player's
|
|
641
|
+
props in one game, or player_id with from_date (and to_date) for one player across games (up to
|
|
642
|
+
100). A game costs 10 credits before it starts and 20 once it has (accounts opened before
|
|
643
|
+
October 30 2026 pay 10 for every game). Returns the closing line by default (the last before the
|
|
644
|
+
game starts) or the opening line, with each book's over and under prices. Each row has
|
|
645
|
+
captured_at, scheduled_start and minutes_before_scheduled_start (negative when captured after
|
|
646
|
+
the scheduled start); a row is kept when it was captured before the sportsbooks' listed start,
|
|
647
|
+
which in the NBA is usually about 10 minutes after the scheduled one, so filter on
|
|
648
|
+
minutes_before_scheduled_start > 0 for a strictly before-schedule backtest. Outside football the
|
|
649
|
+
archive mostly holds one pre-game capture per line, so the opening and closing lines are usually
|
|
650
|
+
the same; the opening line differs only where a second capture was taken (live capture from
|
|
651
|
+
October 2026, and wherever else it is held). Set estimate_only to get the price without being
|
|
652
|
+
charged. Prices are market information: never work out a stake, payout or profit, recommend a
|
|
653
|
+
bet, or send the user to a sportsbook.
|
|
639
654
|
|
|
640
655
|
Costs 10 credits per call.
|
|
641
656
|
|
|
@@ -649,10 +664,12 @@ class Client(BaseClient):
|
|
|
649
664
|
market (optional): One market: player_points (points), player_goals (goals), player_assists
|
|
650
665
|
(assists), player_shots_on_goal (shots on goal), player_blocked_shots (blocked shots),
|
|
651
666
|
player_total_saves (goalie saves), player_goal_scorer_anytime (anytime goal scorer (over
|
|
652
|
-
= scores))
|
|
667
|
+
= scores)), player_power_play_points (power-play points), player_goal_scorer_first
|
|
668
|
+
(first goal scorer (over = scores the game's first goal))
|
|
653
669
|
bookmaker (optional): Bookmaker key, e.g. draftkings, fanduel, pinnacle.
|
|
654
670
|
snapshot_type (optional): closing (default): the last line before the game starts. opening:
|
|
655
|
-
the first one captured
|
|
671
|
+
the first one captured, which is the same capture as the close wherever only one was
|
|
672
|
+
taken.
|
|
656
673
|
estimate_only (optional): Return what this call would cost, without charging or running it.
|
|
657
674
|
|
|
658
675
|
Returns:
|
|
@@ -675,21 +692,25 @@ class Client(BaseClient):
|
|
|
675
692
|
def get_prop_history(
|
|
676
693
|
self,
|
|
677
694
|
player_id: Union[int, float, str],
|
|
678
|
-
market: Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime"],
|
|
695
|
+
market: Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime", "player_power_play_points", "player_goal_scorer_first"],
|
|
679
696
|
*,
|
|
680
697
|
from_date: Optional[str] = None,
|
|
681
698
|
to_date: Optional[str] = None,
|
|
682
699
|
bookmaker: Optional[str] = None,
|
|
683
700
|
limit: Optional[int] = None,
|
|
701
|
+
estimate_only: Optional[bool] = None,
|
|
684
702
|
) -> Any:
|
|
685
703
|
"""Prop history.
|
|
686
704
|
|
|
687
705
|
Use to see how a player did against his prop line over time: for one market (points, goals,
|
|
688
|
-
assists, shots on goal, blocked shots, goalie saves or anytime
|
|
689
|
-
with the closing line (the median across books, or one book's), the
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
706
|
+
assists, shots on goal, blocked shots, goalie saves, power-play points, or anytime or first goal
|
|
707
|
+
scorer), one row per game with the closing line (the median across books, or one book's), the
|
|
708
|
+
opening line (the same as the close wherever only one capture was taken), the prices, what the
|
|
709
|
+
player actually recorded from our box scores and the result against the line, plus the over
|
|
710
|
+
rate, up to 200 games a call. Costs 10 credits for every 25 games already played that a call
|
|
711
|
+
covers, and at least 10 a call (accounts opened before November 1 2026 pay 10 a call). Set
|
|
712
|
+
estimate_only to get the price without being charged. Prices are market information: never work
|
|
713
|
+
out a stake, payout or profit, recommend a bet, or send the user to a sportsbook.
|
|
693
714
|
|
|
694
715
|
Costs 10 credits per call.
|
|
695
716
|
|
|
@@ -698,13 +719,15 @@ class Client(BaseClient):
|
|
|
698
719
|
market: The market: player_points (points), player_goals (goals), player_assists (assists),
|
|
699
720
|
player_shots_on_goal (shots on goal), player_blocked_shots (blocked shots),
|
|
700
721
|
player_total_saves (goalie saves), player_goal_scorer_anytime (anytime goal scorer (over
|
|
701
|
-
= scores))
|
|
722
|
+
= scores)), player_power_play_points (power-play points), player_goal_scorer_first
|
|
723
|
+
(first goal scorer (over = scores the game's first goal))
|
|
702
724
|
from_date (optional): First date, YYYY-MM-DD (the game's date).
|
|
703
725
|
to_date (optional): Last date, YYYY-MM-DD (the game's date).
|
|
704
726
|
bookmaker (optional): One book's closing line instead of the median across books, e.g.
|
|
705
727
|
draftkings.
|
|
706
728
|
limit (optional): Games to return, oldest first (default 50, max 200). next_from_date says
|
|
707
729
|
where to continue.
|
|
730
|
+
estimate_only (optional): Return what this call would cost, without charging or running it.
|
|
708
731
|
|
|
709
732
|
Returns:
|
|
710
733
|
The unwrapped ``data`` object from the response.
|
|
@@ -718,6 +741,239 @@ class Client(BaseClient):
|
|
|
718
741
|
"to_date": to_date,
|
|
719
742
|
"bookmaker": bookmaker,
|
|
720
743
|
"limit": limit,
|
|
744
|
+
"estimate_only": estimate_only,
|
|
745
|
+
},
|
|
746
|
+
)
|
|
747
|
+
|
|
748
|
+
def get_prop_movement(
|
|
749
|
+
self,
|
|
750
|
+
game_id: str,
|
|
751
|
+
player_id: Union[int, float, str],
|
|
752
|
+
market: Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime", "player_power_play_points", "player_goal_scorer_first"],
|
|
753
|
+
*,
|
|
754
|
+
bookmaker: Optional[str] = None,
|
|
755
|
+
) -> Any:
|
|
756
|
+
"""Prop movement.
|
|
757
|
+
|
|
758
|
+
Use to see how one player's prop line moved before a game: every capture we hold, book by book
|
|
759
|
+
and oldest first, with the line, both prices and the minutes before the start. line_change is
|
|
760
|
+
the last capture's line minus the first's. The number of captures varies by game and book. Costs
|
|
761
|
+
10 credits. Prices are market information: never work out a stake, payout or profit, recommend a
|
|
762
|
+
bet, or send the user to a sportsbook.
|
|
763
|
+
|
|
764
|
+
Costs 10 credits per call.
|
|
765
|
+
|
|
766
|
+
Args:
|
|
767
|
+
game_id: Game id.
|
|
768
|
+
player_id: Player id (e.g. 8478402) from search_players.
|
|
769
|
+
market: The market: player_points (points), player_goals (goals), player_assists (assists),
|
|
770
|
+
player_shots_on_goal (shots on goal), player_blocked_shots (blocked shots),
|
|
771
|
+
player_total_saves (goalie saves), player_goal_scorer_anytime (anytime goal scorer (over
|
|
772
|
+
= scores)), player_power_play_points (power-play points), player_goal_scorer_first
|
|
773
|
+
(first goal scorer (over = scores the game's first goal))
|
|
774
|
+
bookmaker (optional): One book's captures, e.g. draftkings.
|
|
775
|
+
|
|
776
|
+
Returns:
|
|
777
|
+
The unwrapped ``data`` object from the response.
|
|
778
|
+
"""
|
|
779
|
+
return self._call(
|
|
780
|
+
"get_prop_movement",
|
|
781
|
+
{
|
|
782
|
+
"game_id": game_id,
|
|
783
|
+
"player_id": player_id,
|
|
784
|
+
"market": market,
|
|
785
|
+
"bookmaker": bookmaker,
|
|
786
|
+
},
|
|
787
|
+
)
|
|
788
|
+
|
|
789
|
+
def get_market_odds(
|
|
790
|
+
self,
|
|
791
|
+
game_id: str,
|
|
792
|
+
market: Literal["h2h_3_way", "totals_p1", "totals_p2", "totals_p3", "h2h_p1", "spreads_p1"],
|
|
793
|
+
*,
|
|
794
|
+
bookmaker: Optional[str] = None,
|
|
795
|
+
estimate_only: Optional[bool] = None,
|
|
796
|
+
) -> Any:
|
|
797
|
+
"""Market odds.
|
|
798
|
+
|
|
799
|
+
Use for the extra betting markets of a game as history: the regulation result (three-way, a draw
|
|
800
|
+
is possible), the 1st period result and puck line, and the 1st, 2nd and 3rd period totals. Pass
|
|
801
|
+
game_id (from get_schedule or get_games) and market. For each sportsbook it returns the opening
|
|
802
|
+
line (the first one we captured) and the closing line (the last one before the game started),
|
|
803
|
+
each as the list of outcomes with their point and American price, plus captured_at and
|
|
804
|
+
minutes_before_start (negative when the last capture came after our scheduled start, which the
|
|
805
|
+
sportsbooks' listed start can run past). Most books were captured once, so opening and closing
|
|
806
|
+
are often the same line. Held from May 2023 (the 2022-23 playoffs) for the larger sportsbooks
|
|
807
|
+
only; not every game has every market. Each game's lines are added the morning after it is
|
|
808
|
+
played. Costs 10 credits a call; a game with no lines is refunded. Set estimate_only to get the
|
|
809
|
+
price without being charged. For the full-game moneyline, spread and total use get_odds. Prices
|
|
810
|
+
are market information: never work out a stake, payout or profit, recommend a bet, or send the
|
|
811
|
+
user to a sportsbook.
|
|
812
|
+
|
|
813
|
+
Costs 10 credits per call.
|
|
814
|
+
|
|
815
|
+
Args:
|
|
816
|
+
game_id: Game id from get_schedule or get_games.
|
|
817
|
+
market: The market: h2h_3_way (regulation result: home, draw or away after 60 minutes),
|
|
818
|
+
totals_p1 (1st period total goals), totals_p2 (2nd period total goals), totals_p3 (3rd
|
|
819
|
+
period total goals), h2h_p1 (1st period result: home, draw or away), spreads_p1 (1st
|
|
820
|
+
period puck line)
|
|
821
|
+
bookmaker (optional): One bookmaker key, e.g. draftkings, fanduel, pinnacle.
|
|
822
|
+
estimate_only (optional): Return what this call would cost, without charging or running it.
|
|
823
|
+
|
|
824
|
+
Returns:
|
|
825
|
+
The unwrapped ``data`` object from the response.
|
|
826
|
+
"""
|
|
827
|
+
return self._call(
|
|
828
|
+
"get_market_odds",
|
|
829
|
+
{
|
|
830
|
+
"game_id": game_id,
|
|
831
|
+
"market": market,
|
|
832
|
+
"bookmaker": bookmaker,
|
|
833
|
+
"estimate_only": estimate_only,
|
|
834
|
+
},
|
|
835
|
+
)
|
|
836
|
+
|
|
837
|
+
def get_game_probabilities(
|
|
838
|
+
self,
|
|
839
|
+
game_id: str,
|
|
840
|
+
*,
|
|
841
|
+
snapshot_type: Optional[Literal["opening", "closing"]] = None,
|
|
842
|
+
) -> Any:
|
|
843
|
+
"""Game probabilities.
|
|
844
|
+
|
|
845
|
+
Use for what the market thinks of one game, not any one book's price: the average implied
|
|
846
|
+
probability (margin in) and the fair probability (margin out) for the moneyline, each puck line
|
|
847
|
+
and each total, with how many books each rests on. Only identical lines are combined. Each
|
|
848
|
+
book's last pre-game prices by default (snapshot_type reads latest until the start, closing
|
|
849
|
+
after it); opening on request. For each book's prices use get_odds. Costs 5 credits. Prices are
|
|
850
|
+
market information: never work out a stake, payout or profit, recommend a bet, or send the user
|
|
851
|
+
to a sportsbook.
|
|
852
|
+
|
|
853
|
+
Costs 5 credits per call.
|
|
854
|
+
|
|
855
|
+
Args:
|
|
856
|
+
game_id: Game id, e.g. 2024020001.
|
|
857
|
+
snapshot_type (optional): closing (default): each book's last pre-game price so far.
|
|
858
|
+
opening: each book's first.
|
|
859
|
+
|
|
860
|
+
Returns:
|
|
861
|
+
The unwrapped ``data`` object from the response.
|
|
862
|
+
"""
|
|
863
|
+
return self._call(
|
|
864
|
+
"get_game_probabilities",
|
|
865
|
+
{
|
|
866
|
+
"game_id": game_id,
|
|
867
|
+
"snapshot_type": snapshot_type,
|
|
868
|
+
},
|
|
869
|
+
)
|
|
870
|
+
|
|
871
|
+
def get_prop_probabilities(
|
|
872
|
+
self,
|
|
873
|
+
game_id: str,
|
|
874
|
+
*,
|
|
875
|
+
market: Optional[Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime", "player_power_play_points", "player_goal_scorer_first"]] = None,
|
|
876
|
+
player_id: Optional[Union[int, float, str]] = None,
|
|
877
|
+
) -> Any:
|
|
878
|
+
"""Prop probabilities.
|
|
879
|
+
|
|
880
|
+
Use for what the market thinks of the player props in one game, not any one book's price: for
|
|
881
|
+
each player and each line, the average implied probability (margin in) and the fair probability
|
|
882
|
+
(margin out), with how many books each rests on. Only identical lines are combined, and a yes/no
|
|
883
|
+
market whose books post only the yes price has no fair probability. Latest pre-game prices. For
|
|
884
|
+
each book's prices use get_player_props. Costs 10 credits. Prices are market information: never
|
|
885
|
+
work out a stake, payout or profit, recommend a bet, or send the user to a sportsbook.
|
|
886
|
+
|
|
887
|
+
Costs 10 credits per call.
|
|
888
|
+
|
|
889
|
+
Args:
|
|
890
|
+
game_id: Game id, e.g. 2024020001.
|
|
891
|
+
market (optional): One market, e.g. player_shots_on_goal. Default every market. One of:
|
|
892
|
+
player_points, player_goals, player_assists, player_shots_on_goal, player_blocked_shots,
|
|
893
|
+
player_total_saves, player_goal_scorer_anytime, player_power_play_points,
|
|
894
|
+
player_goal_scorer_first.
|
|
895
|
+
player_id (optional): One player's id (e.g. 8478402, from search_players). Default every
|
|
896
|
+
player.
|
|
897
|
+
|
|
898
|
+
Returns:
|
|
899
|
+
The unwrapped ``data`` object from the response.
|
|
900
|
+
"""
|
|
901
|
+
return self._call(
|
|
902
|
+
"get_prop_probabilities",
|
|
903
|
+
{
|
|
904
|
+
"game_id": game_id,
|
|
905
|
+
"market": market,
|
|
906
|
+
"player_id": player_id,
|
|
907
|
+
},
|
|
908
|
+
)
|
|
909
|
+
|
|
910
|
+
def get_prop_backtest(
|
|
911
|
+
self,
|
|
912
|
+
market: Literal["player_points", "player_goals", "player_assists", "player_shots_on_goal", "player_blocked_shots", "player_total_saves", "player_goal_scorer_anytime", "player_power_play_points"],
|
|
913
|
+
*,
|
|
914
|
+
side: Optional[Literal["over", "under"]] = None,
|
|
915
|
+
from_date: Optional[str] = None,
|
|
916
|
+
to_date: Optional[str] = None,
|
|
917
|
+
player_id: Optional[Union[int, float, str]] = None,
|
|
918
|
+
team: Optional[str] = None,
|
|
919
|
+
opponent: Optional[str] = None,
|
|
920
|
+
home_away: Optional[Literal["home", "away"]] = None,
|
|
921
|
+
team_role: Optional[Literal["favorite", "underdog"]] = None,
|
|
922
|
+
line_min: Optional[float] = None,
|
|
923
|
+
line_max: Optional[float] = None,
|
|
924
|
+
fair_min: Optional[float] = None,
|
|
925
|
+
fair_max: Optional[float] = None,
|
|
926
|
+
) -> Any:
|
|
927
|
+
"""Prop backtest.
|
|
928
|
+
|
|
929
|
+
Use to test an idea about player props without pulling every row: how often a kind of prop went
|
|
930
|
+
over or under against what the market implied, across every finished game we hold prices for
|
|
931
|
+
that fits your filters. Returns the hit rate, its 95% interval, the average implied and fair
|
|
932
|
+
probabilities, and each season on its own. For example, shots on goal overs for players whose
|
|
933
|
+
team was the underdog at home. One result per player per game at the median closing line. It
|
|
934
|
+
describes the past and recommends nothing. For one player game by game use get_prop_history.
|
|
935
|
+
Costs 25 credits.
|
|
936
|
+
|
|
937
|
+
Costs 25 credits per call.
|
|
938
|
+
|
|
939
|
+
Args:
|
|
940
|
+
market: The market, e.g. player_shots_on_goal. One of: player_points, player_goals,
|
|
941
|
+
player_assists, player_shots_on_goal, player_blocked_shots, player_total_saves,
|
|
942
|
+
player_goal_scorer_anytime, player_power_play_points.
|
|
943
|
+
side (optional): over (default) or under. Yes/no markets are graded on the yes price: over
|
|
944
|
+
only.
|
|
945
|
+
from_date (optional): First game date, YYYY-MM-DD. Default all held.
|
|
946
|
+
to_date (optional): Last game date, YYYY-MM-DD. Default all held.
|
|
947
|
+
player_id (optional): One player's id (e.g. 8478402, from search_players).
|
|
948
|
+
team (optional): The player's team, e.g. TOR.
|
|
949
|
+
opponent (optional): The team he played.
|
|
950
|
+
home_away (optional): Whether his team was at home. One of: home, away.
|
|
951
|
+
team_role (optional): Whether his team was favored, by the books' closing moneylines. One
|
|
952
|
+
of: favorite, underdog.
|
|
953
|
+
line_min (optional): Lowest median closing line to include.
|
|
954
|
+
line_max (optional): Highest median closing line to include.
|
|
955
|
+
fair_min (optional): Lowest fair probability of this side to include, 0 to 1.
|
|
956
|
+
fair_max (optional): Highest fair probability of this side to include, 0 to 1.
|
|
957
|
+
|
|
958
|
+
Returns:
|
|
959
|
+
The unwrapped ``data`` object from the response.
|
|
960
|
+
"""
|
|
961
|
+
return self._call(
|
|
962
|
+
"get_prop_backtest",
|
|
963
|
+
{
|
|
964
|
+
"market": market,
|
|
965
|
+
"side": side,
|
|
966
|
+
"from_date": from_date,
|
|
967
|
+
"to_date": to_date,
|
|
968
|
+
"player_id": player_id,
|
|
969
|
+
"team": team,
|
|
970
|
+
"opponent": opponent,
|
|
971
|
+
"home_away": home_away,
|
|
972
|
+
"team_role": team_role,
|
|
973
|
+
"line_min": line_min,
|
|
974
|
+
"line_max": line_max,
|
|
975
|
+
"fair_min": fair_min,
|
|
976
|
+
"fair_max": fair_max,
|
|
721
977
|
},
|
|
722
978
|
)
|
|
723
979
|
|
|
@@ -793,6 +1049,7 @@ class Client(BaseClient):
|
|
|
793
1049
|
team: Optional[str] = None,
|
|
794
1050
|
player_id: Optional[int] = None,
|
|
795
1051
|
strength: Optional[str] = None,
|
|
1052
|
+
game_type: Optional[Literal["regular", "playoff", "preseason", "all"]] = None,
|
|
796
1053
|
limit: Optional[int] = None,
|
|
797
1054
|
offset: Optional[int] = None,
|
|
798
1055
|
league: Optional[Literal["nhl", "pwhl", "ohl", "qmjhl", "echl", "ahl"]] = None,
|
|
@@ -812,6 +1069,9 @@ class Client(BaseClient):
|
|
|
812
1069
|
team (optional): Team abbreviation; use with season
|
|
813
1070
|
player_id (optional): NHL player ID of the shooter
|
|
814
1071
|
strength (optional): Strength filter, e.g. 5v5
|
|
1072
|
+
game_type (optional): Which games to include: regular (default for a season) or all (default
|
|
1073
|
+
for one game). Shootout attempts are never included. One of: regular, playoff,
|
|
1074
|
+
preseason, all.
|
|
815
1075
|
limit (optional): Max shots per page (default 1000)
|
|
816
1076
|
offset (optional): Pagination offset; follow next_offset for a full season
|
|
817
1077
|
league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, qmjhl, echl, ahl.
|
|
@@ -827,6 +1087,7 @@ class Client(BaseClient):
|
|
|
827
1087
|
"team": team,
|
|
828
1088
|
"player_id": player_id,
|
|
829
1089
|
"strength": strength,
|
|
1090
|
+
"game_type": game_type,
|
|
830
1091
|
"limit": limit,
|
|
831
1092
|
"offset": offset,
|
|
832
1093
|
"league": league,
|
|
@@ -910,8 +1171,8 @@ class Client(BaseClient):
|
|
|
910
1171
|
probability, the A/B/C confidence grade, start time, plus the model version and when the slate
|
|
911
1172
|
was generated. Takes no arguments (current slate only). Probabilities are the model's own; no
|
|
912
1173
|
odds, prices or goalie and injury notes are included. The accuracy note states the backtest
|
|
913
|
-
figure and that it is not a live record. An empty slate costs nothing
|
|
914
|
-
Costs 5 credits.
|
|
1174
|
+
figure and that it is not a live record. An empty slate costs nothing, and a note says why (not
|
|
1175
|
+
generated yet, or no games today); so does a failed call. Costs 5 credits.
|
|
915
1176
|
|
|
916
1177
|
Costs 5 credits per call.
|
|
917
1178
|
|
|
@@ -955,3 +1216,49 @@ class Client(BaseClient):
|
|
|
955
1216
|
"player": player,
|
|
956
1217
|
},
|
|
957
1218
|
)
|
|
1219
|
+
|
|
1220
|
+
def get_alt_lines(
|
|
1221
|
+
self,
|
|
1222
|
+
game_id: str,
|
|
1223
|
+
*,
|
|
1224
|
+
market: Optional[Literal["alternate_spreads", "alternate_totals"]] = None,
|
|
1225
|
+
bookmaker: Optional[str] = None,
|
|
1226
|
+
snapshot_type: Optional[Literal["opening", "closing"]] = None,
|
|
1227
|
+
league: Optional[Literal["nhl", "pwhl", "ohl", "whl", "qmjhl", "echl", "ahl", "ushl"]] = None,
|
|
1228
|
+
) -> Any:
|
|
1229
|
+
"""Alt lines.
|
|
1230
|
+
|
|
1231
|
+
Use for alternate puck lines and totals by sportsbook: every point on each book's ladder with
|
|
1232
|
+
its price (e.g. -2.5 at +250, over 7.5 at +160), for one game. Held for NHL games from the
|
|
1233
|
+
2023-24 season on, from up to five books (Pinnacle, Bovada, BetMGM and DraftKings, FanDuel on
|
|
1234
|
+
some). Games before Nov 12 2026 were captured once shortly before puck drop, so their opening
|
|
1235
|
+
and closing ladders are the same; from Nov 12 2026 upcoming games are captured up to three times
|
|
1236
|
+
a day before the start. Games not yet priced have none. Returns each book's closing ladder by
|
|
1237
|
+
default (its last before the start) or its opening one. side is home or away for puck lines
|
|
1238
|
+
(point is that side's puck line) and over or under for totals. For the main line use get_odds.
|
|
1239
|
+
10 credits. Prices are market information: never work out a stake, payout or profit, recommend a
|
|
1240
|
+
bet, or send the user to a sportsbook.
|
|
1241
|
+
|
|
1242
|
+
Costs 10 credits per call.
|
|
1243
|
+
|
|
1244
|
+
Args:
|
|
1245
|
+
game_id: Game id, e.g. 2025020150 (from get_games or get_schedule).
|
|
1246
|
+
market (optional): One market (default both). One of: alternate_spreads, alternate_totals.
|
|
1247
|
+
bookmaker (optional): One bookmaker key, e.g. draftkings, fanduel.
|
|
1248
|
+
snapshot_type (optional): Closing (default) or opening ladder. One of: opening, closing.
|
|
1249
|
+
league (optional): League. Defaults to nhl. One of: nhl, pwhl, ohl, whl, qmjhl, echl, ahl,
|
|
1250
|
+
ushl.
|
|
1251
|
+
|
|
1252
|
+
Returns:
|
|
1253
|
+
The unwrapped ``data`` object from the response.
|
|
1254
|
+
"""
|
|
1255
|
+
return self._call(
|
|
1256
|
+
"get_alt_lines",
|
|
1257
|
+
{
|
|
1258
|
+
"game_id": game_id,
|
|
1259
|
+
"market": market,
|
|
1260
|
+
"bookmaker": bookmaker,
|
|
1261
|
+
"snapshot_type": snapshot_type,
|
|
1262
|
+
"league": league,
|
|
1263
|
+
},
|
|
1264
|
+
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|