Dataset
NBA historical closing lines, by book
Short answer: the NBA Odds package ($349, one time) is the NBA moneyline, spread and total by book at open, close and snapshots in between, plus one consensus closing line per game and the games file to key it on. Per-book open and close start in July 2020. Files come as CSV and Parquet.
What you are buying
The NBA Odds package (id nba-odds, $349 one time) has three tables that join on game_id:
- games: one row per game with the date, teams, final score, periods and venue.
- game_odds: one row per book per snapshot. Each row has the moneyline, the spread, the total and the prices on each side.
- consensus_close holds one row per game with the consensus closing spread, the consensus total and the number of books behind it.
The package is market history, not advice. It records what each book posted and when. Every odds row carries minutes_before_start, so you can take the closing number or any earlier point. Unknown values are blank, never 0, and prices outside realistic bounds are blank. A README, a manifest with a row count per file and a checksum list come in the same download.
Two bigger tiers contain this data. NBA History + Odds ($499) adds every play and player game line. NBA Complete ($799) adds graded player props and the full intraday line history. If you buy Odds first, you can upgrade for the price difference within 90 days.
Coverage and updates
Per-book opening and closing lines start in July 2020. The API documents that before July 2020 each book carries a single final pregame line, which is stored as the close. From July 2020 most books have an opening and a closing line: a median of 7 books per game from 2020-21 to 2022-23 and 8 since, plus a book or two with a final line only. The catalog does not state the first season in the package or a row total, so we do not quote either. Your manifest.json has both.
Odds are pre-game only. Every package includes finished seasons and the current season as of our latest monthly update on the day you buy. While you hold an API plan of Pro or higher, we refresh the current season's files every month at no charge. Without a plan, an end-of-season update costs a quarter of the package price. You can re-download your files for 365 days, and a corrupt or incomplete file is replaced free within 90 days.
Schema
These are the real column names from the free sample, with the matching field in the API's get_odds tool.
| Package column | API field | Meaning |
|---|---|---|
| game_id | game_id | Game key, joins every file |
| bookmaker | books[].provider | The book, as a code |
| snapshot_type | open and close pairs | opening, closing or snapshot |
| captured_at | captured_at | When the line was captured, UTC |
| minutes_before_start | not returned | Minutes between capture and the scheduled start |
| ml_home, ml_away | home_ml_close, away_ml_close | Moneyline, American odds |
| spread_home | home_spread_close | Home spread, negative for the favourite |
| spread_home_odds, spread_away_odds | spread_home_odds, spread_away_odds | Price on each side of the spread |
| total | total_close | Game total |
| total_over_odds, total_under_odds | over_odds, under_odds | Price on each side of the total |
consensus_close has the columns game_id, consensus_spread_home, consensus_total and books. The API returns open and close side by side on one row per book, while the package stores them as separate rows. In the free sample the opening rows have a blank captured_at and minutes_before_start, so use snapshot rows to place a line in time.
A real sample
Five closing rows for game 401859967 (2026 Finals, game 6, New York at San Antonio), from the free sample. Book names are replaced with codes here.
| game_id | bookmaker | snapshot_type | minutes_before_start | ml_home | ml_away | spread_home | spread_home_odds | total | total_over_odds |
|---|---|---|---|---|---|---|---|---|---|
| 401859967 | book_1 | closing | 9 | -200 | 165 | -5.5 | -102 | 215.5 | -118 |
| 401859967 | book_2 | closing | 9 | -187 | 163 | -5.5 | -108 | 215.5 | -116 |
| 401859967 | book_3 | closing | 9 | -210 | 175 | -5.5 | -110 | 215 | -115 |
| 401859967 | book_4 | closing | 9 | -192 | 160 | -5.5 | -108 | 216.5 | -108 |
| 401859967 | book_5 | closing | 9 | -185 | 170 | -5.5 | -104 | 216.5 | -102 |
The consensus close for that game in the sample is a spread of -5.5 and a total of 215.5, from 8 books. The five rows show how much books differ at the close: totals from 215 to 216.5 on the same game.
Load the files
DuckDB reads a folder of season files in one query. This measures how far books disagree on the closing total, by season. File names are our guess from the manifest convention, so check yours. We have not run it, because we do not have the paid files locally.
import duckdb
duckdb.sql("""
SELECT g.season,
count(DISTINCT o.game_id) AS games,
avg(mx - mn) AS avg_total_range
FROM (
SELECT game_id, max(total) AS mx, min(total) AS mn
FROM read_parquet('game_odds_*.parquet')
WHERE snapshot_type = 'closing' AND total IS NOT NULL
GROUP BY game_id
) o
JOIN read_parquet('games*.parquet') g USING (game_id)
GROUP BY g.season
ORDER BY g.season
""").show()The same in Polars. Also unverified.
import polars as pl
odds = pl.scan_parquet("game_odds_*.parquet").filter(
(pl.col("snapshot_type") == "closing") & pl.col("total").is_not_null()
)
spread = (
odds.group_by("game_id")
.agg((pl.col("total").max() - pl.col("total").min()).alias("range"))
.join(pl.scan_parquet("games*.parquet").select("game_id", "season"), on="game_id")
.group_by("season").agg(pl.col("range").mean())
.sort("season").collect()
)
print(spread)Same data through the API
For one game or one day, call the API. Set DUNKAPI_API_KEY to a key from your account first.
import json
import os
import urllib.request
req = urllib.request.Request(
"https://mcp.dunkapi.com/v1/get_odds",
data=json.dumps({"game_id": "401859967"}).encode(),
headers={"Content-Type": "application/json", "x-api-key": os.environ["DUNKAPI_API_KEY"]},
)
with urllib.request.urlopen(req, timeout=30) as resp:
print("HTTP", resp.status)
game = json.load(resp)["data"]["games"][0]
print(len(game["books"]), "books")
for b in game["books"][:3]:
print(b["home_spread_open"], b["home_spread_close"], b["total_open"], b["total_close"])One game costs 5 credits and a whole day costs 10. The free plan gives 500 credits a month, no card.
When not to use this
- You need one game or one week. The API returns every book's open and close for one game for 5 credits.
- You need live lines. Files refresh monthly at best, and odds are pre-game only.
- You need player props or the full intraday history. Those are in the Props package and in Complete.
- You want to resell or republish the raw lines. The licence (version 2026-12-05) does not allow it. Your own derived statistics are fine.
- You expect an opening time stamp. Opening rows in the sample have no capture time.
- You want advice on what to wager. This is history, nothing more.
Who uses closing lines
Most buyers are building models and need a market baseline to compare against: the closing spread and total are the standard yardstick for a team rating. Others study how books differ, how lines move between open and close, or how the market treated back-to-backs and travel. A third group wants a clean, keyed file so a spreadsheet or a notebook can join lines to results without scraping. These jobs read many games at once, which a file does better than a per-game API.
Free sample first
Every tier has a free sample zip with a few real games and the same columns. Download it from the data packages page and load it before you pay.
Get a free key Or download whole seasons as Parquet
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.