Skip to content

Guides

How do I get historical cricket odds in Python?

Each sportsbook's opening and closing match-winner price for a match, from mid-2020, decimal and American.

Code verified November 3, 2026. One call to get_odds, 5 credits.

The call

Pass competition and season instead of match_id for a run of matches.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

resp = requests.post(
    "https://mcp.yorkerapi.com/v1/get_odds",
    headers={"x-api-key": API_KEY},
    json={
        "match_id": "1473511",
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]

lines = pd.DataFrame(data["matches"][0]["lines"])
print(data["matches"][0]["match"]["team1"], "v", data["matches"][0]["match"]["team2"], data["matches"][0]["books"], "books")
print(lines.pivot(index="bookmaker", columns="outcome", values="close").head(10))

Replace YOUR_API_KEY with a key from your dashboard. Python needs requests and pandas (pip install requests pandas). JavaScript runs on Node 18 or newer, or in the browser.

What comes back

The data object of the response, trimmed to the first rows. Every field is real output from the run above.

{
  "matches": [
    {
      "match": {
        "id": "1473511",
        "start_date": "2025-06-03",
        "team1_id": "royal-challengers-bengaluru",
        "team1": "Royal Challengers Bengaluru",
        "team2_id": "punjab-kings",
        "team2": "Punjab Kings",
        "winner_id": "royal-challengers-bengaluru",
        "result": "win"
      },
      "books": 31,
      "lines": [
        {
          "bookmaker": "betfair_ex_au",
          "outcome": "Punjab Kings",
          "open": 2.1,
          "close": 1.99,
          "close_american": -101,
          "snapshots": 7,
          "first_at": "2025-06-02 11:55:36+00",
          "last_at": "2025-06-03 13:45:36+00"
        },
        {
          "bookmaker": "betfair_ex_au",
          "outcome": "Royal Challengers Bangalore",
          "open": 1.9,
          "close": 2,
          "close_american": 100,
          "snapshots": 7,
          "first_at": "2025-06-02 11:55:36+00",
          "last_at": "2025-06-03 13:45:36+00"
        },
        "...61 more"
      ]
    }
  ],
  "count": 1
}

What to do next

  • get_line_movement (10 credits). Every snapshot in between, and the median margin-free probability over time.
  • get_match (5 credits). The scorecard that settled it.

More guides

The same guide for other sports

The latest lines from every book are on the odds board.

Start with 500 free credits every month

No card. REST or MCP.