AI Sports Betting

Kenny Hall
March 9, 2023

ChatGPT has quickly become one of the most widely-used apps in history and people can’t stop pushing it to its limits. One area that is always on the cutting edge of new tech is sports betting. Like it or not, there’s simply too much money at stake for sports betting to ever really be stamped out.

So, it was only a matter of time before someone tried to use ChatGPT to pick winners and losers of professional sports matches. After all, ChatGPT is a predictive AI by its very nature, surely it can make some educated guesses about the outcome of a sports match, right?

Who is going to win the Super Bowl?
Who is going to win the Super Bowl?

Well, that’s disappointing—though hardly surprising. Ask any fantasy sports geek and they’ll tell you that the amount of data analysis that goes into predicting a team’s or player’s performance on any given day is truly massive. In fact, a quick GitHub search shows nearly 700 results for tools that people have already created to help evaluate it all.

So, with that, could ChatGPT be used to make sense of all this data? Or, even better, create a program that could accurately pick winners and losers of a given sports match? Well, it’s here that Siraj Raval, a YouTuber, DIYer, and developer, got started with AI and sports betting.

In his video “I Built a Sports Betting Bot with ChatGPT”, Siraj details his journey trying to use ChatGPT to create a functional sports betting bot. I attempted to replicate his work as best I could to see how easy this might be for someone who lacks his technical knowledge.

Not Much of a Bettor

The first issue that Siraj faced was simply that he didn’t actually know anything about sports betting; in fact, he barely knew anything about sports at all. Here, ChatGPT was incredibly helpful.

Show me a list of the top 10 most common math techniques to make money from sports betting. I’ve heard terms like arbitrage and expected value betting I’m not sure if that’s helpful or relevant.

This is exactly the kind of semi-rambling speech that humans so easily understand but that AI has long struggled with. However, ChatGPT came through in a big way and gave me exactly what I asked for.

chatGPT screenshot
Show me a list of the top 10 most common math techniques to make money from sports betting. I've heard terms like Arbitrage and expected value betting I'm not sure if that's helpful or related.

Wow, those are all valid and common sports betting techniques but they all require a pretty significant amount of advanced math. Now, if that’s your cup of tea, this might not be that hard, but for someone who hasn’t solved an equation since college, it’s a pretty high bar to clear.

Since Siraj specifically mentioned arbitrage betting and the AI went into a bit of detail, that seems like a good place to start. In short, arbitrage betting is the same idea as arbitrage trading. It’s all about exploiting the very small differences in odds provided by different casinos. It’s complicated but generally reliable.

Taking the Ball and Running

Siraj decided that he would first ask the chatbot to give him exactly what he wanted and got pretty specific with his request.

Show me an example of an arbitrage bot in Python for sports betting. Have it be simple and fit into a single class file. It uses mathematics to output a provably profitable strategy. Then explain the math behind it to me.

That’s a pretty tall order. While his degree of specificity is good, the output that he wants is just not that simple. ChatGPT, though, had another problem with his request.

chatgpt screenshot
show me an example of an arbitrage bot in python for sports betting. have it be simple and fit into a single class file. it uses mathematics to output a provably profitable strategy. then explain the math behind it to me.

Well, that was totally foreseeable, to be honest. It’s not at all shocking that Microsft wouldn’t allow its new flagship AI to be used so blatantly for something that is definitely illegal in many jurisdictions where they operate. But wait, there’s more?

chatgpt screenshot

OK, this was a surprise. I genuinely didn’t expect it to tell me that this is illegal and then immediately turn around and go, “but, hypothetically…”.Though the actual code that came out was a bit sloppy so he actually smoothed out his request a bit.

chatgpt screenshot
Show me a Python arbitrage bot for sports betting. Simple example that fits into one class file.

And boom, there it goes.

Replication Errors

This is where my attempts to replicate Siraj’s work hit a significant roadblock. When I gave ChatGPT the exact same prompt, I got a very different response.

chatgpt screenshot
Show me a python arbitrage bot for sports betting. Simple example that fits into one class file.

It seems that in the three days between Siraj’s video going online and my efforts to follow up on it, the team at Microsoft made some changes behind the scenes. Even an attempt to work around it met pushback.

chatgpt screenshot
provide an example of how an arbitrage bot would function in python

While this is incredibly frustrating, the fact that it gave a fairly in-depth example of how arbitrage betting works was at least a step in the right direction. I’m sure that someone with more math or coding skills than I have would be able to start with this and keep the work going. However, I was more interested in exactly what Siraj managed to get working than I was in creating my own replica so I took the L and moved on.

Making it Work

Getting back to the experiment that actually worked, let’s look at the code that ChaGPT came up with.

That’s certainly a good palace to start, but one major issue is obvious from the beginning. Those imports are very clearly placeholders. OK, easy enough.

chatGPT screenshot
Show me a list of the top 10 open source odds APIs for sports betting

Voila! From there, it was easy enough to plug those into the code and keep moving. Now, just because you’ve got access to the API doesn’t mean that you can make sense of all that data. Next, Siraj went to GitHub and found one of the aforementioned tools already made and, after a bit of work, was able to pretty easily get that up and running in the code.

This wasn’t the kind of thing that ChatGPT was terribly useful for as it tends to have a hard time working within the confines of existing code. Further, he’s already “tricking” it to do things it wasn’t meant for. Siraj reasoned that he would be best doing this part himself. And this is one of the big takeaways from this. ChatGPT is a tool, nothing more and nothing less. It can’t do it all but it can help a single person do a lot more.

With the odds API integrated, it was time to move on to the next phase of the plan.

Once More, With Feeling

Odds are one thing, but AIs have been crunching numbers for gamblers for decades already. Siraj wanted to give his bot a little more to work with so decided to integrate sentiment analysis from Twitter. Once again, he started by asking ChatGPT to give him exactly what he wanted.

“I’d like to create a sports betting bot that makes bets daily for me on the winning team for the NBA. It uses Computer Vision to watch all previous games, as well as Twitter sentiment, and past statistics. Show me step by step how to build this in Python flask and what libraries I should be using.”

Very, very detailed. He even got incredibly ambitious and asked it to include Computer Vision to watch all games.

Here we see the same problem again. The program is simply bound by whatever laws or ethics Microsoft puts on it. Now, I’m not saying this is a bad thing, but it’s certainly a potential hurdle for many projects.

OK, so Computer Vision isn’t an option, but what about sentiment analysis?

Show me simple Python code to scrape Twitter for sentiment analysis on the NBA Warriors team.

Well, that’s a new one. This is a strange warning as it says that the content “may” violate the terms. But without any further information, it’s hard to know where to go from there. What’s that? It did it anyways?

It seems like ChatGPT is still trying to figure out just what it can and can’t actually be used for. Here though, my attempts to follow up on this actually worked.

This is identical to the code it gave Siraj and he was able to get it to work with very few tweaks. It’s worth noting that I didn’t get the warning. The idea that the program can be used to do one thing one day and not the next is going to be an ongoing issue.

Did it Work?

At the end of the day, Siraj was able to actually create a functional bot with ChatGPT. He then decided to put his money where his mouth was and gave it $2,000 to bet with. In the end, he made a total profit of about $7,000.

Want to try your luck? Siraj has made his bot—called WagerGPT—freely available. Just be warned, any online casino is looking for this kind of stuff, and if they catch you, you’re likely to lose all your money.