Skip to content

Guides

Build an NFL game model with EPA in Python and test it against closing spreads

Build rolling EPA features, fit a margin model and a win model, and score both on a held-out season against the closing spread and the market's no-margin probability.

Every script run against the live API on December 4, 2026. One full run: 325 credits.

Most NFL model tutorials stop at accuracy on the games the model was built from. This one ends at a harder test: a season the model never saw, scored against the market's own forecast. People search for this as an NFL betting model in Python. What follows forecasts game results and measures the forecast. It sizes no wager and recommends none.

You will pull finished games with their closing spreads and moneylines, pull each team's game-by-game EPA (expected points added per play), and turn them into rolling features that use only games before each kickoff. A linear regression forecasts the home team's margin and a logistic regression forecasts the winner. Both are fit on the 2024 season and scored on 2025, 272 games. The margin forecast is compared with the closing spread by mean absolute error, the win forecast with the market's no-margin probability by log loss and Brier score. A calibration table and a list of the games where the model and the market disagree follow.

Read the result as a measurement. The closing line is the market's last forecast before kickoff, and beating it is hard: most models do not, and this one does not.

One full run costs 325 credits: 5 for the games and 320 for 64 team-season calls at 5 credits each. The free 500 credits cover one full run, with 175 left. The script saves every response to disk, so a rerun spends nothing. EPA comes from our play-by-play and the data is two seasons of it, not three: each added season of team lines costs 160 credits.

1. Install the client and set your key

The client has no required dependencies. This tutorial uses pandas and numpy for the tables and scikit-learn for the models. The client reads your key from ENDZONEAPI_API_KEY. It needs Python 3.9 or newer.

pip install "endzoneapi[pandas]" scikit-learn
export ENDZONEAPI_API_KEY=your_key_here

2. Pull the games with their closing spreads

get_games returns finished games with final scores, the consensus closing spread and total, and both moneylines. result is the home score minus the away score, and spread_line is positive when the home team is favoured, so it is the market's forecast of result: Atlanta's 2.5 below is a forecast that Atlanta wins by 2.5. A call returns 500 games at most (5 credits), so one call covers every regular-season game from week 5 of 2024 to the end of 2025. Weeks 1 to 4 of 2024 are left out of the games on purpose: with a rolling window that needs four earlier games, no game before week 5 gets a forecast, and those weeks feed the features in the next step instead.

import pandas as pd
from endzoneapi import Client, to_dataframe

client = Client()  # reads ENDZONEAPI_API_KEY

# One call, 500 games at most: every finished regular-season game from week 5 of 2024 to the end of 2025.
# Weeks 1 to 4 of 2024 only feed the rolling features, which come from team lines in the next step.
page = client.get_games(date_from="2024-10-01", date_to="2026-03-01", game_type="REG", status="FINAL", limit=500)
games = to_dataframe(page, key="games")
cols = ["game_id", "season", "week", "gameday", "away_team", "home_team", "away_score", "home_score",
        "result", "spread_line", "total_line", "home_moneyline", "away_moneyline"]
games = games[cols].sort_values(["gameday", "game_id"]).reset_index(drop=True)
games.to_csv("games.csv", index=False)

print(len(games), "games;", games.groupby("season").size().to_dict())
print("with a closing spread:", games["spread_line"].notna().sum(), "| with both moneylines:", games[["home_moneyline", "away_moneyline"]].notna().all(axis=1).sum())
print("ties:", int((games["result"] == 0).sum()))
print(games.head(3).to_string(index=False))
print("credits left:", client.last_credits_remaining)

Output

480 games; {2024: 208, 2025: 272}
with a closing spread: 480 | with both moneylines: 480
ties: 1
        game_id  season  week    gameday away_team home_team  away_score  home_score  result  spread_line  total_line  home_moneyline  away_moneyline
 2024_05_TB_ATL    2024     5 2024-10-03        TB       ATL          30          36       6          2.5        44.0            -142             120
 2024_05_ARI_SF    2024     5 2024-10-06       ARI        SF          24          23      -1          7.0        48.5            -325             260
