Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 1.3.0 (2026-11-19)

### Added
- Same game parlays: `get_sgp_bookmakers`, `get_sgp_legs` and `quote_sgp` (sync and async) for `GET /sgp/bookmakers`, `GET /sgp/legs` and `POST /sgp/quote`, with types.
- `SgpLegsResponse["bookmakers"]`: per requested bookmaker, whether its legs could be checked (`status`, `retryable`, `nextAction`, `reason`, `retryAfter`).
- `SgpNextAction` and `SgpSide` literal types. `reason` on a quote is a sentence for display; branch on `status` and `nextAction`.

## 1.2.3 (2026-11-13)

### Docs
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: "If you use this software, please cite it using the metadata from this file."
type: software
title: "odds-api-io: Official Python SDK for Odds-API.io"
version: 1.2.3
date-released: "2026-11-13"
version: 1.3.0
date-released: "2026-11-19"
authors:
- name: "Outlier AS"
email: "hello@odds-api.io"
Expand Down
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ You need an API key from a paid plan: **[get your API key at odds-api.io/pricing
- **Golf outrights**: Winner, Top 5/10/20, the "(Incl. Ties)" variants and Make Cut, plus results (Outrights add-on)
- **Historical data**: past events, stored odds and closing lines for up to 10 leagues and a full season per sweep
- **Settlement**: final scores with a `final` flag, and grading of up to 50 bets per call (won, lost, void, half won, half lost)
- **Same game parlays**: list the legs of an event and quote 2 to 10 of them per bookmaker
- **Analysis**: arbitrage and value bets with sport, league, market and margin filters; dropping odds from sharp bookmakers
- **Odds movements**: pre-match price history per market line
- **Id mappings**: our events and selections mapped to Polymarket and Kalshi ids
Expand Down Expand Up @@ -119,6 +120,37 @@ for grade in result["grades"]:

`get_settlements([ids])` returns status, final score and a `final` flag for up to 50 events. Period scores use the keys `p1`..`pN`, `ft`, `ot` and `ap`; the older keys (`period1`, `overtime`, `penalties`, `fulltime`) stop on 12 November 2026.

### Same game parlays

Included in all paid plans. `get_sgp_bookmakers()` (`GET /v3/sgp/bookmakers`) returns the bookmakers that quote same game parlays right now; more are being added. List the legs of a pre-match event, then quote 2 to 10 of them. Each bookmaker answers with a price (decimal string) or a `status` and `nextAction`. Branch on those two; `reason` is a sentence for display and its wording can change.

```python
event_id = 61234567
listed = client.get_sgp_legs(event_id, ["DraftKings", "BetMGM"], markets=["ML", "Totals"])
# A bookmaker whose legs could not be checked says why; its legs all read eligible False.
books = [b["bookmaker"] for b in listed["bookmakers"] if b["status"] == "ok"]


def eligible(leg):
return all(leg["bookmakers"].get(b, {}).get("eligible") for b in books)


ml = next((l for l in listed["legs"] if l["market"] == "ML" and l["side"] == "home" and eligible(l)), None)
total = next((l for l in listed["legs"] if l["market"] == "Totals" and l["side"] == "over" and eligible(l)), None)

if ml and total and books:
quotes = client.quote_sgp(event_id, books, [{"legId": ml["legId"]}, {"legId": total["legId"]}])["quotes"]
for q in quotes:
if q["status"] == "ok":
print(q["bookmaker"], q["price"], "vs", q.get("legsMultiplied"), (q.get("links") or {}).get("desktop"))
elif q.get("nextAction") in ("retry", "retry_later"):
print(q["bookmaker"], f"retry in {q.get('retryAfter', 2)}s")
else:
print(q["bookmaker"], q.get("nextAction"), q.get("legIds", []), q.get("reason"))
```

`nextAction` is one of `change_legs`, `remove_leg` (drop the legs in `legIds`), `refresh_legs` (call `get_sgp_legs` again), `retry`, `retry_later` (wait `retryAfter` seconds) or `choose_other_bookmaker`. A quote can take up to 8 seconds, and at most 2 quotes run at once per account. See the [same game parlay guide](https://docs.odds-api.io/guides/sgp).

### Arbitrage and value bets

```python
Expand Down Expand Up @@ -243,6 +275,9 @@ Comma-separated parameters accept a string or a list. Dates accept RFC3339 strin
| `get_closing_lines(sport, leagues, from_, to, markets, bookmakers, limit, skip)`, `iter_closing_lines(...)` | `GET /historical/closing-lines` |
| `get_settlements(event_ids)` | `GET /settlements` |
| `grade_bets(selections)` | `POST /settlements/grade` |
| `get_sgp_bookmakers(sport)` | `GET /sgp/bookmakers` |
| `get_sgp_legs(event_id, bookmakers, markets, limit, skip)` | `GET /sgp/legs` |
| `quote_sgp(event_id, bookmakers, legs)` | `POST /sgp/quote` |
| `get_outrights(sport="golf", league, status)` | `GET /outrights` |
| `get_outright_odds(outright_id, bookmakers)` | `GET /outrights/odds` |
| `get_outright_results(outright_id)` | `GET /outrights/results` |
Expand Down Expand Up @@ -289,5 +324,5 @@ MIT. See [LICENSE](LICENSE).
If you use this package in research or a publication, please cite it. Citation metadata is in [CITATION.cff](CITATION.cff) (GitHub renders a "Cite this repository" button from it) and Zenodo metadata is in `.zenodo.json`.

```
Outlier AS. odds-api-io: Official Python SDK for Odds-API.io (version 1.2.3). https://github.com/odds-api-io/odds-api-python
Outlier AS. odds-api-io: Official Python SDK for Odds-API.io (version 1.3.0). https://github.com/odds-api-io/odds-api-python
```
2 changes: 1 addition & 1 deletion odds_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Official Python client for the Odds-API.io sports betting odds API.
"""

__version__ = "1.2.3"
__version__ = "1.3.0"

from .client import OddsAPIClient
from .async_client import AsyncOddsAPIClient
Expand Down
91 changes: 91 additions & 0 deletions odds_api/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
format_time,
next_retry_delay,
parse_rate_limit,
to_csv,
)
from .constants import (
BASE_API_URL,
Expand Down Expand Up @@ -50,6 +51,10 @@
OutrightResults,
Participant,
SettlementsResponse,
SgpBookmaker,
SgpLegsResponse,
SgpQuoteLeg,
SgpQuoteResponse,
Sport,
ValueBet,
)
Expand Down Expand Up @@ -866,6 +871,92 @@ async def grade_bets(self, selections: Sequence[GradeSelection]) -> GradesRespon
check_max("selections", list(selections), MAX_SETTLEMENT_EVENTS)
return await self._post(Endpoints.GRADE_BETS, {"selections": list(selections)})

# Same game parlays

async def get_sgp_bookmakers(self, sport: Optional[str] = None) -> List[SgpBookmaker]:
"""
List the bookmakers that can quote same game parlays.

Args:
sport: Sport slug from ``get_sports``; keeps bookmakers that cover it

Example:
>>> (await client.get_sgp_bookmakers("basketball"))
"""
return await self._get(Endpoints.SGP_BOOKMAKERS, build_params(sport=sport))

async def get_sgp_legs(
self,
event_id: Union[int, str],
bookmakers: StrList,
markets: Optional[StrList] = None,
limit: Optional[int] = None,
skip: Optional[int] = None,
) -> SgpLegsResponse:
"""
List the legs of a pre-match event that can go into a same game parlay.

Each leg has a ``legId`` to pass to ``quote_sgp`` and, per bookmaker,
whether it can be combined (``eligible``) and its current ``price``.
The top-level ``bookmakers`` says, per requested bookmaker, whether its
legs could be checked: when its ``status`` is not ``ok``, every leg reads
``eligible: False`` there. Call again with a higher ``skip`` while
``hasMore`` is true.

Args:
event_id: Event id from ``get_events``
bookmakers: Bookmaker names (max 8 per request)
markets: Market names to keep (max 40)
limit: Legs to return (default 200, max 1000)
skip: Legs to skip, for paging

Example:
>>> client.get_sgp_legs(61234567, "DraftKings", markets=["ML", "Totals"])
"""
params = build_params(
eventId=event_id,
bookmakers=bookmakers,
markets=markets,
limit=limit,
skip=skip,
)
return await self._get(Endpoints.SGP_LEGS, params)

async def quote_sgp(
self,
event_id: Union[int, str],
bookmakers: StrList,
legs: Sequence[SgpQuoteLeg],
) -> SgpQuoteResponse:
"""
Quote 2 to 10 legs as a same game parlay at each bookmaker.

Every requested bookmaker gets one entry in ``quotes``, in request
order: ``status`` is ``ok`` with a ``price``, or explains what to do
through ``nextAction``. Branch on those two; ``reason`` is a sentence for
display. Prices are decimal strings. A quote can take up to 8 seconds,
and at most 2 run at once per account (a third gets a 429).

Args:
event_id: Event id from ``get_events``
bookmakers: Bookmaker names (max 8 per request)
legs: ``{"legId": ...}`` or ``{"market", "hdp", "label", "side"}``,
optionally with ``expectedPrice``

Example:
>>> (await client.quote_sgp(
... 61234567,
... "DraftKings",
... [{"legId": "61234567|ML|||home"}, {"legId": "61234567|Totals|221.5||over"}],
... ))["quotes"]
"""
body = {
"eventId": event_id,
"bookmakers": to_csv(bookmakers),
"legs": list(legs),
}
return await self._post(Endpoints.SGP_QUOTE, body)

# Outrights (add-on)

async def get_outrights(
Expand Down
91 changes: 91 additions & 0 deletions odds_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
format_time,
next_retry_delay,
parse_rate_limit,
to_csv,
)
from .constants import (
BASE_API_URL,
Expand Down Expand Up @@ -50,6 +51,10 @@
OutrightResults,
Participant,
SettlementsResponse,
SgpBookmaker,
SgpLegsResponse,
SgpQuoteLeg,
SgpQuoteResponse,
Sport,
ValueBet,
)
Expand Down Expand Up @@ -853,6 +858,92 @@ def grade_bets(self, selections: Sequence[GradeSelection]) -> GradesResponse:
check_max("selections", list(selections), MAX_SETTLEMENT_EVENTS)
return self._post(Endpoints.GRADE_BETS, {"selections": list(selections)})

# Same game parlays

def get_sgp_bookmakers(self, sport: Optional[str] = None) -> List[SgpBookmaker]:
"""
List the bookmakers that can quote same game parlays.

Args:
sport: Sport slug from ``get_sports``; keeps bookmakers that cover it

Example:
>>> client.get_sgp_bookmakers("basketball")
"""
return self._get(Endpoints.SGP_BOOKMAKERS, build_params(sport=sport))

def get_sgp_legs(
self,
event_id: Union[int, str],
bookmakers: StrList,
markets: Optional[StrList] = None,
limit: Optional[int] = None,
skip: Optional[int] = None,
) -> SgpLegsResponse:
"""
List the legs of a pre-match event that can go into a same game parlay.

Each leg has a ``legId`` to pass to ``quote_sgp`` and, per bookmaker,
whether it can be combined (``eligible``) and its current ``price``.
The top-level ``bookmakers`` says, per requested bookmaker, whether its
legs could be checked: when its ``status`` is not ``ok``, every leg reads
``eligible: False`` there. Call again with a higher ``skip`` while
``hasMore`` is true.

Args:
event_id: Event id from ``get_events``
bookmakers: Bookmaker names (max 8 per request)
markets: Market names to keep (max 40)
limit: Legs to return (default 200, max 1000)
skip: Legs to skip, for paging

Example:
>>> client.get_sgp_legs(61234567, "DraftKings", markets=["ML", "Totals"])
"""
params = build_params(
eventId=event_id,
bookmakers=bookmakers,
markets=markets,
limit=limit,
skip=skip,
)
return self._get(Endpoints.SGP_LEGS, params)

def quote_sgp(
self,
event_id: Union[int, str],
bookmakers: StrList,
legs: Sequence[SgpQuoteLeg],
) -> SgpQuoteResponse:
"""
Quote 2 to 10 legs as a same game parlay at each bookmaker.

Every requested bookmaker gets one entry in ``quotes``, in request
order: ``status`` is ``ok`` with a ``price``, or explains what to do
through ``nextAction``. Branch on those two; ``reason`` is a sentence for
display. Prices are decimal strings. A quote can take up to 8 seconds,
and at most 2 run at once per account (a third gets a 429).

Args:
event_id: Event id from ``get_events``
bookmakers: Bookmaker names (max 8 per request)
legs: ``{"legId": ...}`` or ``{"market", "hdp", "label", "side"}``,
optionally with ``expectedPrice``

Example:
>>> client.quote_sgp(
... 61234567,
... "DraftKings",
... [{"legId": "61234567|ML|||home"}, {"legId": "61234567|Totals|221.5||over"}],
... )["quotes"]
"""
body = {
"eventId": event_id,
"bookmakers": to_csv(bookmakers),
"legs": list(legs),
}
return self._post(Endpoints.SGP_QUOTE, body)

# Outrights (add-on)

def get_outrights(
Expand Down
4 changes: 4 additions & 0 deletions odds_api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class Endpoints:
GET_SETTLEMENTS = "settlements"
GRADE_BETS = "settlements/grade"

SGP_BOOKMAKERS = "sgp/bookmakers"
SGP_LEGS = "sgp/legs"
SGP_QUOTE = "sgp/quote"

GET_OUTRIGHTS = "outrights"
GET_OUTRIGHT_ODDS = "outrights/odds"
GET_OUTRIGHT_RESULTS = "outrights/results"
Loading
Loading