Metadata-Version: 2.4
Name: altsportsdata
Version: 2.2.0
Summary: The data feed for alternative sports betting — odds, events, futures for 30 leagues
Author-email: AltSportsData <dev@altsportsdata.com>
License-Expression: MIT
Project-URL: Homepage, https://altsportsdata.com
Project-URL: Documentation, https://api.altsportsdata.com/public/docs/swagger
Project-URL: Repository, https://github.com/altsportsdata/altsportsdata-python
Project-URL: Issues, https://github.com/altsportsdata/altsportsdata-python/issues
Keywords: sports,betting,odds,sportsbook,api,sdk,alternative-sports,futures,events,altsportsdata,wsl,sls,f1,pbr,mma,esports
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.28.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=22.0.0; extra == "dev"
Requires-Dist: isort>=5.10.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"

# AltSportsData SDK

[![PyPI](https://img.shields.io/pypi/v/altsportsdata.svg)](https://pypi.org/project/altsportsdata/)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)

**Alternative sports odds & data for sportsbooks, DFS platforms, and prediction markets.**

One SDK. 30 leagues. Every market type. Moneylines, matchups, props, podiums, futures, and parlays — from surfing to Supercross to Formula Drift.

```
pip install altsportsdata
```

---

## Example 1 — Get Odds (Live → Upcoming → Completed)

Finds the first event with real odds — works any time, any day:

```python
from altsportsdata import AltSportsData

client = AltSportsData(api_key="your_key")

# Try live first, then upcoming, then completed results
for status in ["live", "upcoming", "completed"]:
    for event in client.list_events(status=status):
        odds = client.get_moneylines(event.id)
        winners = odds.get("eventWinner", [])
        if winners:
            print(f"{event.name} ({status})")
            for o in sorted(winners, key=lambda x: x["odds"])[:5]:
                ath = o["athlete"]
                settled = f'  → {o["settlement"]}' if o.get("settlement") else ""
                print(f'  {ath["firstName"]} {ath["lastName"]:20} {o["probability"]:5.1f}%  ({o["odds"]:.2f}){settled}')
            break
    else:
        continue
    break
```

```
Indianapolis (upcoming)
  Eli Tomac              49.4%  (2.02)
  Hunter Lawrence        37.6%  (2.66)
  Ken Roczen             23.5%  (4.26)
  Cooper Webb            14.6%  (6.84)
  Joey Savatgy            6.2%  (16.20)
```

## Example 2 — Historical Results & Settlement

Completed events include `settlement` — see who won vs the odds:

```python
wsl = AltSportsData(api_key="your_key", league="wsl")

for event in wsl.list_events(status="completed"):
    odds = wsl.get_moneylines(event.id)
    winners = odds.get("eventWinner", [])
    if winners:
        print(f"\n{event.name}")
        for o in sorted(winners, key=lambda x: x["odds"])[:5]:
            ath = o["athlete"]
            tag = "✅" if o["settlement"] == "WIN" else "  "
            print(f'  {tag} {ath["firstName"]} {ath["lastName"]:20} {o["odds"]:5.2f}  → {o["settlement"]}')
        break
```

```
Lexus Pipe Challenger
     Molly Picklum         3.50  → LOSE
     Caitlin Simmers       3.88  → LOSE
     Erin Brooks           5.49  → LOSE
  ✅ Gabriela Bryan         6.46  → WIN
     Bettylou Johnson      9.90  → LOSE
```

---

## All Market Types

```python
# Sportsbook — traditional markets
client.get_moneylines("event_id")         # event winner
client.get_matchups("event_id")           # head-to-head
client.get_totals("event_id")             # over/under
client.get_exactas("event_id", n=2)       # exacta (2, 3, or 4)
client.get_podiums("event_id")            # top-3 finish
client.get_shows("event_id")             # shows
client.get_heat_winners("event_id")       # heat winner
client.get_fastest_lap("event_id")        # fastest lap
client.get_dream_team("event_id")         # dream team

# DFS — player-level markets
client.get_player_props("event_id")       # prop bets
client.get_player_matchups("event_id")    # pick'em matchups
client.get_player_totals("event_id")      # over/under by stat

# Prediction markets — probability-first
client.get_market_probabilities("event_id")               # win probabilities
client.get_podium_probabilities("event_id")               # top-3 probabilities
client.get_top_finish_probabilities("event_id", top_n=5)  # top-N probabilities

# Same Game Parlay
client.calculate_parlay("event_id", picks=["odd_id_1", "odd_id_2"])

# Generic — any market by name or alias
client.get_odds("event_id", "moneyline")  # aliases: "h2h", "props", "totals", etc.
```

## Events

```python
client.list_events(status="upcoming")                     # pre-event
client.list_events(status="live")                         # in-progress
client.list_events(status="completed")                    # historical + settlement
client.list_events(status=["live", "upcoming"])           # combine filters
client.list_events(league="f1", status="upcoming")        # filter by league
client.get_event("event_id")                              # full detail with rounds/heats
client.get_participants("event_id")                       # athletes / roster
client.get_heat_scores("event_id", "heat_id")            # scores / lap times
```

## Futures

```python
client.list_futures()                                     # all available futures
client.get_futures(tour="tour_id", type="winner")         # season winner odds
```

## Setup

```python
from altsportsdata import AltSportsData

# All leagues
client = AltSportsData(api_key="your_key")

# Lock to a league — auto-filters every query
wsl = AltSportsData(api_key="your_key", league="wsl")
f1  = AltSportsData(api_key="your_key", league="f1")
spr = AltSportsData(api_key="your_key", league="spr")
```

## Google Colab

```python
!pip install altsportsdata

from altsportsdata import AltSportsData
from google.colab import userdata

client = AltSportsData(api_key=userdata.get("ALTSPORTSDATA_API_KEY"))

for lg in client.list_leagues():
    print(f"{lg.key:15} {lg.name}")
```

## 30 Leagues

| Code | League | Code | League |
|------|--------|------|--------|
| `wsl` | World Surf League | `pbr` | Professional Bull Riders |
| `sls` | Street League Skateboarding | `bkfc` | Bare Knuckle FC |
| `f1` | Formula 1 | `motogp` | MotoGP |
| `spr` | Supercross | `mxgp` | MXGP |
| `nrx` | Nitrocross | `jaialai` | Jai Alai |
| `fdrift` | Formula Drift | `nll` | National Lacrosse League |
| `masl` | Major Arena Soccer | `nhra` | NHRA Drag Racing |
| `powerslap` | Power Slap | `dgpt` | Disc Golf Pro Tour |
| `worldoutlaws` | World of Outlaws | `usac` | USAC Racing |
| `xgame` | X Games | `motoamerica` | MotoAmerica |
| `hlrs` | High Limit Racing | `byb` | BYB Extreme Fighting |
| `athletesunlimited` | Athletes Unlimited | `lux` | LUX Fight League |
| `raf` | Real American Freestyle | `mltt` | Major League Table Tennis |
| `motocrs` | Motocross | `spectation` | Spectation |
| `gsoc` | Global Soccer | `sprmtcrs` | Supermotocross |

## Links

- [API Docs](https://api.altsportsdata.com/public/docs)
- [Swagger](https://api.altsportsdata.com/public/docs/swagger)

## License

MIT