2024_05_BAL_CIN    2024     5 2024-10-06       BAL       CIN          41          38      -3         -2.5        48.5             124            -148
credits left: 322

That is 208 games from 2024 and 272 from 2025, every one with a closing spread and both moneylines. The one tie has no winner and is left out of the win model. The last line is the credit balance of the key that ran it; yours will differ.

3. Pull each team's EPA by game

The cheapest route to EPA by game is get_team_stats, and the reason is the price per game. get_plays returns plays with EPA and a summary over every play a filter matches, at 10 credits a call: one call per team-game would be 1,088 calls and 10,880 credits for these two seasons. get_advanced_stats serves tracking and charting metrics such as time to throw and pressures, not EPA per play. get_team_stats returns one team's weekly lines for a season, each with passing EPA, rushing EPA, attempts, sacks, carries and the gameId, for 5 credits: 32 teams over two seasons is 64 calls and 320 credits.

The trade is that the weekly line holds EPA as sums, not per play. The script counts a team's plays as dropbacks (attempts plus sacks) plus carries and divides. That will not match a count of every snap: penalties, kneel-downs and special teams are not in it. A team's defence is the other side of the same game, so the next step joins each team-game to its opponent's row for the same game_id.

The script saves each call to team_stats/ as it goes, so a rerun skips what you paid for. It waits 1.5 seconds between calls. A first attempt with 1.1 seconds hit the 60 requests a minute limit around call 45 and had to wait a minute.

import json
import os
import time
import pandas as pd
from endzoneapi import Client

client = Client()
games = pd.read_csv("games.csv")
teams = sorted(set(games["home_team"]) | set(games["away_team"]))
print(len(teams), "teams x 2 seasons =", len(teams) * 2, "calls =", len(teams) * 2 * 5, "credits")

# One call per team and season returns that team's weekly lines. Saved as it goes, so a rerun skips what you paid for.
os.makedirs("team_stats", exist_ok=True)
rows = []
for season in (2024, 2025):
    for team in teams:
        path = f"team_stats/{team}_{season}.json"
        if not os.path.exists(path):
            json.dump(client.get_team_stats(team, season=season), open(path, "w"))
            time.sleep(1.5)  # stay well under the 60 requests a minute limit
        for w in json.load(open(path))["weeks"]:
            rows.append({
                "game_id": w["gameId"], "season": w["season"], "week": w["week"], "team": w["team"], "opp": w["opponentTeam"],
                "pass_epa": w["passingEpa"], "rush_epa": w["rushingEpa"],
                "dropbacks": w["attempts"] + w["sacksSuffered"], "carries": w["carries"],
            })

tw = pd.DataFrame(rows)
tw["plays"] = tw["dropbacks"] + tw["carries"]
tw["epa"] = tw["pass_epa"] + tw["rush_epa"]
tw.to_csv("team_weeks.csv", index=False)

print(len(tw), "team-games;", tw["game_id"].nunique(), "distinct games")
print("offense EPA per play, all team-games: %.3f (min %.3f, max %.3f)" % (tw["epa"].sum() / tw["plays"].sum(), (tw["epa"] / tw["plays"]).min(), (tw["epa"] / tw["plays"]).max()))
print(tw.head(3).to_string(index=False))
print("credits left:", client.last_credits_remaining)

Output

32 teams x 2 seasons = 64 calls = 320 credits
1088 team-games; 544 distinct games
offense EPA per play, all team-games: 0.009 (min -0.669, max 0.497)
        game_id  season  week team opp  pass_epa  rush_epa  dropbacks  carries  plays        epa
2024_01_ARI_BUF    2024     1  ARI BUF -1.184850  4.984950         35       25     60   3.800100
 2024_02_LA_ARI    2024     2  ARI  LA 18.101090  3.402356         22       40     62  21.503446
