/momentum-football-bets

Football bets prediction based on momentum

Primary LanguageJupyter NotebookMIT LicenseMIT

Momentum Football Bets - Honer's Algorithm

honers

Table of Contents

  1. About The Project
  2. Install
  3. Concept
  4. Example
  5. License
  6. Disclaimer
  7. Future Improvements

About The Project

The aim of this project is to try and estimate each team's momentum based on their near future fixtures. This is based on the stats of the last 6 results from each team. Then, it attempts to estimate the risk of a bet by calculating the momentum gap between both teams. The end goal is to improve your football acca odds.

The data is gathered by web scraping SkySports website. E.g. https://www.skysports.com/premier-league-fixtures for fixtures, and https://www.skysports.com/football/wolverhampton-wanderers-vs-liverpool/stats/429116 for fixture stats (where it's possible to find last 6 match results).

As an input given as an argument, it's allowed to select:

  • -d/--days: How many days in the future to look for fixtures. Default: 4.
  • -c/--confidence: What is the confidence threshold that the user wants to output. Default: 0, i.e. no filter in place.

Install

This project was originally written and tested with Python 3.6.8.

  1. Install Anaconda

The recommendation is to use this project with Anaconda's Python distribution - either full Anaconda3 Latest or Miniconda3 Latest.

Confirm that you have it with: conda -V. The output should be something along the lines of: conda 4.9.2

  1. Create Environment

You can name the environment whatever you want, e.g.: bets.

conda create -n bets python=3.6.8
  1. Activate the virtual environment
conda activate bets

Note: At the end, you can deactivate it with: conda deactivate

  1. Fork the Project
  • Via HTTPS: https://github.com/DidierRLopes/momentum-football-bets.git
  • via SSH: git@github.com:DidierRLopes/momentum-football-bets.git

Navigate into the folder with: cd momentum-football-bets/

  1. Install poetry
conda install poetry
  1. Install poetry dependencies
poetry install

This is a library for package management, and ensures a smoother experience than: pip install -r requirements.txt. Although the later should also work just fine.

  1. You're ready to Bet!
python honers.py

Concept

Firstly, we attribute 6 points to last result of a team, 5 points to the second most recent match, and so on.

Secondly, based on the outcome of the results, the points will be either positive (+1) if the team wins, negative (-1) if it's a loss, and 0 otherwise (i.e. draw).

Momentum Score

The momentum score is then achieved using the combinations of the last 6 games and their outcomes.

E.g. If Liverpool last match results were: WIN, WIN, WIN, DRAW, LOSE, DRAW, from more recent to older.

Liverpool's momentum score would be: (6 x (+1)) + (5 x (+1)) + (4 x (+1)) + (3 x (0)) + (2 x (-1)) + (1 x (0)) = 13

Internally, the program's momentum score is split across the following bins/descriptions, with min and MAX being -21 and +21, respectively.

momentum

Bet Confidence

Since the momentum of a team only shows one side of the story, you need to compare the momentum of the teams that are playing each other in order to estimate if your bet is risky or safe.

E.g. If Liverpool is having an Excellent momentum of 6 wins in a row, and so is Manchester United, this is considered a risky bet.

However, if Liverpool has drawed in all of their previous matches, and therefore have a momentum of 0, BUT United has lost all of their previous 6 matches, (i.e. momentum of -21), this may be worth a bet due to the disgusting momentum of United.

Hence, the Bet Confidence is estimated from the difference between the momentum score of both teams. The bigger the gap score, the less risky will the app be.

Internally, the programme's bet confidence is split across the following bins/descriptions, with min and MAX being 0 and +42, respectively.

confidence

Example

example

This is the perfect example of how this algorithm still needs tuning and will not guess the outcome of a game, since Chelsea lost 5-2. And that's the reason why we like football.

License

Distributed under the MIT License. See LICENSE for more information.

Disclaimer

I'm NO Bets advisor. This was made for fun, and to automate a due diligence boring task.

Future Improvements

  • Improve scoring algorithm weights
  • Consider ranking of opponent team in last results
  • Consider competition in last results (e.g. champions league more weight than premier league)