Skip to main content

Official Python SDK for the SharpAPI real-time sports betting odds API

Project description

SharpAPI Python SDK

Official Python client for the SharpAPI real-time sports betting odds API.

Get pre-computed +EV opportunities, arbitrage detection, middles, and live odds from 20+ sportsbooks — with Pinnacle as the sharp reference.

Install

pip install sharpapi

Quick Start

from sharpapi import SharpAPI

client = SharpAPI("sk_live_xxx")

# --- Arbitrage opportunities ---
arbs = client.arbitrage.get(min_profit=1.0, league="nba")
for arb in arbs.data:
    print(f"{arb.profit_percent:.2f}% profit — {arb.event_name}")
    for leg in arb.legs:
        print(f"  {leg.sportsbook}: {leg.selection} @ {leg.odds_american} ({leg.stake_percent:.1f}%)")

# --- +EV opportunities ---
evs = client.ev.get(min_ev=3.0, sport="basketball")
for opp in evs.data:
    print(f"+{opp.ev_percentage:.1f}% EV on {opp.selection} @ {opp.sportsbook}")
    if opp.kelly_percent:
        print(f"  Kelly: {opp.kelly_percent:.1%} of bankroll")

# --- Best odds across books ---
odds = client.odds.best(league="nba", market="moneyline")
for line in odds.data:
    print(f"{line.home_team} vs {line.away_team}: {line.selection} {line.odds_american}")

Streaming

Real-time SSE streaming for odds updates and opportunity alerts (requires WebSocket add-on):

stream = client.stream.opportunities(league="nba")

@stream.on("ev:detected")
def on_ev(data):
    for opp in data:
        print(f"+EV: {opp['selection']} {opp['ev_percentage']}% @ {opp['sportsbook']}")

@stream.on("arb:detected")
def on_arb(data):
    for arb in data:
        print(f"Arb: {arb['profit_percent']}% — {arb['event_name']}")

stream.connect()  # Blocks, processing events

Or iterate over events:

for event_type, data in stream.iter_events():
    if event_type == "ev:detected":
        print(data)

All Resources

# Odds
client.odds.get(sport="basketball", league="nba")
client.odds.best(league="nfl", market="moneyline")
client.odds.comparison(event_id="abc123")
client.odds.batch(event_ids=["abc123", "def456"])

# Opportunities
client.ev.get(min_ev=2.0, sportsbook="draftkings")
client.arbitrage.get(min_profit=0.5, sport="football")
client.middles.get(sport="football", min_size=3.0)
client.low_hold.get(max_hold=2.0)

# Reference data
client.sports.list()
client.leagues.list(sport="basketball")
client.sportsbooks.list()
client.events.list(league="nba", live=True)
client.events.search("Lakers")

# Account
client.account.me()       # Tier, limits, features
client.account.usage()    # Request counts

# Streaming
client.stream.odds(league="nba")
client.stream.opportunities(min_ev=3.0)
client.stream.all(sport="basketball")
client.stream.event("event_id_here")

Data Quality

Every opportunity response includes staleness metadata to avoid acting on stale odds:

arbs = client.arbitrage.get()
for arb in arbs.data:
    if arb.possibly_stale:
        print(f"  Skipping — odds may be stale ({arb.oldest_odds_age_seconds}s old)")
        continue
    if "LIVE_HIGH_PROFIT_SUSPICIOUS" in arb.warnings:
        print(f"  Skipping — likely phantom arb")
        continue
    print(f"Actionable: {arb.profit_percent}%")

Rate Limits

Rate limit info is available after every request:

response = client.odds.get()
print(f"Remaining: {client.rate_limit.remaining}/{client.rate_limit.limit}")
print(f"Tier: {client.rate_limit.tier}")

Error Handling

from sharpapi import (
    SharpAPI,
    AuthenticationError,
    TierRestrictedError,
    RateLimitedError,
)

client = SharpAPI("sk_live_xxx")

try:
    evs = client.ev.get()
except AuthenticationError:
    print("Invalid API key")
except TierRestrictedError as e:
    print(f"Upgrade to {e.required_tier} tier for this feature")
except RateLimitedError as e:
    print(f"Rate limited — retry after {e.retry_after}s")

Odds Conversion Utilities

from sharpapi import american_to_decimal, american_to_probability, decimal_to_american

american_to_decimal(-110)       # 1.909
american_to_decimal(150)        # 2.5
american_to_probability(-110)   # 0.524
decimal_to_american(2.5)        # 150

Requirements

  • Python 3.9+
  • httpx
  • pydantic v2

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sharpapi-0.2.0.tar.gz (19.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sharpapi-0.2.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file sharpapi-0.2.0.tar.gz.

File metadata

  • Download URL: sharpapi-0.2.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sharpapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8a2ff0927e5feb689d35937e7718384bce6c682881a9368418c0cdf5d66cf475
MD5 6893457b3b5773fff486b612f1c85fae
BLAKE2b-256 644cf28fc89abcefa3bb9565b8a3bab3e42bcac142d7fd6a8af6ebeddc577992

See more details on using hashes here.

Provenance

The following attestation bundles were made for sharpapi-0.2.0.tar.gz:

Publisher: publish.yml on Sharp-API/sharpapi-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sharpapi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sharpapi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sharpapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a8e8c71b5130e0fd1690edcaf8a2dfcc2109ae2379ae26243ad364010e406bca
MD5 dbd0d648f86f3e05ef3aa700a1709b2f
BLAKE2b-256 59781fc819a932bd96a16f5c81a327c7aa404f2ee5d17dc61b6f16e2b8e9c13d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sharpapi-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Sharp-API/sharpapi-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page