2024_03_DET_ARI    2024     3  ARI DET -5.631905 -7.003579         35       18     53 -12.635484
credits left: 2

There are 1,088 team-games, two for each of the 544 games in 2024 and 2025 (the 2024 season is whole here, weeks 1 to 4 included). The league-wide offence made 0.009 EPA per play, close to zero, which is what a league-wide average of a per-play measure should give.

4. Build rolling features and fit the models

Everything the model sees is known before kickoff. For each team the script computes, over the six games before this one, the EPA per play its offence made (off_epa) and the EPA per play its defence allowed (def_epa, so lower is better). shift(1) leaves the game itself out, a team needs four earlier games to get a value, and the window runs across the season boundary, so week 1 of 2025 uses the end of 2024. Each game then has four numbers: the home team's offence and defence and the away team's offence and defence.

Two models use them, both fit on 2024 and applied to 2025. The margin model is ordinary least squares on result. The win model is a standardised logistic regression on the home win. A third margin model also gets the closing spread as a fifth input, to see whether EPA adds anything to the market's own number. The last lines rebuild one feature by hand from the six games before it, as a check that the game itself is not in its own window.

import numpy as np
import pandas as pd
from sklearn.linear_model import LinearRegression, LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler

games = pd.read_csv("games.csv")
tw = pd.read_csv("team_weeks.csv")

# Each team-game gets the opponent's side of the same game: what the opponent's offense did against this defense.
opp = tw[["game_id", "team", "epa", "plays"]].rename(columns={"team": "opp", "epa": "opp_epa", "plays": "opp_plays"})
tw = tw.merge(opp, on=["game_id", "opp"]).sort_values(["team", "season", "week"])

# Rolling features from the last 6 games BEFORE this one: shift(1) drops the current game.
# Ratio of sums, so a game with more plays counts for more. Needs at least 4 earlier games.
def rolling_rate(num, den):
    n = tw.groupby("team")[num].transform(lambda s: s.shift(1).rolling(6, min_periods=4).sum())
    d = tw.groupby("team")[den].transform(lambda s: s.shift(1).rolling(6, min_periods=4).sum())
    return n / d

tw["off_epa"] = rolling_rate("epa", "plays")            # EPA per play the offense made
tw["def_epa"] = rolling_rate("opp_epa", "opp_plays")    # EPA per play the defense allowed (lower is better)
feat = tw[["game_id", "team", "off_epa", "def_epa"]]

df = (games
      .merge(feat.rename(columns={"team": "home_team", "off_epa": "h_off", "def_epa": "h_def"}), on=["game_id", "home_team"])
      .merge(feat.rename(columns={"team": "away_team", "off_epa": "a_off", "def_epa": "a_def"}), on=["game_id", "away_team"]))
FEATURES = ["h_off", "h_def", "a_off", "a_def"]
df = df.dropna(subset=FEATURES).copy()
df["home_win"] = (df["result"] > 0).astype(int)

train = df[df["season"] == 2024]
test = df[df["season"] == 2025].copy()
print(len(df), "games with features:", len(train), "to train on (2024), ", len(test), "to test on (2025)")

# Margin model: ordinary least squares on home margin (home score minus away score).
margin_model = LinearRegression().fit(train[FEATURES], train["result"])
test["model_margin"] = margin_model.predict(test[FEATURES])
print(pd.Series(margin_model.coef_, index=FEATURES).round(1).to_string())
print("intercept (home field, in points):", round(margin_model.intercept_, 2))

# Win model: logistic regression on the same four numbers. Ties have no winner and are left out of this fit.
win_train = train[train["result"] != 0]
win_model = make_pipeline(StandardScaler(), LogisticRegression()).fit(win_train[FEATURES], win_train["home_win"])
test["model_prob"] = win_model.predict_proba(test[FEATURES])[:, 1]

