Production-grade alternative sports data feed — odds, events, futures, settlement for 30 leagues
Project description
AltSportsData SDK
Production-grade alternative sports data feed — odds, events, futures, settlement for 30 leagues.
Original model-generated probabilities for sports nobody else can price. Built for prediction markets, DFS platforms, and sportsbooks.
pip install altsportsdata
Quick Start
from altsportsdata import AltSportsData
client = AltSportsData(api_key="your_key")
# What events are coming up?
events = client.list_events(status="upcoming")
for event in events:
print(f"{event.name} — {event.startDate}")
Indianapolis — 2026-03-07T12:00:00.000Z
Pipe Masters — 2026-12-09T04:00:00.000Z
Australian Grand Prix — 2026-03-06T00:00:00.000Z
...
# Who's going to win?
odds = client.get_moneylines(events[0].id)
for player in odds:
print(f"{player.name}: {player.odds:.2f} ({player.probability:.1f}%)")
Eli Tomac: 2.02 (49.4%)
Hunter Lawrence: 2.66 (37.6%)
Ken Roczen: 4.26 (23.5%)
Cooper Webb: 6.84 (14.6%)
Joey Savatgy: 16.20 (6.2%)
That's it. Three lines to see every upcoming event. Three more to see who's favored.
Clean Tables
Every response prints as a clean table automatically:
print(events) # table of all events
print(odds) # table of all odds
Instant DataFrame (like Alpaca's bars.df)
df = events.df # pandas DataFrame
df = odds.df # pandas DataFrame
df.to_csv("odds.csv") # export
# Filter and analyze
df[df["league"] == "wsl"].head()
For Prediction Markets (Kalshi, Polymarket)
Probabilities as 0–1, ready for contract creation.
client = AltSportsData(api_key="your_key", odds_format="probability")
wsl = client.get_league("wsl")
odds = wsl.get_market_probabilities(event_id)
for player in odds:
print(f"{player.name}: {player.probability}")
Eli Tomac: 0.4942
Hunter Lawrence: 0.3757
Ken Roczen: 0.2349
Cooper Webb: 0.1462
# DataFrame — ready for contract pricing
df = odds.df
df[["athlete", "probability", "outcome_id"]]
Settlement for Contract Resolution
result = client.get_settlement(event_id)
for name, mkt in result["markets"].items():
for o in mkt.get("winners", []):
print(f" ✅ {o['athlete']} — settled at {result['settled_at']}")
For DFS Platforms (PrizePicks, Underdog)
client = AltSportsData(api_key="your_key")
# Head-to-head matchups — ready for pick'em
matchups = client.get_matchups(event_id)
for m in matchups:
print(f"{m.player1} ({m.odds1:.2f}) vs {m.player2} ({m.odds2:.2f})")
Cooper Webb (2.31) vs Ken Roczen (1.57)
Eli Tomac (1.66) vs Hunter Lawrence (2.13)
# Or get a DataFrame
df = matchups.df
df.to_csv("matchups.csv")
For Sportsbooks (DraftKings, Bet365, Stake)
# American odds
client = AltSportsData(api_key="your_key", odds_format="american")
odds = client.get_moneylines(event_id)
print(odds)
# Fractional odds (UK books)
client = AltSportsData(api_key="your_key", odds_format="fractional")
Odds Format Conversion
Set once on the client — all responses auto-convert:
client = AltSportsData(api_key="key", odds_format="probability") # Kalshi
client = AltSportsData(api_key="key", odds_format="american") # DraftKings
client = AltSportsData(api_key="key", odds_format="decimal") # Stake (default)
client = AltSportsData(api_key="key", odds_format="fractional") # Bet365
Or convert individual values:
from altsportsdata import convert_odds
convert_odds(2.50, "decimal", "american") # → 150.0
convert_odds(2.50, "decimal", "probability") # → 0.4
convert_odds(150, "american", "decimal") # → 2.5
convert_odds("3/2", "fractional", "probability") # → 0.4
Async Client (Production Infrastructure)
from altsportsdata import AsyncAltSportsData
import asyncio
async def main():
async with AsyncAltSportsData(api_key="key", odds_format="probability") as client:
wsl = client.get_league("wsl")
events = await wsl.list_events(status="upcoming")
# Batch fetch — all events concurrently
ids = [e.id for e in events[:20]]
batch = await client.get_odds_batch(ids, "moneyline")
for eid, odds in batch.items():
if "error" not in odds:
print(f"{eid}: {len(odds.get('eventWinner', []))} outcomes")
asyncio.run(main())
Requires: pip install altsportsdata[async]
Enterprise Reliability
Built for production — automatic retry, rate limit handling, request tracing.
client = AltSportsData(
api_key="key",
max_retries=3, # exponential backoff on 429, 5xx
retry_backoff=0.5, # base delay in seconds
timeout=30, # per-request timeout
)
- Automatic exponential backoff with jitter on 429/5xx
- Respects
Retry-Afterheaders - Request IDs (
X-Request-ID) for debugging - Thread-safe session management
- Context manager support:
with AltSportsData(...) as client:
Full API Reference
Setup
from altsportsdata import AltSportsData
# General client
client = AltSportsData(api_key="your_key")
# League-scoped — auto-filters everything
wsl = client.get_league("wsl")
f1 = client.get_league("f1")
spr = client.get_league("spr")
# With options
client = AltSportsData(
api_key="your_key",
league="wsl",
odds_format="probability",
max_retries=3,
)
Leagues & Market Types
leagues = client.list_leagues()
print(leagues) # clean table
df = leagues.df # pandas DataFrame
# League details
info = client.get_league_info("f1")
print(f"{info.name}: {info.market_count} markets — {info.market_types}")
# All market types
client.list_market_types()
# → ['eventWinner', 'exactasEvent', 'fastestLap', 'headToHead', ...]
# Market catalog with event counts
for lg in client.get_market_catalog():
print(f"{lg['league']:12} {lg['name']:30} upcoming={lg['upcoming_events']}")
Events
events = client.list_events(status="upcoming") # ResultSet with .df
events = client.list_events(status="live")
events = client.list_events(status="completed")
events = client.list_events(status=["live", "upcoming"])
print(events) # clean table
df = events.df # pandas DataFrame
events.to_csv("events.csv")
event = client.get_event("event_id")
participants = client.get_participants("event_id")
Markets (one call, prices included)
markets = client.get_markets() # upcoming (default)
markets = client.get_markets(status="live") # live
markets = client.get_markets(status="completed") # settled
markets = client.get_markets(status=["live", "upcoming"]) # all active
print(markets) # clean table
df = markets.df # pandas DataFrame
Odds (per event) — all return OddsResult with .df
# Sportsbook
odds = client.get_moneylines("event_id") # event winner
odds = client.get_matchups("event_id") # head-to-head
odds = client.get_totals("event_id") # over/under
odds = client.get_exactas("event_id") # exacta
odds = client.get_podiums("event_id") # top-3
odds = client.get_heat_winners("event_id") # heat winner
odds = client.get_fastest_lap("event_id") # fastest lap
# Prediction market
odds = client.get_market_probabilities("event_id")
odds = client.get_podium_probabilities("event_id")
odds = client.get_top_finish_probabilities("event_id", top_n=5)
# DFS
odds = client.get_player_props("event_id")
odds = client.get_player_matchups("event_id")
odds = client.get_player_totals("event_id", stat="points")
# Generic — any market by name or alias
odds = client.get_odds("event_id", "moneyline")
# Every OddsResult has .df
print(odds) # clean table
df = odds.df # pandas DataFrame
odds.to_csv("odds.csv")
Batch Operations
# Fetch odds for many events in parallel
events = client.list_events(league="spr", status="upcoming")
ids = [e.id for e in events]
batch = client.get_odds_batch(ids, "moneyline", max_concurrent=5)
Settlement
result = client.get_settlement("event_id")
# → {event_id, event_name, league, status, settled_at,
# markets: {eventWinner: {outcomes, winners}, headToHead: {...}}}
Live Polling
# Generator-based live odds feed
for update in client.poll_odds(event_id, "moneyline", interval=5, max_polls=60):
print(update)
Futures
client.list_futures()
client.get_futures(tour="tour_id", type="winner")
Odds Conversion (Static)
AltSportsData.convert(2.50, "decimal", "american") # → 150.0
AltSportsData.convert(2.50, "decimal", "probability") # → 0.4
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
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file altsportsdata-3.0.1.tar.gz.
File metadata
- Download URL: altsportsdata-3.0.1.tar.gz
- Upload date:
- Size: 44.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02382b12aca221227641c76d18d02a92c81b840bbbb122bf940579c63ed45e0f
|
|
| MD5 |
820da100afb7a6141525f0e187723c74
|
|
| BLAKE2b-256 |
54019848e82c6266cd9afde8441ea9dd9ce827e15c4621394c76461af84133f0
|
File details
Details for the file altsportsdata-3.0.1-py3-none-any.whl.
File metadata
- Download URL: altsportsdata-3.0.1-py3-none-any.whl
- Upload date:
- Size: 39.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fe1c22687b6387b14a060ae24c3b9cde09aacf0bc8d2957ecd15cb074859084
|
|
| MD5 |
94347c37ea3a0a2e4fbabda048df2931
|
|
| BLAKE2b-256 |
d4cd31cf3d071950e32c8ee2fe4541f25a687bd11fc9585fcb5529f85877331f
|