avatarThe PyCoach

Summary

This text provides a guide on how to make money from bookies' mistakes using Python for value betting.

Abstract

The article discusses value betting, a strategy for making money in sports betting by taking advantage of bookies' mistakes. Value bets occur when the real odds of a match's outcome are better than what the bookies' odds suggest. The author explains how to manually calculate real odds and bookies' odds for "1x2" outcomes using free betting tools, as well as how to automate the process with Python. The article also provides a simplified 3-step process to find value bets using historical football data and comparing them with bookies' odds.

Bullet points

  • Value betting is a strategy for making money in sports betting by taking advantage of bookies' mistakes.
  • Value bets occur when the real odds of a match's outcome are better than what the bookies' odds suggest.
  • The author explains how to manually calculate real odds and bookies' odds for "1x2" outcomes using free betting tools.
  • The author provides a simplified 3-step process to find value bets using historical football data and comparing them with bookies' odds.
  • The 3-step process involves getting data that backs up real odds, calculating real odds, and comparing real odds with bookies' odds.
  • The author provides a link to a full code for creating a football betting tool with Pandas and Selenium.

How to Make Money When the Bookies Get It Wrong and Lose

A different approach to profit from bookies’ mistakes with Python.

Photo by M. B. M. on Unsplash

When it comes to sports betting, bookies set and control the odds so that, most of the time, they don’t lose — no matter the outcome or the number of people who won the bet. However, that doesn’t mean they don’t make mistakes! In fact, there’s a strategy called value betting that makes the most of bookies’ mistakes in order to maximize earnings. In this article, I’ll show how to find value bets manually with free betting tools and also automatically with some lines of code in Python.

Value Betting

We always want to increase our earnings in any activity we do, and betting is no exception. If we have to choose between getting paid double or triple of the amount of money risked or invested, I think we’d all agree to receive the latter — am I right? This is the concept behind value betting, and it’s how bettors make money in the long run.

Value bet occurs when the “real odds” of a match's outcome are better than what the bookies’ odds suggest. The idea comes from the mathematical concept of expected value. Every time we make a bet, we should always look for value. For example, these are the “Over 2.5 goals” odds collected from 7 bookies during the week for the match Liverpool vs. Man City that will be played on February 7th.

Although we still haven’t calculated the real odds, we can clearly see that the bookies with higher odds (on top) will pay us more, so they might be good candidates for value bets.

As you can see, the concept is simple, but the problem is how to calculate the real odds and find value bets without wasting a lot of time. Before explaining how to do this easily by writing some code, let me show how we would do it manually with betting tools, so you can also understand the math behind it.

Note: Value betting is a profitable system backed by maths and statistics, but it’s not risk-free. In case you’re interested in a risk-free approach, check the “surebets” articles I wrote before. Finding surebets will demand more of your time but will help you make some money in the short run. In contrast, value betting will demand less of your time but will help you make money in the long run. Analyze what’s the best option for you.

How does it work?

In this example, we’ll find value bets for the match Liverpool vs. Man City. Then we need to calculate real odds and bookies odds for “1x2” (1: Liverpool wins, x: Draw, 2:Man City wins)

To make things simple, let’s imagine we already have the real probabilities of the match (I’ll show you how to calculate them a bit later). According to the predictions of the website FiveThirtyEight, Machester City (47%) have more chances of winning the match than Liverpool (28%).

Screenshot took from FiveThirtyEight.

To find a value bet, we need to convert those probabilities to decimal odds. The odds will be the equivalent of the inverse of the probability.

odds = 1/probabily

Then we obtain 3.57 for Liverpool, 2.12 for Man City, and 4.0 if there’s a draw. This is what is known as “real odds” because they represent the real probabilities of an event to happen (they’re also based on estimation but are better indicators than bookies’ odds).

Now to find a value bet, we need to compare these 3 “real odds” with the bookies' odds. To do so, we use the following formula.

Value = (Bookies Odds / Real Odds) — 1

We can say we found a value bet if value > 0

