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 October 10, 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.
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": "DraftKings",
"a_open": -198,
"a_close": -192,
"a_current": -192,
"b_open": 164,
"b_close": 160,
"b_current": 160,
"a_close_prob": 0.6575342465753424,
"b_close_prob": 0.38461538461538464,
"total_rounds": 4.5,
"over_odds": -238,
"under_odds": 180,
"captured_at": "2026-10-09T10:01:25.843Z"
}
]
},
"...13 more"
],
"count": 13
}What to do next
- get_line_movement (10 credits). Daily 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.
More guides
Start with 500 free credits
No card. REST or MCP.