# The same margin model, given the closing spread as a fifth number, to see whether EPA adds anything to the market.
FEATURES_PLUS = FEATURES + ["spread_line"]
plus_model = LinearRegression().fit(train[FEATURES_PLUS], train["result"])
test["plus_margin"] = plus_model.predict(test[FEATURES_PLUS])
print("with the closing spread as a fifth feature:")
print(pd.Series(plus_model.coef_, index=FEATURES_PLUS).round(2).to_string())

train_margin, train_rate = train["result"].mean(), win_train["home_win"].mean()
test["base_margin"], test["base_prob"] = train_margin, train_rate
test.to_csv("test_predictions.csv", index=False)
print("training mean margin: %.2f points, home win rate: %.3f" % (train_margin, train_rate))

# Leakage check: rebuild one feature by hand from the six games played before it, and confirm the game itself is not in them.
row = test.iloc[0]
prior = tw[(tw["team"] == row["home_team"]) & ((tw["season"] * 100 + tw["week"]) < (row["season"] * 100 + row["week"]))].tail(6)
print(row["game_id"], row["home_team"], "offense EPA per play over the previous", len(prior), "games (weeks", ", ".join(prior["week"].astype(str)) + "):",
      round(prior["epa"].sum() / prior["plays"].sum(), 4), "| feature used:", round(row["h_off"], 4))

Output

480 games with features: 208 to train on (2024),  272 to test on (2025)
h_off    43.6
h_def   -18.9
a_off   -34.3
a_def    21.3
intercept (home field, in points): 1.83
with the closing spread as a fifth feature:
h_off           0.88
h_def          12.40
a_off          -1.34
a_def          -5.83
spread_line     1.53
training mean margin: 2.04 points, home win rate: 0.538
2025_01_DAL_PHI PHI offense EPA per play over the previous 6 games (weeks 13, 14, 15, 16, 17, 18): 0.0855 | feature used: 0.0855

The coefficients are points of margin per 1.0 of EPA per play, so a home offence 0.1 better is worth 4.4 points, and the signs are the ones football suggests: a better home offence or a worse away offence helps the home team, and a defence that allows more EPA hurts its own side. The intercept, 1.83 points, is the home-field term. With 208 training games, do not read the sizes closely. The last line shows the check: Philadelphia's feature for the 2025 opener, 0.0855, equals the hand-built figure from its last six games of 2024 (weeks 13 to 18).

On a Mac with NumPy 2.0.2 we also saw RuntimeWarning lines about matmul during the fits; the coefficients and scores here came out finite.

5. Score the margin and the winner against the market

Two questions, two scores. For the margin, the error is how many points a forecast of result misses by, on average (MAE) and by the root of the average square (RMSE). The market's forecast is spread_line. For the winner, log loss punishes a confident miss hard and the Brier score is the mean squared error of the probability; lower is better on both. The market's probability turns each closing moneyline into an implied probability and scales the two to sum to 1, which removes the book's margin. A constant forecast of the training margin or home win rate is the floor any model has to clear.

The script resamples the games 2,000 times to put a 95% interval on each gap.

import numpy as np
import pandas as pd
from sklearn.metrics import brier_score_loss, log_loss

test = pd.read_csv("test_predictions.csv")

# Part 1: the margin. Mean absolute error of each forecast of (home score minus away score).
# The closing spread is the market's forecast of that margin: spread_line is positive when the home team is favoured.
test["spread_margin"] = test["spread_line"]
mae = {}
for name, col in [("Training mean margin", "base_margin"), ("EPA model", "model_margin"), ("EPA model + spread", "plus_margin"), ("Closing spread", "spread_margin")]:
    err = (test["result"] - test[col]).abs()
    mae[name] = {"MAE": err.mean(), "RMSE": np.sqrt(((test["result"] - test[col]) ** 2).mean())}
print(len(test), "test games, 2025 regular season")
print(pd.DataFrame(mae).T.round(2).to_string())

