Metadata-Version: 2.4
Name: altsportsdata
Version: 2.1.2
Summary: The data feed for alternative sports betting — odds, events, futures for 31 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 data for prediction markets, DFS platforms, and sportsbooks.**

One SDK. 27 leagues. Every market type. Probabilities, odds, props, matchups, futures, and parlays.

```
pip install altsportsdata
```

## 30 Seconds to Live Data

```python
from altsportsdata import AltSportsData

wsl = AltSportsData(api_key="your_key", league="wsl")
events = wsl.list_events(status="upcoming")
probs = wsl.get_market_probabilities(events[0].id)
```

## Built For Three Audiences

### Prediction Markets (Kalshi, Polymarket)

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

# Win probabilities for every participant
probs = wsl.get_market_probabilities("event_id")
for p in probs.get("eventWinner", []):
    ath = p["athlete"]
    print(f"{ath['firstName']} {ath['lastName']}: {p['probability']}% chance")

# Podium / top-N finish probabilities
wsl.get_podium_probabilities("event_id")
wsl.get_top_finish_probabilities("event_id", top_n=5)

# Season futures
wsl.get_futures(tour="tour_id", type="winner")
```

### DFS Platforms (PrizePicks, Underdog)

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

# Player props — the core DFS data
f1.get_player_props("event_id")

# Head-to-head matchups — pick'em format
f1.get_player_matchups("event_id")

# Player totals (over/under)
f1.get_player_totals("event_id", stat="finishingPosition")
```

### Sportsbooks (DraftKings, Bet365, Stake)

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

# Traditional market types
nhra.get_moneylines("event_id")
nhra.get_matchups("event_id")
nhra.get_totals("event_id")
nhra.get_exactas("event_id", n=3)
nhra.get_podiums("event_id")

# Same Game Parlay
nhra.calculate_parlay("event_id", picks=["outcomeId_1", "outcomeId_2"])
```

## Google Colab

```python
!pip install altsportsdata

from altsportsdata import AltSportsData
from google.colab import userdata

client = AltSportsData(api_key=userdata.get('ALTSPORTSDATA_SDK_API_KEY'))

# Browse all leagues
for lg in client.list_leagues():
    print(f"{lg.key:15} {lg.name}")

# Find live odds
events = client.list_events(status="upcoming", sort="asc")
for e in events:
    if "jaialai" in str(e.id or ""):
        continue
    try:
        odds = client.get_market_probabilities(e.id)
        winners = odds.get("eventWinner", [])
        if winners:
            print(f"\n{e.name}:")
            for w in sorted(winners, key=lambda x: x.get("odds") or 999)[:10]:
                ath = w.get("athlete", {})
                print(f"  {ath['firstName']} {ath['lastName']:20} {w['probability']}%  ({w['odds']})")
            break
    except:
        continue
```

## Full API

### Setup

```python
client = AltSportsData(api_key="key")                    # all leagues
wsl    = AltSportsData(api_key="key", league="wsl")      # auto-filters
f1     = AltSportsData(api_key="key", league="f1")
```

### Events

```python
client.list_events(status="upcoming")
client.list_events(status="live")
client.list_events(status="completed")
client.list_events(status=["live", "upcoming"])
client.get_event("event_id")
client.get_participants("event_id")
client.get_heat_scores("event_id", "heat_id")
```

### All Odds Methods

```python
# Prediction markets
client.get_market_probabilities("event_id")            # win probabilities
client.get_podium_probabilities("event_id")            # top-3 finish
client.get_top_finish_probabilities("event_id", top_n=5)  # top-N

# DFS
client.get_player_props("event_id")                    # prop bets
client.get_player_matchups("event_id")                 # h2h pick'em
client.get_player_totals("event_id", stat="points")    # over/under

# Sportsbook
client.get_moneylines("event_id")                      # event winner
client.get_matchups("event_id")                        # head-to-head
client.get_totals("event_id")                          # over/under
client.get_heat_winners("event_id")                    # heat winner
client.get_fastest_lap("event_id")                     # fastest lap
client.get_exactas("event_id", n=2)                    # exacta
client.get_podiums("event_id")                         # podium
client.get_shows("event_id")                           # shows
client.get_dream_team("event_id")                      # dream team

# Generic (any market type by name)
client.get_odds("event_id", "eventWinner")
client.get_odds("event_id", "moneyline")               # aliases work too
```

### Parlays

```python
# Get real outcomeIds from odds first
odds = client.get_moneylines("event_id")
picks = [w["outcomeId"] for w in odds["eventWinner"][:2]]
parlay = client.calculate_parlay("event_id", picks=picks)
```

### Futures

```python
client.list_futures()
client.get_futures(tour="tour_id", type="winner")
```

### Jai Alai

```python
client.get_jaialai_matches("event_id")
client.get_jaialai_odds("event_id")
```

## 27 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 |
| `nrx` | Nitrocross | `mxgp` | MXGP |
| `fdrift` | Formula Drift | `jaialai` | Jai Alai |
| `masl` | Major Arena Soccer | `nll` | National Lacrosse League |
| `powerslap` | Power Slap | `nhra` | NHRA Drag Racing |
| `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 |
| `nll` | National Lacrosse League | `mltt` | Major League Table Tennis |
| `spectation` | Spectation | | |

## Links

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

## License

MIT