These are a set of “1x2” odds I got from Odds Portal two days before the match. Let’s compare.

Using the “value” formula, we only found value bets for “Manchester City Wins” in MarathonBet, Pinnacle, and Unibet. The odds in those betting sites are higher than what it’s supposed to be (2.12), so we can say those are value bets.

Let’s imagine we bet $100 on the draw. According to our real odds, that should be paying $400 (odds 4.0), but even if we bet in the bookie with the highest odd (3.8) and win, we would make -$20 of what we’re supposed to make ($400). However, there’s value if Man City wins because those $100 would make +7$ of what’s supposed to make ($212).

But this is only 1 match! Value bets can be found across all betting markets in many sports events. By placing bets with value, experience bettors maximize their earning. However, finding them one by one is time-consuming; that’s why most of them pay for tools that let them find value bets in a couple of minutes. Fortunately, you don’t need to pay for it if you know at least the basics of coding.

How to find value bets with Python

Experience bettors pay for expensive, but profitable betting tools that help them easily find value bets among the hundreds of football matches played on a daily basis. However, you don’t need to pay for a betting tool if you know how to code.

In fact, I built a profitable betting tool with Python’s Selenium and Pandas. In the article below I show the full code and explain how I did it.

The following 3 steps are a simplified version of the betting tool I built in Python. They will give you an idea of the concept behind value betting.

Step 1: Get the data that will back up your “real odds.”

To find value bets, we first need to calculate the “real odds.” You can use the FiveThirtyEight website to find the probabilities of a match outcome, but it’s better to calculate the real probabilities yourself since they don’t offer probabilities for all betting markets. That’s why I calculate “real odds” on Python by using historical data.

On this website, you can find historical data in 27 football leagues over the past 10 years. Instead of downloading them one by one, run the following lines of code to get them in a couple of minutes.

The data includes several football stats such as goals scored, conceded, number of corners, shots on target, etc. With this data, you can calculate your own probabilities for any market you want. In this example, we’ll only use data from 4 football leagues.

Step 2: Calculate the real odds.

In this example, we’ll calculate real odds for the market “over 2.5 goals,” but you can calculate for any market — just pick the column wisely for your analysis. Since I want to analyze goals, I’ll use the columns FTHG (home goals) and FTAG (away goals). Then I just need this simple formula to calculate the real odds.

The math behind the formula is simple. It’s the number of favorable outcomes divided by the total number of events. For ‘over 2.5 goals’, this would be the formula.

Real Odds = (Team 1 and Team 2 Matches Over 2.5) / Total Matches

So if you write in Python,

calculate_real_odds(‘Liverpool’, ‘Man City’, dict_historical_data[‘English Premier League’], ‘Over/Under’)

You’ll get 1.67 as real_odds. This value also depends on the sample you pick for the analysis. In step 1, I downloaded 5 seasons (from season 15/16 to 20/21), but you can add or omit some seasons. It’s up to you.

You can find the real “over 2.5 goals” odds of any match by introducing any pair of teams in the formula. calculate_real_odds.

Step 3: Compare real odds with the bookies’ odds.

Now that you have the real odds for any match, you have to compare them with bookie’s odds. As we mentioned before, you can use webs like Odds Portal to find whether the odds were overrated or underrated.

These are the bookie's odds for the ‘Over 2.5’ odds in the match Liverpool vs. Man City found in OddsPortal.

Screenshot took from OddsPortal.

So if we use the formula,

Value = (Bookies Odds / Real Odds) — 1

we’ll obtain that only William Hill doesn’t offer a value bet.

This is only 1 market in 1 match. There are many of these inefficiencies across many sports events in different bookies. You can even scrape the odds from your favorite bookie or from OddsPortal to find them automatically, instead of doing match by match as we did in step 3.

Conclusion

Bookmakers make mistakes, and we can make the most of them. You just need to find value bets that will help you make money in the long run. Today you learned how to find value bets manually with free betting tools and also automatically with some lines of codes in Python.

Technology
Programming
Data Science
Python
Education
Recommended from ReadMedium