- Why Data Beats Intuition
- The Four Types of Betfair Data
- Official and Third-Party Sources
- Working With the Betfair API
- Historical Files: Format and Pitfalls
- Excel for Betfair Analysis
- Python for Betfair Modeling
- R for Statistical Research
- Dashboards and Visualisation
- A Real Research Workflow
- Worked Example: Building a Lay-the-Draw Filter
- Common Data Mistakes
- FAQ
Why Data Beats Intuition
Most traders who lose money on the Betfair Exchange lose because their edge is imagined, not measured. They feel that backing the favourite at 3-furlong call works. They feel that laying the draw "usually" pays. Without a dataset to back the feeling, they are guessing — and the variance of the market punishes guessing.
Data analysis converts guessing into hypothesis-testing. You take a strategy you believe in — say, lay the favourite if traded volume exceeds £500k at 5 minutes pre-off — and you run it against 2,000 historical races. The output is a number: +14.3 ticks per trade, or −2.1 ticks per trade. Suddenly you know whether to put real money behind it.
This pillar pairs with the strategy library you'll actually be testing: what Betfair trading is, scalping, swing trading, pre-match and in-play approaches. The cluster subs below take each data tool deep: data sources and APIs, historical data downloads, Excel templates, Python tutorials, R modelling, and dashboard setup.
The Four Types of Betfair Data
Before you go hunting sources, know what you're hunting. Betfair data falls into four buckets, each with different uses:
1. Pre-event price snapshots
Single point-in-time captures of each runner's back and lay prices. Useful for entry-price studies. Free via the SP archive at promo.betfair.com/betfairsp/prices. One CSV per race, columns include SP, BSP, traded volume, and number of active winners.
2. Tick-by-tick ladder data
Every change to every runner's price recorded with timestamps to the millisecond. The gold standard for serious modelling. Volume is enormous — a typical Saturday card produces 3–5 GB compressed. Available via the Betfair Historical Data portal (paid for some sports, free for others).
3. In-play event data
Match-state events — goals, cards, breaks of serve — with timestamps that you can join to price moves. Often pulled from third-party sports-data feeds (Stats Perform, Sportradar) rather than Betfair directly, because Betfair only sells the price half of the picture.
4. Your own trade log
The most underrated dataset. Every position you take, every fill, every commission charge. Available via the API (listClearedOrders endpoint) or by exporting CSV from a proper trading diary. Without this, you cannot tell whether you are profitable.
Official and Third-Party Sources
| Source | Data | Cost | Format |
|---|---|---|---|
| Betfair SP CSV archive | Daily SP per runner, all sports | Free | CSV (one file per day per sport) |
| Betfair Historical Data portal | Tick-by-tick ladder, all markets | Free (advanced markets) to £0.10 per market | bz2 compressed JSON streams |
| Betfair Exchange API | Live prices, orders, account | Free (£20 one-off key) | JSON-RPC and REST |
| Betfair Hub stats | Sport tipping stats and previews | Free | HTML (scrapeable) |
| Smarketsdata.com | Smarkets historical odds for comparison | Free with account | CSV |
| Football-Data.co.uk | Football results back to 1993 | Free | CSV |
| Stats Perform | Commercial event-level sports data | From £500/month | API |
For 90% of retail research, the free Betfair sources plus Football-Data.co.uk cover everything you need. Subscription feeds are useful only when you're modelling at scale, typically with bot-based execution. The Betfair API guide walks you through the application key setup; the building Betfair bots guide covers downstream automation.
Working With the Betfair API
The Betfair Exchange API is the same machine surface that Bet Angel, Geeks Toy and every other ladder app sits on. You can use it for three things: live price retrieval, position monitoring, and order placement. For research, the first two are what you care about.
The setup is a five-step process:
- Have an active Betfair account with verified address.
- Visit developer.betfair.com and apply for a Live App Key (£20 one-off fee).
- Generate your SSL certificate pair for non-interactive login.
- Install a wrapper library: betfairlightweight (Python) or betfaircpp (C++).
- Test the listMarketCatalogue endpoint with a small sample.
From there, the listMarketBook call gives you live back/lay prices for any market ID. Polling at one-second intervals gives a decent low-rate dataset; for tick-level capture you need the Streaming API which delivers a delta-feed over TLS.
Goal: capture back/lay prices for every UK win market in the next 24 hours.
Endpoint sequence: listEventTypes → filter to horse racing → listMarketCatalogue with marketTypeCode = WIN → loop listMarketBook.
Volume: 200–350 markets per day, 8–14 runners each, 2 sides each. Around 7,000 price rows per minute if you poll every minute.
Storage: ≈ 60MB CSV per day uncompressed.
Full tutorial in the cluster sub Python for Betfair Data Analysis and the Betfair API developers complete guide. The simpler entry point is API getting started.
Historical Files: Format and Pitfalls
Betfair publishes two historical datasets that matter for retail research. The SP CSV archive is simple and small; the Historical Data ladder dumps are huge and powerful.
SP archive
A single CSV per day per sport. Columns: event ID, market ID, runner ID, SP, BSP, win/loss flag, total matched. For a sport like UK horse racing, one file covers all races for the day — usually under 2MB. Backtest these for any strategy that closes at SP or near SP. Get started in the cluster sub where to get historical data.
Tick ladder dumps
The ladder dumps are gzipped streams of every market message Betfair pushed. Each line is a JSON message: market definition, price changes, traded volumes. The catch: you must reconstruct the ladder state machine yourself by replaying messages in timestamp order. Libraries like betfairlightweight.streaming handle replay for you.
Common pitfalls:
- Time-zone drift. Betfair timestamps are UTC. UK sport events are scheduled in BST. Convert explicitly or you'll mis-bucket morning vs afternoon races.
- Survivorship bias. Some markets are deleted by Betfair (abandoned races, postponed matches). Filter explicitly on marketDefinition.status = "CLOSED" only.
- SP vs BSP confusion. SP is the official sportsbook starting price; BSP is the exchange's reconciled price. They differ by 1–4% on average. Pick one and stick with it.
- Volume noise. The first 30 minutes of a market are spammed with cancelled bets and small probes. Use traded-volume thresholds, not match count, for entry filters.
Excel for Betfair Analysis
For 80% of retail research, Excel is enough. The dataset is small (a few thousand races, a few thousand matches), the questions are aggregate (mean P&L, hit rate, drawdown), and Pivot Tables answer them in five clicks.
The starter workbook layout I use:
- Sheet 1 — Raw data. Imported CSV from the SP archive. One row per runner per market.
- Sheet 2 — Strategy flags. Calculated columns marking each row as a trade or not, with stake size and target price.
- Sheet 3 — P&L. One row per trade with realised P&L after commission.
- Sheet 4 — Reporting. Pivot tables: P&L by day, hit rate by week, drawdown chart.
Power Query handles imports and joins above 1 million rows. For volumes beyond that, you'll hit the .xlsx row limit and need to move to Python. The cluster sub Excel for Betfair Analysis ships a downloadable template and walks through the exact formulae. Pair with the Betfair calculator for live position sizing.
Dataset: 12 months of UK Class 2/3 handicap SP CSV files, joined into one workbook (about 18,400 runners).
Strategy flag: lay the favourite if traded volume at off > £400k AND SP < 3.50.
Stake: £30 to lose per trade.
Result: 1,247 qualifying trades. Strike rate (favourite loses) = 68.2%. Net P&L after 5% commission: +£842. Max drawdown: £380.
Conclusion: small positive edge worth refining further with sport-specific filters.
Python for Betfair Modeling
When data volume crosses 1–2 million rows, or when you want to run thousands of parameter combinations, Python is the right tool. The ecosystem is mature:
- Pandas — data manipulation. Backbone of every notebook.
- betfairlightweight — the de-facto Python wrapper for the Betfair API and historical stream replay.
- scikit-learn — classification and regression for price-prediction models.
- xgboost / lightgbm — tree-based models. The retail Betfair modelling community uses these heavily.
- matplotlib / plotly — visualisation. Plotly's Dash framework powers most retail dashboards.
A typical Python research workflow runs across three Jupyter notebooks:
- 01-ingest.ipynb — pull historical data, normalise time zones, dedupe, save to Parquet.
- 02-features.ipynb — compute traded volume bands, momentum signals, drift-from-favourite features.
- 03-backtest.ipynb — run the strategy against features, output performance stats.
The cluster sub Python for Betfair Data Analysis walks through the full notebook stack. Pair with building a Betfair bot in Python and first Betfair bot in Python for execution-side code.
R for Statistical Research
R is less popular than Python in the Betfair community but still excellent for academic-style strategy research. Where Python wins on production execution, R wins on hypothesis testing, regression diagnostics, and publication-quality plots.
The R stack:
- tidyverse for data wrangling.
- data.table for fast group-by on multi-million-row datasets.
- lme4 for mixed-effects models (race-level random effects, runner-level fixed effects).
- ggplot2 for charts that survive peer review.
Most R users on Betfair are ex-academic statisticians or finance quants. If that's you, the cluster sub R for Betfair Statistical Modeling shows exactly how to load Betfair historical files in R and run logistic regression on favourite-win probabilities.
Dashboards and Visualisation
Dashboards exist for two reasons: catching issues fast in live trading, and reviewing weekly performance. The two have different layouts.
Live dashboard
Trades the size of a single screen. Real-time. Updates every 5 seconds. Shows:
- Current P&L (today, this week, this month).
- Open positions with mark-to-market.
- Markets matched but not yet settled.
- Streak counter (consecutive winning vs losing trades).
Built with Plotly Dash, Streamlit, or a simple HTML page hitting listClearedOrders every 5 seconds.
Review dashboard
Used Sunday evenings. Shows:
- P&L by market type, sport, time of day, day of week.
- Average tick capture per trade.
- Stake size distribution and stake creep over time.
- Drawdown chart with annotations on losing weeks.
Full setup in Betfair data visualisation and dashboard setup. The principles transfer if you build the same in our betfair data analysis guide.
A Real Research Workflow
The research workflow that works for me, across roughly 14 strategies I've stress-tested over four years:
- Idea. A specific observation. "Favourites at 2.80–3.40 with traded volume above £500k drift in the last 3 minutes 64% of the time." Specific.
- Filter. Define the exact entry condition in code: sport, market type, price range, traded volume threshold, time-to-off window.
- Backtest in-sample. Run 12 months of historical data. Output: hit rate, average tick capture, max drawdown.
- Backtest out-of-sample. Run on a separate 6-month period that you have not looked at. If performance collapses, the strategy was overfit.
- Paper-trade live. Run the strategy on real markets without staking real money. 50–100 trades. The point is to catch execution issues backtests miss (latency, partial fills, market suspension).
- Small-stake live. Stake at £5–£10. 100–200 trades. Confirm the edge survives commission and slippage.
- Scale. Stake to full size. Continue logging every trade. Re-evaluate quarterly.
Most strategies die at step 3 or 4. That's the point. The role of data is to kill bad strategies before they bleed your bankroll.
The biggest lie in retail betting research is the in-sample-only backtest. Always reserve an untouched out-of-sample window. If you don't, you'll publish strategies to your own brain that look great on the data you tuned them against and lose in production.
Worked Example: Building a Lay-the-Draw Filter
To make this concrete, here's a full mini-project that takes you from data pull to live trade. The strategy is lay the draw with an extra entry filter built from data.
The hypothesis. Lay-the-draw works better in matches where one team is a clear favourite. Our filter: lay the draw only if the favourite's pre-match decimal price is between 1.70 and 2.20.
The data. 18 months of Premier League and Championship match-odds CSV from Football-Data.co.uk, joined to closing Betfair prices from the SP archive. About 1,750 matches.
The filter. Keep only rows where B365H or B365A ≤ 2.20 AND ≥ 1.70. Drops the dataset to 743 matches.
The trade simulation. Lay the draw at the closing exchange price (typically 3.40–3.80 for these matches). Hold until a goal is scored. Trade out at the new draw price.
The result.
| Metric | Value |
|---|---|
| Trades | 743 |
| Strike rate (goal scored before 75') | 71.4% |
| Average tick capture per winning trade | +18 ticks |
| Average loss on losing trades | −42 ticks |
| Net P&L per £30 stake (after 5% commission) | +£1,124 |
| Max drawdown | £312 |
Interpretation. The filter improves vanilla lay-the-draw materially. Out-of-sample testing on the most recent 6 months held the edge at 67.8% strike rate. Cleared for small-stake live.
This kind of workflow is the difference between Betfair trading as gambling and Betfair trading as a research-led discipline. Walk through more applied examples in advanced football trading and Betfair trading systems that work.
Drill Into the Cluster
The detail lives in the cluster subs. Read these in order if you're starting cold:
- Best Betfair Data Sources and APIs — the full source catalogue with download steps.
- Betfair Historical Data: Where to Get It — SP archive plus ladder dumps walked through end to end.
- Excel for Betfair Analysis: Templates — downloadable workbook with the formulae filled in.
- Python for Betfair: Data Analysis Guide — full Jupyter notebook walkthrough.
- R for Betfair: Statistical Modeling — logistic regression on favourite-win probabilities.
- Betfair Data Visualization: Dashboard Setup — live and review dashboards in Plotly Dash.
Sport-Specific Data Considerations
Horse racing
The most data-rich sport on the exchange. Ladder dumps available for every Win and Place market back to 2008. Form data from third parties (Racing Post historical, At The Races) joins cleanly via runner name and date. The deeper guides: horse racing hub, horse racing trading mastery and best horse racing strategies.
Football
Match-state event data (goals, cards, subs) is the unlock. Football-Data.co.uk covers results; for live event timestamps you need Stats Perform or to scrape live commentary. Football hub and football trading strategies walk the applied work.
Tennis
Tennis ladder data is huge but messy: matches retire, are postponed, sets are forfeit. Filter aggressively on match-status. Tennis hub and tennis trading strategies for downstream application.
Other sports
Cricket, golf, greyhounds all have ladder dumps but liquidity is patchier. The cricket guide, golf guide, and greyhound guide walk through each.
Common Data Mistakes
- Backtesting without commission. A 1.5-tick winner pre-commission can be a break-even or loser after. Always include the 5% (or your actual rate — see commission explained).
- Backtesting without slippage. The price you see in the dump is not always the price you would have got. Build in 0.5–1 tick of slippage per trade.
- Ignoring liquidity. A strategy that needs £50 stakes per trade works fine on paper but cannot fill in a market with £200 of available volume.
- Look-ahead bias. Using closing prices to filter trades that would have been placed earlier. The classic killer of backtests.
- P-hacking. Running 200 parameter combinations and reporting the best one. Use out-of-sample testing and Bonferroni-style adjustments.
- No diary. Once you go live, log everything. Without it, you cannot tell whether the live performance matches the backtest.
- Switching strategies after a losing week. Variance is bigger than most beginners expect. Stick with the strategy until the data says it's broken.
My Personal Stack
For transparency, here's what I use day to day:
- Data ingest: Python with betfairlightweight for live, plus shell scripts pulling SP CSVs every night to a local Postgres.
- Storage: Postgres for relational lookups, Parquet on disk for ladder dumps.
- Research: Jupyter Lab notebooks. About 40 notebooks in the repo.
- Modelling: Pandas, scikit-learn, lightgbm.
- Execution: Bet Angel for manual ladder, custom Python bots for automated.
- Dashboard: Streamlit pulling from Postgres. Refresh every 5 seconds for live, on demand for review.
If you're starting from zero, don't try to copy this stack. Build it in this order: Excel → Python notebooks → database → dashboards. Each stage answers questions the previous stage can't, and you learn the data progressively.
Data is the single biggest separator between Betfair traders who survive their first year and traders who don't. Build the habit early. The cluster subs below walk you through every layer of the stack.
Open the Calculator Open Betfair Account →FAQ
Where do I download Betfair historical data? Free SP CSVs at promo.betfair.com/betfairsp/prices. Full ladder dumps via the Betfair Historical Data portal — some sports free, others £0.10 per market. The cluster sub where to get historical data walks through every step.
Is the Betfair API free? The API itself is free. There's a one-off £20 application key fee. Streaming is included.
How big is the historical dataset? A typical Saturday card produces 3–5GB of compressed ladder dumps. Annualised, that's roughly 1TB if you capture everything. Most retail traders selectively download the markets they trade.
Do I need Python or is Excel enough? Excel handles the first 12 months of any retail trader's research. Beyond that — or when you want to run automated bots — Python becomes worth learning.
How long does it take to set up a research stack? Excel-only stack: one weekend. Excel + Python notebooks: 2–3 weeks of evening work. Full Postgres + dashboards stack: 2–3 months.
Can I just buy strategies from someone else? You can buy them. They almost never work. Most "systems" sold online either don't include commission, don't include slippage, or are flat-out fabricated. Build your own. See do Betfair systems actually work.