Skip to content

Guides

How do I compare UFC closing odds with fight results in Python?

Every fight on a card with each sportsbook's opening, closing and current moneyline next to the winner, method and round.

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

The call

event_id comes from list_events or get_schedule. Use bout_id for one fight.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

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

rows = []
for b in data["bouts"]:
    for book in b["books"]:
        a_won = b["winner"] == b["fighter_a"]
        rows.append({
            "fight": b["fighter_a_name"] + " v " + b["fighter_b_name"],
            "book": book["provider"],
            "a_close": book["a_close"],
            "a_close_prob": book["a_close_prob"],
            "a_won": a_won,
            "method": b["method_display"],
        })
df = pd.DataFrame(rows)
favorite_won = (df["a_close_prob"] > 0.5) == df["a_won"]
print(df.head(8))
print("favorite won:", favorite_won.sum(), "of", len(df))

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.

Or use the official client: pip install fighterapi

What comes back

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

{
  "bouts": [
    {
      "bout_id": "401912278",
      "event_name": "UFC 332: Silva vs. Wang",
      "weight_class": "Women's Flyweight",
      "fighter_a_name": "Natalia Silva",
      "fighter_b_name": "Wang Cong",
      "winner": "4054605",
      "method_display": "Decision - Unanimous",
      "end_round": 5,
      "books": [
        {
          "provider": "BetMGM",
          "a_open": -220,
          "a_close": -220,
          "a_current": -220,
          "b_open": 180,
          "b_close": 180,
          "b_current": 180,
          "a_close_prob": 0.6875,
          "b_close_prob": 0.35714285714285715,
          "total_rounds": null,
          "over_odds": null,
          "under_odds": null,
          "captured_at": "2026-10-03T23:50:36.000Z"
        }
      ]
    },
    "...13 more"
  ],
  "count": 83
}

What to do next

  • get_line_movement (10 credits). Snapshots of a fight's line, to test the open against the close.
  • get_fight (5 credits). Round-by-round stats for any fight on the card.

The data this uses

Every row above comes from UFC odds data. Opening and closing moneylines for UFC fights since June 2020, joined to the result and both fighters' stat sheets, with line movement for upcoming fights.

More guides

The same guide for other sports

The latest lines from every book are on the odds board. Rather ask Claude? 16 free Claude skills call these endpoints for you.

Start with 500 free credits every month

No card. REST or MCP.