Beat the Bookmaker

My Journey into Betting

I have a sordid relationship with betting. It started in high school. The draw of easy money pulled me into blackjack, poker games, and eventually sports betting.

The unfortunate habit continued into college where, once again, the draw of easy money resulted in me losing thousands of dollars over the course of 4 years. Fast forward to my early 20s and I had decided to purchase a “betting service”. The service was $20/month and it gave me access to daily NHL and MLB picks. The strategy used by the service was based on the martingale system whereby if a bettor loses they increase their next bet to cover their loses + win the original bet. Their implementation of the strategy was to bet favorites coming off a loss where they were a favorite. They called it “The Chase”. See below for an example of what a chase might look like

  1. Flyers lose game where they are favored to win at -200 odds.
  2. The next game time the Flyers are favored -190. I bet to win 1 Unit ($1 for this example). Flyers lose this game and I lose $1.90 (because the odds were -190 I had to bet $1.90 to win a dollar)
  3. The next time the flyers are favored -200. I bet $5.80 (I want to cover my $1.90 loss plus win the original $1)

The Pitfalls of Gambling

As you can imagine, this strategy can get out of hand quickly. The people that ran the service put some guardrails in place. I.E. you never chased after 5 consecutive losses because it puts too much of your bankroll at risk. They also provided guidance not to make your unit size more than 1% of your bankroll. Despite these warnings, there were constantly people losing more money than they could afford. More often than not the unfortunate reality behind gambling.

Per the wikipedia page on the Martingale system:
“The fundamental reason why all martingale-type betting systems fail is that no amount of information about the results of past bets can be used to predict the results of a future bet with accuracy better than chance. In mathematical terminology, this corresponds to the assumption that the win–loss outcomes of each bet are independent and identically distributed random variables, an assumption which is valid in many realistic situations”

Back in 2017 I was fortunate enough to ride a wave of luck. Between the gains I was making from the crypto boom and from the chase it felt like the money was pouring in. When I look back at the amount of BTC and ETH I made and spent I get sick to my stomach. That’s life though. We used a large portion of the earnings to fund home repairs and stopped betting on sports. My commitments became more significant and the risk of losing beyond my tolerance.

In the back of my mind, I knew that I was paying for a service that they had likely automated and that I could likely automate. However, because I was on my consultant grind at the time and perhaps because of a lack of comfortability in coding I never pursued it. Fast forward to 2024 and I’m looking for a project.

Ethical Dilemma

Before diving into the specifics of the project I do want to highlight the internal struggle I felt around this. I think gambling is the next epidemic we’ll be dealing with in the United States. You can’t watch a sport without hearing about line updates every other commercial. I’ve gone through my own struggles with gambling and know people who are addicted. The reality is that gambling has the power to ruin lives.

Where I ultimately landed on this was that I would automate the system as a side project with no intents of actually betting. I’d run the automated system for the remainder of the NHL season and the upcoming MLB season to see how it does.

The Project: Beating the Bookmaker

Over the past week I’ve been chatting with ChatGPT about the project. First,I worked with ChatGPT to flesh out the requirements. Then I used ChatGPT to help me build against those requirements. I also used ChatGPT to help me design the overall architecture which involves an AWS RDS Database, Python Scripts run via AWS Lambda, and The-Odds API.

I’m honestly blown away by the results. As I mentioned in my post about generative AI, ChatGPT has enabled rapid fire experimentation. I must have iterated through 10 different versions of my code before I ultimately got it functional. This project is still very much a work in progress. I’m curious to see how the script performs over time and if it adequately meets my requirements or will require further enhancements.

We’ll see how the automated system performs but honestly that wasn’t the point. The point was to give me something technical to sink my teeth into and to leverage AI to boost my productivity. Both of which I accomplished.

Here is a summary of the project generated from ChatGPT (Along with an Image Generated by DALL-E):

The NHL Betting Analysis Project is a data-driven endeavor aimed at analyzing National Hockey League (NHL) games to identify trends and opportunities for betting enthusiasts. Leveraging data from both game results and odds, the project employs Python scripts to fetch, store, and analyze information, offering valuable insights into team performance and betting strategies.

Key Objectives:

  1. Data Acquisition: Retrieve game results and odds data from external APIs.
  2. Data Storage: Store game results and odds data in a MySQL database for easy access and analysis.
  3. Analysis: Analyze game results and odds to identify favored teams and potential betting opportunities.
  4. Strategy Identification: Identify teams favored by -170 or more in their last game and lost, teams with consecutive losses of -170 or more, and teams that lost their first game at -170 or more.
  5. Decision Making: Remove teams from consideration if they won their last game as a favorite with odds of -170 or more.

Technical Details:

  • Data Retrieval: Python scripts fetch game results and odds data from external APIs using the Requests library.
  • Data Storage: MySQL database is used to store game results, odds data, and relevant analysis tables.
  • Data Analysis: Python scripts employ SQL queries to analyze game results and odds data, identifying favored teams and betting trends.
  • Decision Making: The project’s logic is implemented using Python functions, which filter and process data to make informed decisions on team selection for betting.

Conclusion: The NHL Betting Analysis Project offers a systematic approach to analyzing NHL games for betting purposes. By leveraging data analytics techniques and automation, the project provides valuable insights that can inform betting strategies and enhance decision-making processes for NHL enthusiasts and bettors.


Comments

One response to “Beat the Bookmaker”

  1. […] Beat the Bookmaker project using AWS, Python, and ChatGPT. […]

Leave a Reply