Guides / Odds API in Python

Odds API in Python

By the dino.markets team · Updated 25 Nov 2026

This guide asks for NBA moneylines from US books, finds the best price for each team and prints the credits left. The whole script is below.

import json
import os
from urllib.request import Request, urlopen

URL = "https://api.dino.markets/v2/odds?league=nba&markets=moneyline"
request = Request(URL, headers={"Authorization": f"Bearer {os.environ['DINO_API_KEY']}"})

with urlopen(request, timeout=30) as response:
    events = json.load(response)["events"]
    print(response.headers["x-requests-remaining"], "credits left")

for event in events:
    best = {}
    for book in event["books"]:
        for market in book["markets"]:
            for outcome in market["outcomes"]:
                price = float(outcome["price"])
                if outcome["name"] not in best or price > best[outcome["name"]][0]:
                    best[outcome["name"]] = (price, outcome["american"], book["name"])
    for team, (_, american, name) in best.items():
        print(f"{team}: {american} at {name}")

Output for the Celtics at the Wizards, with DraftKings read 24 Nov 2026 at 04:26 UTC and Kalshi at 03:50 UTC:

Output
Boston Celtics: -400 at Kalshi
Washington Wizards: +376 at Kalshi

Set your key

Create a key in the dashboard and export it as DINO_API_KEY. The script sends it in the Authorization: Bearer header.

Ask for one league

nba is the league value. List every value with GET /v2/leagues, which is free. The league pages show each value and its request.

Pick one book

Add books=kalshi to the URL to read a single source. The sources page lists every key.

Watch your credits

The x-requests-remaining header shows what is left. The script makes one call, which costs 1 credit when it returns prices. A higher decimal price is better for you, which is why the script keeps the largest one.

Questions

Which Python version do I need?

Any current Python 3. The script uses only the standard library.

How often can I run it?

We read most books every 30 to 60 seconds; Kambi books, Paddy Power and Smarkets every 1.5 to 2.5 minutes. Polling faster returns the same prices and spends credits.

How do I read one game?

Ask GET /v2/events/{id}/odds with the event id. It costs 1 credit when the answer holds a book.

What happens when my credits run out?

The API answers 429 with quota_exceeded and takes nothing. Wait for the next month or change plan.