Skip to content

Guides

How do I get a cricket win probability chart in Python?

Our model's chance each side wins at the end of every over of a limited-overs match, and the ten balls that moved it most.

Code verified November 3, 2026. One call to get_win_probability, 10 credits.

The call

T20s, the Hundred, ODIs and one-day matches only. team1_win_prob is from team 1's side all match.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

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

worm = pd.DataFrame(data["overs"])
worm["label"] = worm["innings"].astype(str) + "." + worm["over"].astype(str)
print(worm[["label", "runs", "wickets", "team1_win_prob"]].to_string(index=False))
print(pd.DataFrame(data["biggest_swings"]).head(3))

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.

{
  "match_id": "1473511",
  "team1_id": "royal-challengers-bengaluru",
  "team2_id": "punjab-kings",
  "winner_id": "royal-challengers-bengaluru",
  "overs": [
    {
      "innings": 1,
      "over": 0,
      "runs": 13,
      "wickets": 0,
      "batting_team_id": "royal-challengers-bengaluru",
      "win_prob": 0.6133,
      "wickets_in_over": 0,
      "runs_in_over": 13,
      "team1_win_prob": 0.6133
    },
    {
      "innings": 1,
      "over": 1,
      "runs": 19,
      "wickets": 1,
      "batting_team_id": "royal-challengers-bengaluru",
      "win_prob": 0.523,
      "wickets_in_over": 1,
      "runs_in_over": 6,
      "team1_win_prob": 0.523
    },
    "...38 more"
  ],
  "biggest_swings": [
    {
      "innings": 2,
      "delivery": "8.3",
      "batter": "P Simran Singh",
      "bowler": "KH Pandya",
      "runs_total": 0,
      "wicket_kind": "caught",
      "change_for_team1": 0.1146
    },
    {
      "innings": 2,
      "delivery": "4.7",
      "batter": "Priyansh Arya",
      "bowler": "JR Hazlewood",
      "runs_total": 0,
      "wicket_kind": "caught",
      "change_for_team1": 0.0978
    },
    "...8 more"
  ],
  "count": 40,
  "method": "Our model's chance the batting side wins after each ball: score against the competition's par, wickets in hand, balls left, the target in a chase, and the two sides' ratings before the match. team1_win_prob is the same number from team 1's side."
}

What to do next

  • get_line_movement (10 credits). What the market said before and during the same match.
  • get_deliveries (10 credits). The win probability on every ball, not just at the end of the over.

More guides

Start with 500 free credits every month

No card. REST or MCP.