rng = np.random.default_rng(0)
def gap_interval(a, b):
    d = (test["result"] - test[a]).abs().to_numpy() - (test["result"] - test[b]).abs().to_numpy()
    boot = [d[rng.integers(0, len(d), len(d))].mean() for _ in range(2000)]
    return d.mean(), np.percentile(boot, [2.5, 97.5])
for label, col in [("EPA model", "model_margin"), ("EPA model + spread", "plus_margin")]:
    m, (lo, hi) = gap_interval(col, "spread_margin")
    print("%s minus closing spread, MAE: %.2f points (95%% interval %.2f to %.2f)" % (label, m, lo, hi))

# Part 2: the winner. The market's probability is the no-margin one: both closing moneylines
# turned into implied probabilities, then scaled to sum to 1.
def implied(ml):
    return np.where(ml < 0, -ml / (-ml + 100), 100 / (ml + 100))
h, a = implied(test["home_moneyline"]), implied(test["away_moneyline"])
test["market_prob"] = h / (h + a)
test.to_csv("scored.csv", index=False)

w = test[test["result"] != 0].copy()   # a tie has no winner
print(len(w), "games with a winner")
rows = {}
for name, col in [("Training home rate", "base_prob"), ("EPA model", "model_prob"), ("Market (no-margin close)", "market_prob")]:
    rows[name] = {"log_loss": log_loss(w["home_win"], w[col]), "brier": brier_score_loss(w["home_win"], w[col])}
print(pd.DataFrame(rows).T.round(4).to_string())

def per_game(col):
    p = w[col].clip(1e-6, 1 - 1e-6)
    return -(w["home_win"] * np.log(p) + (1 - w["home_win"]) * np.log(1 - p)).to_numpy()
d = per_game("model_prob") - per_game("market_prob")
boot = [d[rng.integers(0, len(d), len(d))].mean() for _ in range(2000)]
print("model minus market, log loss: %.4f (95%% interval %.4f to %.4f)" % (d.mean(), *np.percentile(boot, [2.5, 97.5])))
print("home team won %d of %d; forecast above 50%% by the model in %d games and by the market in %d" % (
    w["home_win"].sum(), len(w), (w["model_prob"] > 0.5).sum(), (w["market_prob"] > 0.5).sum()))
print("model and market put the home team on the same side of 50%% in %d of %d games" % (((w["model_prob"] > 0.5) == (w["market_prob"] > 0.5)).sum(), len(w)))

Output

272 test games, 2025 regular season
                        MAE   RMSE
Training mean margin  11.05  14.15
EPA model             10.39  13.24
EPA model + spread    10.11  12.46
Closing spread         9.72  12.27
EPA model minus closing spread, MAE: 0.66 points (95% interval 0.17 to 1.17)
EPA model + spread minus closing spread, MAE: 0.39 points (95% interval 0.02 to 0.76)
271 games with a winner
                          log_loss   brier
Training home rate          0.6901  0.2485
EPA model                   0.6365  0.2231
Market (no-margin close)    0.6094  0.2121
model minus market, log loss: 0.0271 (95% interval -0.0066 to 0.0626)
home team won 146 of 271; forecast above 50% by the model in 150 games and by the market in 157
model and market put the home team on the same side of 50% in 208 of 271 games

How to read it:

  • Margin. The closing spread missed by 9.72 points on average, the EPA model by 10.39 and a constant by 11.05. The model is 0.66 points behind the spread, with a 95% interval of 0.17 to 1.17: the gap does not include zero, so over these 272 games the spread was closer. RMSE says the same, 12.27 against 13.24.
  • Adding the spread. Giving the model the closing spread as a fifth input brings its error to 10.11, still 0.39 behind the spread alone (interval 0.02 to 0.76). The six-game EPA features did not improve on the spread alone.
  • Winner. Log loss is 0.6365 for the model, 0.6094 for the market and 0.6901 for the constant home rate (a coin flip scores 0.693). The model is 0.0271 behind the market, with an interval of -0.0066 to 0.0626. That interval includes zero, so 271 games cannot separate the two on log loss, though the model is behind on the point estimate and on Brier (0.2231 against 0.2121).
  • Agreement. The two put the home team on the same side of 50% in 208 of 271 games.
  • Why the market is hard to catch. The closing spread takes in what is known at kickoff: injuries, the quarterback, weather, rest and the money that has already moved the price. Six games of team EPA see none of it. Doing better than the closing line is hard, and most models do not manage it.

