Normalizing Odds Across Sportsbooks: Events, Markets and IDs
How multi-source odds data is normalized into one schema. Event matching, team and player ids, market keys, periods, selection ids that join across books, and how to treat suspended and removed prices.
Normalizing odds across sportsbooks is mostly a naming problem. Every source has its own way of identifying a game, writing a team name, labelling a market and marking a period. A price only means something once you know exactly which game, which outcome and which line it belongs to. If those links are wrong, every comparison built on top of them is wrong too, and nothing shows it.
PreciseAPI normalizes 36 sources (23 sportsbooks, 7 exchanges, and 6 DFS pick'em apps) across 17 leagues into one schema. This post covers how that schema is organized, which ids to rely on for what, and the edge cases that matter when you join odds to your own data or compare books.
Five objects, five id types
Everything in the API is built from five objects. Every id is an opaque string with a type prefix and never changes.
| Object | Id format | Identifies |
|---|---|---|
| Event | evt_… | A game, match, fight or golf matchup |
| Team / competitor | {league}_…, e.g. nba_lal | A team, or a slugged name in individual sports, e.g. tennis_carlos_alcaraz |
| Player | nikola_jokic | A player with prop coverage, keyed by the normalized name |
| Market | mkt_… | One source's offer for a market key and period on an event, plus player or team where relevant |
| Selection | sel_… | One outcome at one line, shared across every source |
The table packs in one important asymmetry. Market ids are per source: DraftKings' full-game spread on a game and Pinnacle's full-game spread on the same game have different market ids. Selection ids are shared: the home team at −4.5 has the same selection id at every book that offers it. Most of what follows depends on that distinction. The data model reference has the full field list.
Event matching when normalizing odds across sportsbooks
Before you can compare prices for a game across 36 sources, you have to know they're all describing the same game. Sources can disagree on team naming, how precisely they report start times, and which side they list as home. Doubleheaders and neutral-site games make it harder still.
PreciseAPI resolves this upstream, as the first step of its odds normalization. Each game gets one evt_ id, and every source's markets for that game hang off it. The id stays the same through the whole scheduled → live → final lifecycle, so you can cache by event id without worrying about a game being re-keyed when it goes in-play. /v1/events/{id} lists the sources currently pricing an event and the market keys available for it.
Matching your own data to event ids
You face the same problem in reverse when you join odds to your own schedule, stats feed or content system. Do it in two stages: map team names to team ids, then match games on league, both team ids and a start-time window.
const API = 'https://api.preciseapi.com/v1';
const headers = { Authorization: `Bearer ${process.env.PRECISEAPI_KEY}` };
const norm = (s) => String(s).toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[^a-z0-9]/g, '');
// Stage 1: team names -> team ids. /v1/teams costs 1 credit; cache it.
async function teamIndex(league, overrides = {}) {
const { data } = await (await fetch(`${API}/teams?league=${league}`, { headers })).json();
const index = new Map();
for (const t of data) for (const k of [t.id, t.name, t.abbr]) if (k) index.set(norm(k), t.id);
for (const [alias, id] of Object.entries(overrides)) index.set(norm(alias), id); // your own spellings
return index;
}
// Stage 2: one of your rows -> an event id.
function matchEvent(row, events, index) {
const home = index.get(norm(row.home));
const away = index.get(norm(row.away));
if (!home || !away) return { status: 'unmapped_team' };
const t = Date.parse(row.start);
const near = events.filter((e) => e.league === row.league && Math.abs(Date.parse(e.start_time) - t) <= 6 * 3_600_000);
const byGap = (a, b) => Math.abs(Date.parse(a.start_time) - t) - Math.abs(Date.parse(b.start_time) - t);
const exact = near.filter((e) => e.home.id === home && e.away.id === away).sort(byGap);
if (exact.length) return { status: 'matched', id: exact[0].id, ambiguous: exact.length > 1 };
const swapped = near.find((e) => e.home.id === away && e.away.id === home);
if (swapped) return { status: 'matched_swapped', id: swapped.id };
return { status: 'no_match' };
}
Some design notes:
- Return a status, not just an id.
unmapped_teammeans your alias table needs another entry.matched_swappedmeans your source and PreciseAPI disagree about which team is home. Neutral-site games are the usual cause. Spreads andsidevalues are expressed from PreciseAPI's home and away, so flip them before you join. - Use the closest start time for doubleheaders. Two games between the same teams on the same day differ only by start time.
ambiguous: trueflags these so you can check them. - Store the mapping. Once a row is matched, keep the
evt_id with it. Event ids don't change, so you never need to match the same game twice.
Players
/v1/players (1 credit) returns players with prop coverage, their position and team. Player ids are stable across seasons and books. You can filter by team using either the team id (nba_lal) or the abbreviation (LAL). Every prop market carries a player object with id, name, team and position, so join on player.id and keep names for display. For individual sports such as tennis, UFC and golf, /v1/teams returns the competitors themselves.
Market keys
Market labels are the other half of normalizing odds across sportsbooks: sources label the same market in many different ways. PreciseAPI uses over 100 market keys in five groups. The free /v1/markets endpoint returns them, optionally filtered by league.
| Group | Keys |
|---|---|
| Main lines | moneyline, spread, total |
| Alternates | alternate_spread, alternate_total, alternate_team_total |
| Team totals | team_total |
| Player props | player_points, player_rebounds, player_assists, player_threes, player_pra, player_pass_yds, player_pass_tds, player_rush_yds, player_rec_yds, player_receptions, player_strikeouts, player_hits, player_total_bases, player_shots_on_goal |
| Futures | outright |
A few rules make these keys consistent across sports:
- One key per concept.
spreadcovers the point spread, run line, puck line, Asian handicap, and game or map handicaps. Code that compares spreads doesn't need sport-specific branches. - Sides are fixed values. Every outcome has a
sideofhome,away,draw,overorunder. Soccer'smoneylineis three-way and includesdraw. Always match onside, never on outcome names or array position. - Lines have a convention. A market's
lineis the main line from the home team's perspective for spreads, or the total for totals. Each outcome carries its ownpoint, so the away side of a −4.5 spread haspoint: 4.5. - Ladders are a single market. An alternate spread or total is one market whose outcomes each have their own
point. - Source-specific extras are fields, not new keys. DFS lines carry a
variantofstandard,goblinordemon. Exchange outcomes carryliquidityin USD. The schema stays the same.
Market identity and selection ids
A market's identity is its event, source, key, period, subject (player or team) and DFS variant. The line isn't part of it. When a book moves its spread from −3 to −3.5, the market id stays the same, but the outcomes change, and so do their selection ids, because the point is part of a selection's identity.
That gives you two joins for two different questions:
- "Same outcome, same line, which book has the best price?" Group by selection id.
- "How does this market compare across books, whatever the line?" Group by key, period and subject, and keep the line as a column.
const dec = (a) => (a > 0 ? 1 + a / 100 : 1 + 100 / -a);
// Best price per selection for one event from /v1/odds.
function bestBySelection(event) {
const best = new Map(); // sel id -> { key, name, point, price, books }
for (const book of event.bookmakers) {
if (book.type === 'dfs') continue; // pick'em entries aren't priced like book odds
for (const m of book.markets) {
if (m.suspended || (m.variant && m.variant !== 'standard')) continue;
for (const o of m.outcomes) {
const cur = best.get(o.id);
if (!cur || dec(o.price) > dec(cur.price)) best.set(o.id, { key: m.key, name: o.name, point: o.point, price: o.price, books: [book.id] });
else if (o.price === cur.price) cur.books.push(book.id);
}
}
}
return best;
}
The server-side version of this is /v1/best-lines. It groups comparable markets by key, period, subject and line, and only reports a group when at least two sources quote it. Alternates, suspended markets, DFS sources and non-standard variants are left out. It returns best_price and the tied best_books for each outcome. The odds comparison API page covers typical uses, and the line shopping glossary entry explains the concept.
Periods
Period is part of a market's identity. A first-half total and a full-game total are different markets that happen to share a key. PreciseAPI uses five period keys, and each league exposes the ones that apply to it:
| Periods | Leagues |
|---|---|
full_game, 1h, 1q | NFL, NBA |
full_game, 1h | NCAAF, CFL, WNBA, NCAAB, Soccer |
full_game, f5 | MLB |
full_game, 1p | NHL |
full_game | Tennis, PGA, UFC and esports |
Three practical notes:
/v1/odds,/v1/best-linesand the stream default tofull_game. Passperiods=full_game,1h(or theperiodsfield in a stream subscription) to get more./v1/events/{id}/oddsapplies no period filter by default.- Line history is kept for full-game main markets (moneyline, spread and total), not for period markets or props.
- A period key says which part of the game is priced. It doesn't encode each source's settlement rules. If your product depends on those, keep them in your own per-source metadata.
Suspended, removed and stale prices
When normalizing odds across sportsbooks, a wrong price causes more harm than a missing one, so the schema separates "this market is temporarily unreliable" from "this market no longer exists":
| State | REST | Stream | What to do |
|---|---|---|---|
| Active | Included | In the snapshot and deltas | Use it |
| Suspended (source stopped reporting) | Left out unless include_suspended=true | Delta with suspended: true, left out of snapshots | Show it greyed out and leave it out of comparisons |
| Removed (source pulled it) | Absent | Entry in removed with the market_id | Delete it |
| Event finished | On /v1/scores for four hours | event message with status final | Archive it |
Note how updated_at behaves. It records the last time the market's price or line changed, not the last time the source confirmed it. A quiet pre-game moneyline can have an old updated_at and still be current. Use suspension as the authoritative stale signal, and use /v1/sportsbooks (free), which reports each source's live health status, for monitoring. After kickoff, a player prop stays only while its source keeps posting it, so expect some to go suspended when the game starts. The odds screen guide shows how to present all of this in a UI.
Prices default to American odds. Pass format=decimal (three decimal places) or format=probability to receive another representation. Probabilities are implied and still include each source's margin. The API doesn't remove vig, so you can apply whatever method you prefer, such as the one in our no-vig fair odds guide, or check a single market with the no vig calculator. Every paid plan returns this same schema; odds API pricing compares credits, rate limits and features.
Frequently asked questions
Do event ids change when a game goes live?
No. Event ids are kept through scheduled, live and final, and market ids stay stable as prices and lines move. Selection ids change only when the line changes, because the point is part of their identity.
How do I compare books that are offering different lines?
Group markets by key, period and subject, and keep the line as a column. Selection ids join identical outcomes at identical lines. /v1/best-lines groups by line as well, so a book offering a different line shows up in a separate group.
How do I map my own team names to PreciseAPI ids?
Build an alias index from /v1/teams (1 credit per league) covering id, name and abbreviation, then add overrides for your own spellings. Match games on league, both team ids and a start-time window, then store the resulting evt_ id.
Can I compare DFS pick'em lines with sportsbook props?
They come back in the same shape from /v1/props, keyed by the same player_* market keys and player ids. Compare standard lines with standard lines only, because goblin and demon lines are deliberately offset. See the DFS API page.
Why is a market in one response but missing from the next?
The source either suspended it, in which case it's hidden unless you pass include_suspended=true, or removed it. A prop its source stops posting after kickoff is suspended the same way. Request with include_suspended=true to tell the two cases apart.