Skip to content

Guides

How do I find MLB teams that over- or underperformed their run differential?

Standings from every final game, with run differential and the Pythagorean win percentage, so you can see who won more or fewer games than their runs say.

Code verified October 10, 2026. One call to get_standings, 2 credits.

The call

Leave season out for the latest.

import requests
import pandas as pd

API_KEY = "YOUR_API_KEY"

resp = requests.post(
    "https://mcp.fastballapi.com/v1/get_standings",
    headers={"x-api-key": API_KEY},
    json={
        "season": 2026,
    },
    timeout=60,
)
resp.raise_for_status()
data = resp.json()["data"]

t = pd.DataFrame(data["standings"]).set_index("abbrev")
games = t["wins"] + t["losses"]
t["expected_wins"] = (t["pythagorean_win_pct"] * games).round(1)
t["luck"] = (t["wins"] - t["expected_wins"]).round(1)
print(t[["wins", "losses", "run_differential", "expected_wins", "luck"]].sort_values("luck"))

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.

{
  "season": 2026,
  "standings": [
    {
      "abbrev": "MIL",
      "wins": 103,
      "losses": 59,
      "runs_scored": 832,
      "runs_allowed": 618,
      "run_differential": 214,
      "win_pct": 0.636,
      "pythagorean_win_pct": 0.633
    },
    {
      "abbrev": "LAD",
      "wins": 100,
      "losses": 62,
      "runs_scored": 801,
      "runs_allowed": 600,
      "run_differential": 201,
      "win_pct": 0.617,
      "pythagorean_win_pct": 0.629
    },
    "...28 more"
  ],
  "count": 30,
  "note": "Regular season, final games only, one table (no league or division split)."
}

What to do next

  • get_team_stats (5 credits). Runs for and against, team batting and opponents' batting, to see where the gap comes from.
  • get_ratings (2 credits). Our team Elo ratings, ranked, for a view that does not depend on run totals.

More guides

Start with 500 free credits

No card. REST or MCP.