# Odds Data API for Sports Betting Models & Backtesting
URL: https://sockodds.com/use-cases/sports-betting-machine-learning/

> Sports betting machine learning data API with retained events, no-vig fair odds labels, and results for training and backtesting models on AFL, NRL and more.

Sports betting machine learning data API with retained events, no-vig fair odds labels, and results for training and backtesting models on AFL, NRL and more.

A betting model needs features (prices), labels (outcomes) and a benchmark (fair prices) in one place. SockOdds gives you all three for the Australian market: every book's price, results, and de-vigged `fairOdds`, on events that are retained for backtesting.

## Why use SockOdds for betting models

- **Odds and outcomes in one schema.** Records arrive pre-joined.
- **No-vig labels.** `fairOdds`, `fairSpread`, `fairOverUnder`.
- **Normalised ids.** One `oddID` across books, sports and leagues.
- **Retained events.** Backtest without building an archive first.
- **Python and TypeScript SDKs.** The SGO SDKs pointed here.

## Building and backtesting a model with our data

### Feature engineering

Per-book prices, consensus, fair price, book count, availability, minutes to kick-off.

### Labels and ground truth

`results` when `status.finalized`.

### Backtesting against the last price

Snapshot on a schedule to measure movement; the feed retains the event so the label is always there.

## Example request

```bash
curl "https://api.sockodds.com/v2/events/?leagueID=AFL&finalized=true&limit=100" \
  -H "x-api-key: YOUR_API_KEY"
```

Finished events, prices and results, one page at a time:

```json
{
  "eventID": "afl_2026-09-03_fremantle_vs_hawthorn",
  "leagueID": "AFL",
  "odds": {
    "points-all-game-eo-odd": {
      "oddID": "points-all-game-eo-odd",
      "opposingOddID": "points-all-game-eo-even",
      "marketName": "Odd/Even Total Points",
      "statID": "points",
      "statEntityID": "all",
      "periodID": "game",
      "betTypeID": "eo",
      "sideID": "odd",
      "fairOdds": null,
      "bookOdds": "-116",
      "byBookmaker": {
        "unibet": {
          "odds": "-115",
          "decimal": 1.87,
          "available": true
        },
        "tabtouch": {
          "odds": "-118",
          "decimal": 1.85,
          "available": true
        }
      }
    }
  }
}
```

## SockOdds vs assembling a dataset yourself

| Capability | SockOdds | assembling a dataset yourself |
| --- | --- | --- |
| Odds + outcomes | Pre-joined | Two systems |
| No-vig fair odds | Built in | De-vig yourself |
| Line history | Retained events; snapshot yourself | Snapshot and store every poll |
| Normalised ids | One `oddID` | Reconcile per book |
| Cleaning effort | Minimal | High |

## Frequently asked questions

### What data do I need to train a betting model?

Prices per book, a fair benchmark and outcomes — all on the event.

### Does the API include historical odds?

Retained events from 2026-09; no open/close snapshots.

### How do I get bet outcomes for labels?

`results` on finalized events.

### What is closing line value and can I compute it?

The difference between your price and the last price before kick-off; snapshot to compute it.

### Which SDK should I use?

Python via `pip install sports-odds-api` with the base URL pointed here.

### Is there a free tier?

Yes — AFL and NRL.

## Related use cases

- [Historical Odds Data API](https://sockodds.com/use-cases/historical-odds-data-api/): Finished events are never pruned from the feed, so an odds archive of every Australian book starts the day you start pulling..
- [Odds API for Positive EV Betting](https://sockodds.com/use-cases/positive-ev-betting-api/): Positive EV betting API with no-vig fairOdds and every AU book's price side by side, so you can surface +EV bets without building your own devig pipeline..
- [Odds API for Bet Tracking & Settlement](https://sockodds.com/use-cases/bet-tracking-settlement-api/): A bet tracking and settlement API: grade bets from results and the started/ended/finalized flags.
- [Pricing](https://sockodds.com/pricing/): plans priced on request rate and scope, including a free Lite tier with no card.

## Start building today

Free plan available. Set up in 5 minutes. Scale when you're ready.
