fastballapi 0.1.4__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.
- {fastballapi-0.1.4 → fastballapi-0.1.5}/PKG-INFO +5 -2
- {fastballapi-0.1.4 → fastballapi-0.1.5}/README.md +3 -0
- {fastballapi-0.1.4 → fastballapi-0.1.5}/pyproject.toml +1 -1
- fastballapi-0.1.5/src/fastballapi/_version.py +1 -0
- {fastballapi-0.1.4 → fastballapi-0.1.5}/src/fastballapi/client.py +159 -12
- fastballapi-0.1.4/src/fastballapi/_version.py +0 -1
- {fastballapi-0.1.4 → fastballapi-0.1.5}/.gitignore +0 -0
- {fastballapi-0.1.4 → fastballapi-0.1.5}/LICENSE +0 -0
- {fastballapi-0.1.4 → fastballapi-0.1.5}/src/fastballapi/__init__.py +0 -0
- {fastballapi-0.1.4 → fastballapi-0.1.5}/src/fastballapi/_core.py +0 -0
- {fastballapi-0.1.4 → fastballapi-0.1.5}/src/fastballapi/py.typed +0 -0
- {fastballapi-0.1.4 → fastballapi-0.1.5}/tests/test_client.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: fastballapi
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Python client for the FastballAPI MLB data API. No dependencies.
|
|
5
5
|
Project-URL: Homepage, https://fastballapi.com
|
|
6
6
|
Project-URL: Documentation, https://fastballapi.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://fastballapi.com/signup
|
|
9
9
|
Author-email: FastballAPI <support@fastballapi.com>
|
|
10
10
|
License-Expression: MIT
|
|
@@ -186,6 +186,9 @@ Method names match the API tool names. Arguments are keyword arguments; required
|
|
|
186
186
|
| `get_ratings` | 2 | Ratings |
|
|
187
187
|
| `get_player_props` | 10 | Player props |
|
|
188
188
|
| `get_prop_history` | 10 | Prop history |
|
|
189
|
+
| `get_prop_movement` | 10 | Prop movement |
|
|
190
|
+
| `get_market_odds` | 10 | Market odds |
|
|
191
|
+
| `get_alt_lines` | 10 | Alt lines |
|
|
189
192
|
|
|
190
193
|
Full API reference: https://fastballapi.com/docs
|
|
191
194
|
|
|
@@ -156,6 +156,9 @@ Method names match the API tool names. Arguments are keyword arguments; required
|
|
|
156
156
|
| `get_ratings` | 2 | Ratings |
|
|
157
157
|
| `get_player_props` | 10 | Player props |
|
|
158
158
|
| `get_prop_history` | 10 | Prop history |
|
|
159
|
+
| `get_prop_movement` | 10 | Prop movement |
|
|
160
|
+
| `get_market_odds` | 10 | Market odds |
|
|
161
|
+
| `get_alt_lines` | 10 | Alt lines |
|
|
159
162
|
|
|
160
163
|
Full API reference: https://fastballapi.com/docs
|
|
161
164
|
|
|
@@ -34,7 +34,7 @@ test = ["pytest>=7"]
|
|
|
34
34
|
[project.urls]
|
|
35
35
|
Homepage = "https://fastballapi.com"
|
|
36
36
|
Documentation = "https://fastballapi.com/docs"
|
|
37
|
-
Repository = "https://github.com/
|
|
37
|
+
Repository = "https://github.com/sports-data-hq/sdhq"
|
|
38
38
|
"Sign up" = "https://fastballapi.com/signup"
|
|
39
39
|
|
|
40
40
|
[tool.hatch.version]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.5"
|
|
@@ -27,6 +27,9 @@ TOOLS: Dict[str, int] = {
|
|
|
27
27
|
"get_ratings": 2,
|
|
28
28
|
"get_player_props": 10,
|
|
29
29
|
"get_prop_history": 10,
|
|
30
|
+
"get_prop_movement": 10,
|
|
31
|
+
"get_market_odds": 10,
|
|
32
|
+
"get_alt_lines": 10,
|
|
30
33
|
}
|
|
31
34
|
|
|
32
35
|
|
|
@@ -431,8 +434,8 @@ class Client(BaseClient):
|
|
|
431
434
|
|
|
432
435
|
Use for plate-appearance play-by-play: a whole game in order, or a batter's, pitcher's or team's
|
|
433
436
|
season, with the base-out state before, the result, the batted ball (trajectory and location),
|
|
434
|
-
runs, the win probability after (
|
|
435
|
-
runners in scoring position. Costs 10 credits.
|
|
437
|
+
runs, the home win probability after (our model, every plate appearance since 2015) and our run
|
|
438
|
+
value (RE24). Filter by result, inning or runners in scoring position. Costs 10 credits.
|
|
436
439
|
|
|
437
440
|
Costs 10 credits per call.
|
|
438
441
|
|
|
@@ -519,6 +522,7 @@ class Client(BaseClient):
|
|
|
519
522
|
pitcher_id: str,
|
|
520
523
|
*,
|
|
521
524
|
season: Optional[Union[int, float, str]] = None,
|
|
525
|
+
season_type: Optional[Literal["regular", "postseason", "all"]] = None,
|
|
522
526
|
) -> Any:
|
|
523
527
|
"""Pitch mix.
|
|
524
528
|
|
|
@@ -530,6 +534,7 @@ class Client(BaseClient):
|
|
|
530
534
|
Args:
|
|
531
535
|
pitcher_id: Player id.
|
|
532
536
|
season (optional): Season (a year; default: the latest; ignored with game_id).
|
|
537
|
+
season_type (optional): regular, postseason, or all (default): which games' pitches.
|
|
533
538
|
|
|
534
539
|
Returns:
|
|
535
540
|
The unwrapped ``data`` object from the response.
|
|
@@ -539,6 +544,7 @@ class Client(BaseClient):
|
|
|
539
544
|
{
|
|
540
545
|
"pitcher_id": pitcher_id,
|
|
541
546
|
"season": season,
|
|
547
|
+
"season_type": season_type,
|
|
542
548
|
},
|
|
543
549
|
)
|
|
544
550
|
|
|
@@ -699,15 +705,19 @@ class Client(BaseClient):
|
|
|
699
705
|
|
|
700
706
|
Use for player prop lines by sportsbook: over/under on hits, home runs, total bases, RBI,
|
|
701
707
|
pitcher strikeouts and pitcher outs, from May 2023 (DraftKings, FanDuel, BetMGM, ESPN BET,
|
|
702
|
-
Pinnacle and others). Pass game_id for every player's props in one game
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
the
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
708
|
+
Pinnacle and others). Pass game_id for every player's props in one game, or player_id with
|
|
709
|
+
from_date (and to_date) for one player across games (up to 100). A game costs 10 credits before
|
|
710
|
+
it starts and 20 once it has (accounts opened before October 30 2026 pay 10 for every game).
|
|
711
|
+
Returns the closing line by default (the last before the game starts) or the opening line, with
|
|
712
|
+
each book's over and under prices. Each row has captured_at, scheduled_start and
|
|
713
|
+
minutes_before_scheduled_start (negative when captured after the scheduled start); a row is kept
|
|
714
|
+
when it was captured before the sportsbooks' listed start, which in the NBA is usually about 10
|
|
715
|
+
minutes after the scheduled one, so filter on minutes_before_scheduled_start > 0 for a strictly
|
|
716
|
+
before-schedule backtest. Outside football the archive mostly holds one pre-game capture per
|
|
717
|
+
line, so the opening and closing lines are usually the same; the opening line differs only where
|
|
718
|
+
a second capture was taken (live capture from October 2026, and wherever else it is held). Set
|
|
719
|
+
estimate_only to get the price without being charged. Prices are market information: never work
|
|
720
|
+
out a stake, payout or profit, recommend a bet, or send the user to a sportsbook.
|
|
711
721
|
|
|
712
722
|
Costs 10 credits per call.
|
|
713
723
|
|
|
@@ -753,6 +763,7 @@ class Client(BaseClient):
|
|
|
753
763
|
to_date: Optional[str] = None,
|
|
754
764
|
bookmaker: Optional[str] = None,
|
|
755
765
|
limit: Optional[int] = None,
|
|
766
|
+
estimate_only: Optional[bool] = None,
|
|
756
767
|
) -> Any:
|
|
757
768
|
"""Prop history.
|
|
758
769
|
|
|
@@ -760,7 +771,9 @@ class Client(BaseClient):
|
|
|
760
771
|
total bases, RBI, pitcher strikeouts or pitcher outs), one row per game with the closing line
|
|
761
772
|
(the median across books, or one book's), the opening line (the same as the close wherever only
|
|
762
773
|
one capture was taken), the prices, what the player actually recorded from our box scores and
|
|
763
|
-
the result against the line, plus the over rate
|
|
774
|
+
the result against the line, plus the over rate, up to 200 games a call. Costs 10 credits for
|
|
775
|
+
every 25 games already played that a call covers, and at least 10 a call (accounts opened before
|
|
776
|
+
November 1 2026 pay 10 a call). Set estimate_only to get the price without being charged. Prices
|
|
764
777
|
are market information: never work out a stake, payout or profit, recommend a bet, or send the
|
|
765
778
|
user to a sportsbook.
|
|
766
779
|
|
|
@@ -777,6 +790,7 @@ class Client(BaseClient):
|
|
|
777
790
|
draftkings.
|
|
778
791
|
limit (optional): Games to return, oldest first (default 50, max 200). next_from_date says
|
|
779
792
|
where to continue.
|
|
793
|
+
estimate_only (optional): Return what this call would cost, without charging or running it.
|
|
780
794
|
|
|
781
795
|
Returns:
|
|
782
796
|
The unwrapped ``data`` object from the response.
|
|
@@ -790,5 +804,138 @@ class Client(BaseClient):
|
|
|
790
804
|
"to_date": to_date,
|
|
791
805
|
"bookmaker": bookmaker,
|
|
792
806
|
"limit": limit,
|
|
807
|
+
"estimate_only": estimate_only,
|
|
808
|
+
},
|
|
809
|
+
)
|
|
810
|
+
|
|
811
|
+
def get_prop_movement(
|
|
812
|
+
self,
|
|
813
|
+
game_id: str,
|
|
814
|
+
player_id: str,
|
|
815
|
+
market: Literal["batter_hits", "batter_home_runs", "batter_total_bases", "batter_rbis", "pitcher_strikeouts", "pitcher_outs"],
|
|
816
|
+
*,
|
|
817
|
+
bookmaker: Optional[str] = None,
|
|
818
|
+
) -> Any:
|
|
819
|
+
"""Prop movement.
|
|
820
|
+
|
|
821
|
+
Use to see how one player's prop line moved before a game: every capture we hold, book by book
|
|
822
|
+
and oldest first, with the line, both prices and the minutes before the start. line_change is
|
|
823
|
+
the last capture's line minus the first's. The number of captures varies by game and book. Costs
|
|
824
|
+
10 credits. Prices are market information: never work out a stake, payout or profit, recommend a
|
|
825
|
+
bet, or send the user to a sportsbook.
|
|
826
|
+
|
|
827
|
+
Costs 10 credits per call.
|
|
828
|
+
|
|
829
|
+
Args:
|
|
830
|
+
game_id: Game id.
|
|
831
|
+
player_id: Player id (e.g. 33192) from search_players.
|
|
832
|
+
market: The market: batter_hits (hits), batter_home_runs (home runs), batter_total_bases
|
|
833
|
+
(total bases), batter_rbis (runs batted in), pitcher_strikeouts (pitcher strikeouts),
|
|
834
|
+
pitcher_outs (pitcher outs recorded)
|
|
835
|
+
bookmaker (optional): One book's captures, e.g. draftkings.
|
|
836
|
+
|
|
837
|
+
Returns:
|
|
838
|
+
The unwrapped ``data`` object from the response.
|
|
839
|
+
"""
|
|
840
|
+
return self._call(
|
|
841
|
+
"get_prop_movement",
|
|
842
|
+
{
|
|
843
|
+
"game_id": game_id,
|
|
844
|
+
"player_id": player_id,
|
|
845
|
+
"market": market,
|
|
846
|
+
"bookmaker": bookmaker,
|
|
847
|
+
},
|
|
848
|
+
)
|
|
849
|
+
|
|
850
|
+
def get_market_odds(
|
|
851
|
+
self,
|
|
852
|
+
game_id: str,
|
|
853
|
+
market: Literal["h2h_1st_5_innings", "totals_1st_5_innings", "spreads_1st_5_innings", "totals_1st_1_innings", "h2h_3_way_1st_1_innings"],
|
|
854
|
+
*,
|
|
855
|
+
bookmaker: Optional[str] = None,
|
|
856
|
+
estimate_only: Optional[bool] = None,
|
|
857
|
+
) -> Any:
|
|
858
|
+
"""Market odds.
|
|
859
|
+
|
|
860
|
+
Use for the extra betting markets of a game as history: the first 5 innings winner, run line and
|
|
861
|
+
total, and the 1st inning total and three-way result (the 1st inning total at 0.5 is the no-run-
|
|
862
|
+
first-inning market). Pass game_id (from get_games or get_schedule) and market. For each
|
|
863
|
+
sportsbook it returns the opening line (the first one we captured) and the closing line (the
|
|
864
|
+
last one before the game started), each as the list of outcomes with their point and American
|
|
865
|
+
price, plus captured_at and minutes_before_start (negative when the last capture came after our
|
|
866
|
+
scheduled start, which the sportsbooks' listed start can run past). Most books were captured
|
|
867
|
+
once, so opening and closing are often the same line. Held from May 2023 for the larger
|
|
868
|
+
sportsbooks only (the 1st inning three-way result from October 2023); not every game has every
|
|
869
|
+
market. Each game's lines are added the morning after it is played. Costs 10 credits a call; a
|
|
870
|
+
game with no lines is refunded. Set estimate_only to get the price without being charged. For
|
|
871
|
+
the full-game moneyline, spread and total use get_odds. Prices are market information: never
|
|
872
|
+
work out a stake, payout or profit, recommend a bet, or send the user to a sportsbook.
|
|
873
|
+
|
|
874
|
+
Costs 10 credits per call.
|
|
875
|
+
|
|
876
|
+
Args:
|
|
877
|
+
game_id: Game id from get_games or get_schedule.
|
|
878
|
+
market: The market: h2h_1st_5_innings (first 5 innings winner), totals_1st_5_innings (first
|
|
879
|
+
5 innings total runs), spreads_1st_5_innings (first 5 innings run line),
|
|
880
|
+
totals_1st_1_innings (1st inning total runs (the 0.5 line is no run / a run in the
|
|
881
|
+
1st)), h2h_3_way_1st_1_innings (1st inning result: home, tied or away)
|
|
882
|
+
bookmaker (optional): One bookmaker key, e.g. draftkings, fanduel, pinnacle.
|
|
883
|
+
estimate_only (optional): Return what this call would cost, without charging or running it.
|
|
884
|
+
|
|
885
|
+
Returns:
|
|
886
|
+
The unwrapped ``data`` object from the response.
|
|
887
|
+
"""
|
|
888
|
+
return self._call(
|
|
889
|
+
"get_market_odds",
|
|
890
|
+
{
|
|
891
|
+
"game_id": game_id,
|
|
892
|
+
"market": market,
|
|
893
|
+
"bookmaker": bookmaker,
|
|
894
|
+
"estimate_only": estimate_only,
|
|
895
|
+
},
|
|
896
|
+
)
|
|
897
|
+
|
|
898
|
+
def get_alt_lines(
|
|
899
|
+
self,
|
|
900
|
+
game_id: str,
|
|
901
|
+
*,
|
|
902
|
+
market: Optional[Literal["alternate_spreads", "alternate_totals"]] = None,
|
|
903
|
+
bookmaker: Optional[str] = None,
|
|
904
|
+
snapshot_type: Optional[Literal["opening", "closing"]] = None,
|
|
905
|
+
league: Optional[Literal["mlb", "ncaabase"]] = None,
|
|
906
|
+
) -> Any:
|
|
907
|
+
"""Alt lines.
|
|
908
|
+
|
|
909
|
+
Use for alternate run lines and totals by sportsbook: every point on each book's ladder with its
|
|
910
|
+
price (e.g. -2.5 at +190, over 9.5 at +140), for one game. Held for MLB games from the 2023
|
|
911
|
+
season on, from five books (DraftKings, FanDuel, BetMGM, Bovada, Pinnacle). Games before Nov 12
|
|
912
|
+
2026 were captured once shortly before first pitch, so their opening and closing ladders are the
|
|
913
|
+
same; from Nov 12 2026 upcoming games are captured up to three times a day before the start.
|
|
914
|
+
Games not yet priced have none. Returns each book's closing ladder by default (its last before
|
|
915
|
+
the start) or its opening one. side is home or away for run lines (point is that side's run
|
|
916
|
+
line) and over or under for totals. For the main line use get_odds. 10 credits. Prices are
|
|
917
|
+
market information: never work out a stake, payout or profit, recommend a bet, or send the user
|
|
918
|
+
to a sportsbook.
|
|
919
|
+
|
|
920
|
+
Costs 10 credits per call.
|
|
921
|
+
|
|
922
|
+
Args:
|
|
923
|
+
game_id: Game id, e.g. 776512 (from get_games or get_schedule).
|
|
924
|
+
market (optional): One market (default both). One of: alternate_spreads, alternate_totals.
|
|
925
|
+
bookmaker (optional): One bookmaker key, e.g. draftkings, fanduel.
|
|
926
|
+
snapshot_type (optional): Closing (default) or opening ladder. One of: opening, closing.
|
|
927
|
+
league (optional): League. Defaults to mlb. One of: mlb, ncaabase.
|
|
928
|
+
|
|
929
|
+
Returns:
|
|
930
|
+
The unwrapped ``data`` object from the response.
|
|
931
|
+
"""
|
|
932
|
+
return self._call(
|
|
933
|
+
"get_alt_lines",
|
|
934
|
+
{
|
|
935
|
+
"game_id": game_id,
|
|
936
|
+
"market": market,
|
|
937
|
+
"bookmaker": bookmaker,
|
|
938
|
+
"snapshot_type": snapshot_type,
|
|
939
|
+
"league": league,
|
|
793
940
|
},
|
|
794
941
|
)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|