One held-out season is one draw. Rerun on another season before reading anything into a gap this size.

6. Check calibration in bands

A probability is calibrated when games forecast at 60% are won about 60% of the time. The script groups the 271 games into bands of forecast, for the model and for the market, and compares the average forecast with how often the home team won.

import pandas as pd

df = pd.read_csv("scored.csv")
df = df[df["result"] != 0]
edges = [0, 0.3, 0.4, 0.5, 0.6, 0.7, 1.0]
out = []
for name, col in (("model", "model_prob"), ("market", "market_prob")):
    band = pd.cut(df[col], edges)
    t = df.groupby(band, observed=True).agg(games=("home_win", "size"), predicted=(col, "mean"), actual=("home_win", "mean"))
    t.index = [f"{name} {i.left:.0%}-{i.right:.0%}" for i in t.index]
    out.append(t)
print(pd.concat(out).round(3).to_string())

Output

                 games  predicted  actual
model 0%-30%        37      0.227   0.297
model 30%-40%       35      0.361   0.400
model 40%-50%       49      0.447   0.449
model 50%-60%       35      0.557   0.543
model 60%-70%       46      0.646   0.565
model 70%-100%      69      0.787   0.783
market 0%-30%       34      0.226   0.206
market 30%-40%      33      0.346   0.455
market 40%-50%      47      0.443   0.404
market 50%-60%      43      0.556   0.581
market 60%-70%      45      0.645   0.533
market 70%-100%     69      0.797   0.812
Home win rate by forecast band, 2025 regular season
  • Model
  • Market
  • Market average forecast
0.0%20.0%40.0%60.0%80.0%100.0%Probability the home team winsHome team won0-30%30-40%40-50%50-60%60-70%70-100%Model, 0-30%: 29.7%Model, 30-40%: 40.0%Model, 40-50%: 44.9%Model, 50-60%: 54.3%Model, 60-70%: 56.5%Model, 70-100%: 78.3%Market, 0-30%: 20.6%Market, 30-40%: 45.5%Market, 40-50%: 40.4%Market, 50-60%: 58.1%Market, 60-70%: 53.3%Market, 70-100%: 81.2%Market average forecast, 0-30%: 22.6%Market average forecast, 30-40%: 34.6%Market average forecast, 40-50%: 44.3%Market average forecast, 50-60%: 55.6%Market average forecast, 60-70%: 64.5%Market average forecast, 70-100%: 79.7%

271 games with a winner. Games are grouped by the probability each forecaster gave the home team. The third line is the market's average forecast in the band, for reference. Bands hold 33 to 69 games, so a point can sit 7 points or more from its true rate by chance.

What the table shows:

  • Neither is far off in the bands that hold the most games. In the top band, 69 games each, the model forecast 78.7% and the home team won 78.3%; the market forecast 79.7% and the home team won 81.2%.
  • The largest misses are in the middle, in small bands. The model's is 60 to 70% (64.6% forecast, 56.5% won, 46 games). The market's are 30 to 40% (34.6% against 45.5%, 33 games) and 60 to 70% (64.5% against 53.3%, 45 games). With 33 to 49 games in a band the home win rate has a standard error of about 7 points, so misses of 8 to 11 points are within what chance produces. A season of 271 games is too few to tell two calibrations apart.

7. Where the model and the market disagree

This is analysis, not a signal. The script takes the gap between the model's margin and the spread for each game, counts the games where they differ by 3 points or more and by 6 or more, asks which forecast was closer to the result, and lists the eight largest gaps. spread_line is the market's home margin, so a negative one means the road team was favoured.

