Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.fieldfunded.com/llms.txt

Use this file to discover all available pages before exploring further.

Get Live Sports Odds with Python

Fetch real-time odds for any sport with Python in under 20 lines of code. This tutorial connects to the FieldFunded API, pulls live match odds, and prints them to your terminal — no web scraping, no browser automation, no rate limit headaches.

Why Not Scrape?

Web scraping odds sites breaks constantly. Selectors change, CAPTCHAs appear, IP bans happen. An API gives you structured JSON with guaranteed uptime:
Web ScrapingFieldFunded API
Setup timeHours (Selenium, proxies)5 minutes
Data formatRaw HTML to parseClean JSON
ReliabilityBreaks weekly99.9% uptime
Legal riskGrey area (TOS violations)Licensed data
Rate limitsIP bans10K free req/month

Prerequisites

  • Python 3.8+
  • requests library (pip install requests)
  • A free API key from FieldFunded

Step 1: Get Your Free API Key

Sign up at fieldfunded.com/docs — no credit card required. Your key arrives in your inbox instantly.

Step 2: Fetch Live Events

import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://api.fieldfunded.com/v1"
HEADERS = {"X-API-Key": API_KEY}

# Get all currently live events
response = requests.get(f"{BASE_URL}/live", headers=HEADERS)
data = response.json()

print(f"{data['total']} live games right now\n")

for event in data["events"][:5]:
    print(f"{event['home_team']} vs {event['away_team']}")
    print(f"  Sport: {event['sport_key']}")
    print(f"  Score: {event.get('score', 'N/A')}")
    print()
Output:
12 live games right now

Manchester United vs Liverpool
  Sport: soccer_epl
  Score: 1-2

LA Lakers vs Boston Celtics
  Sport: basketball_nba
  Score: 89-94

Step 3: Get Odds for a Specific Match

event_id = data["events"][0]["id"]

odds_response = requests.get(
    f"{BASE_URL}/events/{event_id}/odds",
    headers=HEADERS
)
odds = odds_response.json()

print(f"Markets available: {len(odds['markets'])}\n")

# Print Match Winner odds
for market in odds["markets"]:
    if "winner" in market["name"].lower() or "1x2" in market["name"].lower():
        print(f"--- {market['name']} ---")
        for selection in market["selections"]:
            print(f"  {selection['name']}: {selection['odds']}")
        break
Output:
Markets available: 847

--- Match Winner ---
  Manchester United: 3.40
  Draw: 3.60
  Liverpool: 2.10

Step 4: Filter by Sport

# Get only soccer events
soccer = requests.get(
    f"{BASE_URL}/events",
    headers=HEADERS,
    params={"sport": "soccer"}
)
soccer_data = soccer.json()

print(f"{soccer_data['total']} upcoming soccer matches\n")

for event in soccer_data["events"][:3]:
    print(f"{event['home_team']} vs {event['away_team']}")
    print(f"  League: {event['league']}")
    print(f"  Kickoff: {event['commence_time']}")
    print()

Step 5: Build a Simple Odds Monitor

Poll the API at intervals to track odds movements:
import time

def monitor_odds(event_id, interval=60):
    """Track odds changes for a specific event."""
    previous = {}

    while True:
        resp = requests.get(
            f"{BASE_URL}/events/{event_id}/odds",
            headers=HEADERS
        )
        odds = resp.json()

        for market in odds["markets"]:
            if "winner" not in market["name"].lower():
                continue

            for sel in market["selections"]:
                key = f"{market['id']}_{sel['id']}"
                current = sel["odds"]

                if key in previous and previous[key] != current:
                    direction = "↑" if current > previous[key] else "↓"
                    print(
                        f"{direction} {sel['name']}: "
                        f"{previous[key]}{current}"
                    )

                previous[key] = current

        time.sleep(interval)

# Usage: monitor_odds("event_abc123", interval=30)

Step 6: Settle a Bet Programmatically

After the match ends, check if a bet won:
settlement = requests.post(
    f"{BASE_URL}/bets/check",
    headers=HEADERS,
    json={
        "event_id": event_id,
        "market": "Match Winner",
        "selection": "Liverpool",
        "stake": 50,
        "odds": 2.10
    }
)
result = settlement.json()

print(f"Status: {result['status']}")  # won, lost, or refund
print(f"Payout: ${result.get('payout', 0)}")

Rate Limit Math

Use caseRequests/dayMonthlyPlan
Check odds for 5 matches daily5150Free
Monitor 3 matches every 60s for 4 hours72021,600Free
Full pipeline: events + odds + settlement2006,000Free
Production bot with 10-min polling across 20 events2,88086,400Starter ($29)
Most Python scripts fit comfortably in the free tier — 10,000 requests/month with no credit card.

Full Working Script

Here is everything combined into a single copy-paste script:
"""
live_odds.py — Fetch live sports odds with Python.
Requires: pip install requests
API Key:  https://fieldfunded.com/docs (free)
"""
import requests

API_KEY = "your_api_key_here"
BASE = "https://api.fieldfunded.com/v1"
H = {"X-API-Key": API_KEY}

# 1. Get live events
live = requests.get(f"{BASE}/live", headers=H).json()
print(f"=== {live['total']} LIVE GAMES ===\n")

for ev in live["events"][:5]:
    print(f"{ev['home_team']} vs {ev['away_team']} ({ev['sport_key']})")

    # 2. Get odds for this event
    odds = requests.get(f"{BASE}/events/{ev['id']}/odds", headers=H).json()
    print(f"  {len(odds['markets'])} markets available")

    # 3. Show match winner odds
    for m in odds["markets"]:
        if "winner" in m["name"].lower() or "1x2" in m["name"].lower():
            for s in m["selections"]:
                print(f"    {s['name']}: {s['odds']}")
            break
    print()

Next Steps

Get Your Free API Key

10,000 requests/month — no credit card required

TypeScript SDK

Prefer Node.js? Use the official SDK with full type safety