Guide

Closing lines as a benchmark for model evaluation

Short answer: the closing line is a strong, fixed reference for a probability model. Remove the margin, score both the market and your model against results with log loss and Brier, and compare on the same games. On 130 NBA games a simple Elo model scored 0.6371 against the market's 0.5943 in log loss.

This guide is about measuring a model. It does not describe a way to wager, and none of the numbers here are recommendations.

What the closing line is, for an evaluator

A sportsbook's closing line is its last pre-game price. By then lineups are known, injuries are priced and the early disagreement between books has narrowed. Across many books the average probability is a pooled forecast that is hard to match, which is why researchers use it as a baseline the way they would use a well-tuned reference model.

Treat it as one forecast with a known timestamp, not as ground truth. Prices come with a margin, so the first step is to convert them to fair probabilities. The get_game_probabilities tool does this: with snapshot_type set to closing (the default) it returns each book's last pre-game price so far, with the margin removed proportionally per book, then averaged. For how that rule compares with others, see the guide on removing the margin.

What to score

Two proper scoring rules do the work.

  • Log loss is the mean of -log(p) for the probability given to what happened. It punishes confident misses heavily.
  • Brier score is the mean squared gap between the probability and the 0 or 1 result. It is gentler on extremes.

A benchmark table needs three rows: the market, your model and a trivial baseline such as the home win rate. Without the baseline you cannot tell a good number from a number that merely looks small. A coin-flip forecast scores 0.6931 in log loss and 0.2500 in Brier, so anything near those values is no information.

import numpy as np

def log_loss(p, y):
    p = np.clip(p, 1e-6, 1 - 1e-6)
    return -(y * np.log(p) + (1 - y) * np.log(1 - p))

def brier(p, y):
    return (p - y) ** 2

def compare(model_p, market_p, y, reps=4000, seed=0):
    """Mean log loss and Brier for each, plus a bootstrap interval on the log loss gap."""
    gap = log_loss(model_p, y) - log_loss(market_p, y)
    rng = np.random.default_rng(seed)
    boot = [gap[rng.integers(0, len(gap), len(gap))].mean() for _ in range(reps)]
    return {
        "model": (log_loss(model_p, y).mean(), brier(model_p, y).mean()),
        "market": (log_loss(market_p, y).mean(), brier(market_p, y).mean()),
        "gap": gap.mean(),
        "gap_95": tuple(np.percentile(boot, [2.5, 97.5])),
    }

Positive gap means the model is worse than the market. The bootstrap resamples games with replacement, which is a fair way to show how much a few hundred games can and cannot tell you.

A worked sample: 130 NBA games

The sample is 130 completed NBA regular-season games drawn at random from November 8 to December 5, 2026, out of 190 played in that window. For each game we pulled the closing fair home-win probability. The model is a deliberately plain Elo: every team starts at 1500, K is 20, home court is worth 65 points, and ratings update after each of the 388 completed games this season, in start-time order. The 192 games before November 8 act as burn-in. The model has no injury data, no rest, no carry-over from last season and no player information.

import json, os, urllib.request

KEY = os.environ["DUNKAPI_API_KEY"]
def post(tool, body):
    req = urllib.request.Request("https://mcp.dunkapi.com/v1/" + tool, data=json.dumps(body).encode(),
          headers={"Content-Type": "application/json", "x-api-key": KEY})
    with urllib.request.urlopen(req, timeout=60) as r:
        return json.load(r)["data"]

games, offset = [], 0
while offset is not None:                      # every final game this season, 2 pages
    page = post("list_games", {"season": 2027, "status": "final", "limit": 200, "offset": offset})
    games += page["games"]; offset = page.get("next_offset")

def market_home_prob(game_id):                 # 5 credits per game
    ml = post("get_game_probabilities", {"game_id": game_id})["moneyline"]
    return ml["home"]["fair_prob"]

The scores:

ForecastLog lossBrier
Closing market (fair)0.59430.2045
Elo0.63710.2235
Home win rate (0.492)0.69300.2499

The market beat the Elo model by 0.043 in log loss, and the Elo model beat the constant baseline by a similar margin on the other side. The 95 percent bootstrap interval on the Elo-minus-market gap is -0.009 to 0.092. It spans zero. With 130 games the data lean toward the market being better, and they do not prove it.

Blending is a useful check. A logit-space blend with 25 percent weight on Elo gave 0.5955 and a 50 percent blend gave 0.6026, both worse than the market alone at 0.5943. In this sample the plain Elo carried no information the closing price lacked. That is a statement about this Elo, not about every model.

Read calibration, not just the totals

Log loss hides where a model goes wrong. Bin the games by market probability and compare the mean forecast with the actual win rate.

Market probabilityGamesMean marketActual home winsMean Elo
Below 0.35320.2460.2810.472
0.35 to 0.50260.4130.3460.522
0.50 to 0.65330.5780.4240.589
0.65 and above390.7700.8210.689

Two things stand out. Elo is too timid: where the market saw a 0.246 home win chance, Elo said 0.472. And the market's own 0.50 to 0.65 bin looks off, with 33 games and a 0.424 win rate against a 0.578 forecast. Do not read that as a finding. A bin with 33 games has a standard error near 0.09, so a gap of 0.15 is large but still plausible as noise in a month of results. It is the kind of pattern that disappears or grows with more data, which is exactly why the interval above matters.

Timing: the benchmark must match your model's clock

A closing line is available only minutes before the start. If your model issues its probabilities at noon, the fair comparison is the market at noon, not the close. get_line_at_time returns each book's price at a chosen moment and the closing price, with captured_at and the minutes before. For game 401909453 on December 5, the first book's home price at 20:05 UTC was -190, and by the close it was -165, a drop of 0.033 in implied probability. Compare a model issued earlier with the earlier price, or you will give the closing line credit for information your model never had a chance to use.

The closing snapshot has its own quirk. A line first read after the start has a null captured_at and an explanatory note, because its capture time is unknown. Keep rows with a known captured_at before the start when you need a strict point-in-time cut.

Limits

  • 130 games is small. The interval spans zero. Plan for several hundred games per comparison, and more when models differ by under 0.01.
  • One season, one league. NBA moneylines in the first six weeks of a season. Early-season prices and results differ from the playoffs. Check each league and season on its own.
  • The Elo here is a floor. A stronger model would close more of the gap. This sample says nothing about what such a model would score.
  • Averaged fair probability is one choice. It pools books after removing each one's margin. A different pooling or a different margin rule shifts the benchmark by a few thousandths.
  • Outcomes only. Scoring says how well forecasts matched results. It does not say anything about how to use a forecast, and the guide stops there.

Get a free key Or download whole seasons as Parquet

Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.