import pandas as pd

df = pd.read_csv("scored.csv")
df["gap"] = df["model_margin"] - df["spread_line"]        # model's margin minus the market's, in points
df["model_err"] = (df["result"] - df["model_margin"]).abs()
df["spread_err"] = (df["result"] - df["spread_line"]).abs()
print("mean absolute gap: %.2f points, largest: %.2f" % (df["gap"].abs().mean(), df["gap"].abs().max()))

for cut in (3, 6):
    big = df[df["gap"].abs() >= cut]
    print("gap of %d points or more: %d games; the spread was closer to the result in %d, the model in %d" % (
        cut, len(big), (big["spread_err"] < big["model_err"]).sum(), (big["model_err"] < big["spread_err"]).sum()))

# The eight biggest gaps. result is the home margin; a negative spread_line means the road team was favoured.
cols = ["game_id", "spread_line", "model_margin", "gap", "result"]
print(df.reindex(df["gap"].abs().sort_values(ascending=False).index).head(8)[cols].round(1).to_string(index=False))

Output

mean absolute gap: 3.58 points, largest: 14.82
gap of 3 points or more: 133 games; the spread was closer to the result in 82, the model in 51
gap of 6 points or more: 50 games; the spread was closer to the result in 28, the model in 22
        game_id  spread_line  model_margin   gap  result
 2025_17_TB_MIA         -5.5           9.3  14.8       3
 2025_18_GB_MIN         12.5          -2.3 -14.8      13
2025_05_HOU_BAL         -2.5          11.0  13.5     -34
 2025_02_TB_HOU          2.5         -10.5 -13.0      -1
2025_16_CIN_MIA         -3.5           9.3  12.8     -24
2025_09_BAL_MIA         -7.5           3.8  11.3     -22
 2025_17_DEN_KC        -13.5          -2.5  11.0      -7
2025_02_CLE_BAL         12.5          23.3  10.8      24

What the output shows:

  • How often they differ. The average gap is 3.58 points. In 133 of 272 games it was 3 points or more, and the spread was closer to the result in 82 of them (62%) and the model in 51. At 6 points or more, 50 games, the split was 28 to 22.
  • Disagreeing was not, on this season, a sign the model knew more. The spread was closer more often in both cuts. That is the margin result from the last step seen game by game.
  • The biggest gaps. Miami at home is in three of the eight (2025_17_TB_MIA, 2025_16_CIN_MIA and 2025_09_BAL_MIA): the model had Miami ahead by 3.8 to 9.3 points where the market had the visitor ahead by 3.5 to 7.5. Miami won the first by 3, which the model was nearer to, and lost the other two by 24 and 22, where the spread was nearer. This guide did not check why the model liked Miami; the injury report and quarterback changes are the first places to look.

Where to go next. Add the quarterback, injuries, rest and weather as features, pull a third season of team lines (160 credits) to train on more than 208 games, score the opening spread as well as the close, and keep a season held out every time you change a feature. get_game_probabilities serves the same no-margin probability for one game at 5 credits; this guide worked it out from the two moneylines because the key that ran it had 2 credits left after the team lines. If your model scores worse than the closing line, that is the usual result, not a bug.

Tools and credits

  • get_games: 1 call, 5 credits (one call, 500 games at most).
  • get_team_stats: 64 calls, 320 credits (32 teams, 2024 and 2025).

One full run: 325 credits.

What you can do with the data

You may store these rows, train models and backtest on them, and build products that show your users what you derive. You may not redistribute the rows, or the lines as a raw feed, as a dataset or API of its own. Lines and prices are market information. This tutorial forecasts game results and measures the forecast; it does not size, price or recommend a wager. A past score is not a forecast of a future one.

Details: data timing and rights.

What to do next

Start with 500 free credits every month

No card. pip install endzoneapi, REST or MCP.