How easy is it to make a profitable sports gambling bot in a month?

I think every male on the planet wants to find a get-rich-quick scheme betting on sports. 99% of the time, betting is just a fun thing to do when watching sports to make the game mean more.

1% of the time, however, someone figures out some consistent formula that beats the sportsbooks and makes legitimate profits. Usually, this comes after years of tweaking your model and backtesting to devise a model that out-performs Vegas just 52% of the time.

I didn't want to wait that long.

I wanted to make a profitable sports gambling model in a month.


To clarify, however, I didn't think I would actually make a profitable model. I didn't pretend to think I had some magic idea that no one else did. I just thought I would give myself a month to give it a shot and see what the process would be like. I think sports betting is fun and I like to program, why wouldn't I combine my interests to try to make money?

The original project idea in my head was to use Python to make an NBA model that predicts the score based on team statistics + pace metrics. My personal "twist" was to somehow quantify each team's schedule (back-to-backs, 3 games in 4 nights, on a road trip, etc) along with injuries for more accurate predictions. I know this isn't actually breaking ground, but this was just my original idea.

From there, I was planning to give away the picks for free by integrating with Twitter's API to tweet the best bets each day.

At the end, as a stretch goal, I would save all the picks and each result to a CSV file to hopefully create a machine learning model by next season.


original gambling diagram

So, I started off the process strictly doing research. I wanted to see what free resources were available that would get me all the stats I need, and also the best way to programmatically pull odds and lines from different books and even make the bets.

I found a few interesting articles, like this, but didn't find anything that helped me collect the data. That is, until I found the NBA stats holy grail: nba api.

NBA API is a Python wrapper for the free NBA.com API. This Python wrapper came with documentation on all 97+ distinct endpoints that NBA.com supports. The image below is just a snapshot of some of the documented endpoints.


nba api endpoints

For the purposes of this model, I was planning on using one endpoint listed here and one that wasn't. The plan was to use TeamGameLog to find the schedule and recent game locations for each team playing each day, and then additionally use TeamEstimatedMetrics to get the team's pace and scoring efficiency metrics to predict the score.

However, before I got deep into this idea, one of my friends recommended a better idea.

He was up 23 units halfway through the month betting MLB strikeout props.


I still felt like I had time to pivot to a different model if it was a relatively easy algorithm, and I can't argue with results; being up 23 units in 2 weeks is otherworldly.

Digging deeper, I found out that this "model" was remarkably simple.


final gambling diagram

  • Outlined in the picture above, I scrape fantasypros & numberfire using Selenium Webdriver, which is a Python library that controls a browser. The two sites offered daily strikeout projections for each pitcher on the day.
  • After creating a table full of all the pitchers and their projections from both sites, I scrape oddsboom to pull each game and all the strikeout odds from every major sportsbook in an easy, consistent format.

oddsboom props

At this point, all the data is there. For each pitcher, I calculate all the sportsbooks projections and their odds, and then create a confidence interval based on the combination of the odds (-150) and the projections (5.5 strikeouts). Developing these confidence intervals proved challenging because I had to find a programmatic way of determining if it is better to bet on a confident prediction with bad odds or a weak prediction with profitable odds. This is what I came up with.


confidence interval code

Now I don't come from any sort of statistics background, so I created one projections number based on the average of the projections from the two sites and the closest projection to the sportsbook's strikeout number. Then I averaged those two numbers together and subtracted it from the sportsbook's strikeout number to create a confidence interval with just the strikeout predictions without the odds.

I then converted the odds to decimals and finally multiplied the odds number and the strikeout confidence interval for one concrete number. This happens to work successfully as both the confidence interval and the gambling units.

And that's the model. Now, the two outputs were also similarly easy.

Outputting tables to CSV files is so core to Python I won't go into the details of it. Integrating with the Twitter API, alternatively, was a breeze. I created an account, navigated to my developer dashboard, created an app and filled out a few questions, and soon enough I had access to my Twitter API keys.

Using Tweepy as a Python wrapper for the API, I was able to easily set up the account and send tweets.

Make sure to follow @StrikeoutProps if you want to see the daily LOCKS in action!


twitter account

The predictions started going live on April 23rd, and the results... are a little bit better than average

Since, the model is up 4.7 units and 13-10 overall in record. Even though we are "up" 4.7 units, I'm not sure how profitable it really is because often times the bets are made on minus odds (like -150), and I haven't had time to calculate the overall money gain. Even so, the model can definitely be improved in a few ways.

  • The projections generally love going under on elite pitcher strikeout numbers. Guys like Jacob deGrom and Trevor Bauer are having historic seasons and are routinely going over their strikeout predictions.
  • The confidence intervals typically prefer "safer" projections with "worse" odds. Essentially, betting Gerritt Cole over 6.5 strikeouts @ -150 if his projections are ~7.5 strikeouts is considered to be preferred over betting Cole at over 6.5 strikeouts @ +150 if his projections are ~6.7 strikeouts. If you look at each pitching prop as roughly a 50/50, you would always be better served taking the side with the better odds. I don't think the model reflects that enough.

The core tenant of these projects to me, however, is to see how much I can learn and complete in a certain period of time. I wanted to see if I could come up with a sports gambling model that makes money in a month, and I think that I can. I'm not sure how profitable it truly is, but it's something. More than likely I am getting lucky for a period of time, but realistically it's impossible to find a million dollar formula in a month.

I'm happy enough I got to learn about sports gambling and grow my skills.


I had a few stretch goals I wanted to complete but didn't have the time. Along with making the improvements to the model, I wanted to try hosting with AWS, programmatically get the results of the previous game results instead of manually, and maybe even make the picks myself on FanDuel before tweeting them.

But I didn't get to them, and that's fine. I still have a working strikeout prediction model that gives out picks for free.

And I think that's pretty cool.


Now it's time to make some money.