Python Football Betting Model for Six Leagues

Using statistics, Pandas, BeautifulSoup and AWS to identify value bets

Liam Hartley
Systematic Sports
Published in
8 min readJan 1, 2021

--

Last year, I built a football betting model (algorithm) in Python to help me make data-driven predictions and to identify betting opportunities in the English Premier League (EPL).

This year, I re-built the system from the ground up to find betting opportunities across six different leagues (EPL, La Liga, Bundesliga, Ligue 1, Serie A and RFPL).

After completing my last model in late December 2019, I began putting it to the test with £25 of bets every week. Unfortunately, I only managed to fit in eight weeks of betting before COVID-19 cut the EPL short.

The good news is that I broke even during this period. I bet £200, and I got £200 back.

But I’m not here to break even.

In this article, I will explain my methodology, technical implementation and betting strategy to help you create your own betting model with Python.

Methodology & Code

The new model leverages a lot of the code that was used in the previous model and can be simplified into four steps:

  1. Calculate the average expected goals of every team
  2. Adjust this value based on form, home/away and the opposition's defensive score
  3. Convert this adjusted average value for expected goals into implied probabilities and odds for over/under bets
  4. Compare these odds with the best odds offered by the bookies for overs/unders and make bets based on the likelihood of the outcome
High-level architecture of the model (algorithm)

1. Expected Goals

“Expected goals” (xG) reflect a team's performance much better than shots or shots on target. Instead of considering every “shot on target” equally, xG considers the quality of each shot taken by looking at where it was taken, what foot it was taken with and the “style of play”.

--

--