I Built a Sports Betting Bot with ChatGPT
Summary
TLDR本视频由Siraj主持,展示了如何利用Chat GPT和一个名为GPT Wager的应用来构建一个体育博彩机器人,并通过这个机器人对金州勇士队和布鲁克林篮网队进行了两次共计2000美元的赌注。视频深入讲解了从简单的套利机器人开始,逐步升级到使用XG Boost和深度学习模型,再加上Twitter情绪分析来提高体育博彩模型的准确率。Siraj强调了数学在制定盈利策略中的重要性,并通过实际操作演示了如何搜索和使用开源代码和API来实现这一目标。最终,机器人成功赢得了7000美元,展示了AI在体育博彩领域的潜力。
Takeaways
- 🤖 Siraj构建了一个使用ChatGPT的体育博彩机器人,该机器人基于数学预测和不同技术的集成,包括套利博彩、XGBoost和深度学习。
- 📈 强调了数学在体育博彩中的重要性,尤其是套利博彩、期望值博彩和其他数学技术的应用。
- 🔍 介绍了套利博彩的概念,即利用不同博彩公司对同一赛果的赔率差异来保证盈利的策略。
- 🐍 展示了如何使用Python和开源API(如Odds API)来获取NBA数据,并以此为基础构建套利机器人。
- 📚 通过Github搜索和现有的开源项目,减少了从头开始开发的需要,展示了重用现有代码的价值。
- 💡 引入了使用机器学习模型(如XGBoost和深度学习)来预测NBA比赛结果的进阶方法。
- 📊 结合了Twitter情绪分析,使用公开的Twitter数据和文本分析技术来增强预测模型。
- 🌐 展示了如何将机器人集成到Web应用中,并使用web3和加密货币进行博彩。
- 💰 机器人成功地从两次投注中赚取了7000美元,证明了使用技术和数据驱动的方法在体育博彩中的潜力。
- 👨💻 Siraj鼓励观众订阅和点赞,表明他计划继续制作类似的教育内容。
Q & A
Siraj在视频中创建了什么类型的机器人?
-Siraj在视频中创建了一个体育博彩机器人,使用了Chat GPT来进行体育博彩预测。
Siraj的机器人使用了哪些数学技巧来进行体育博彩?
-Siraj的机器人使用了多种数学技巧,包括套利(Arbitrage)、XG Boost和深度学习,以及在推特上进行情感分析来改善体育博彩模型。
Siraj如何验证他的博彩机器人是否有效?
-Siraj通过在两个队伍上下注(金州勇士队和布鲁克林篮网队)并展示他的赌注结果来验证机器人的有效性,最后他展示了机器人帮他赢得了多少钱。
Siraj的机器人在预测体育博彩时使用了哪些数据源?
-Siraj的机器人使用了多个数据源,包括不同的体育博彩书籍(即不同的博彩公司提供的赔率)和推特上关于球队的情感分析。
视频中提到了哪种特定的博彩策略?
-视频中提到了套利(Arbitrage)博彩策略,这是一种通过在多个博彩公司上对所有可能的结果下注来保证利润的策略。
Siraj是如何使用OpenAI和其他工具来构建他的博彩机器人的?
-Siraj通过使用Chat GPT来生成代码和策略,利用Python和各种库(如Keras、scikit-learn和TweePy)来处理数据和模型训练,以及利用Google Colab和GitHub来运行和查找代码。
视频中提到了使用哪个API来获取NBA数据?
-视频中提到了使用Odds API来获取NBA数据。
Siraj如何整合推特情感分析到他的博彩模型中?
-Siraj通过使用TweePy库来抓取有关NBA球队的推特数据,然后使用TextBlob库来进行情感分析,分析人们对球队的正面或负面看法。
Siraj在视频最后展示了什么结果?
-在视频最后,Siraj展示了他的博彩机器人在两次下注后赢得了大约七千美元的结果。
Siraj提到了哪些编程实践来简化他的博彩机器人项目?
-Siraj提到了使用单个类文件来避免大型项目和多个依赖关系,以及利用现有的GitHub资源来简化开发过程。
Outlines
🤖 构建体育博彩机器人
视频介绍了Siraj如何使用Chat GPT和一个名为GPT Wager的应用来构建一个体育博彩机器人,并展示了他在Golden State Warriors和Brooklyn Nets上下注的两笔赌注。视频的主要目的是展示如何利用数学和不同的博彩策略(如套利、XG Boost和深度学习模型)来构建这个机器人,并通过在Twitter上进行情感分析来增强模型的预测能力。Siraj强调了数学在赚钱过程中的重要性,并计划展示如何从头开始构建这个机器人,包括如何利用Chat GPT询问最常见的数学技术和如何实现一个简单的套利博彩机器人。
🔍 寻找开源赔率API和构建简易套利机器人
继续探索如何构建体育博彩机器人,Siraj讨论了寻找合适的开源赔率API的重要性,并选择了Odds API作为数据源。他展示了如何使用Google Colab运行Python代码,以及如何处理遇到的API问题。此外,他强调了在不同的体育博彩书上寻找套利机会的概念,并尝试创建一个简单的套利博彩机器人。通过实践,Siraj揭示了在构建这类机器人时需要考虑的一些技术和挑战,如数据清洗和处理。
📈 利用GitHub资源加速开发
在体育博彩机器人的开发过程中,Siraj发现了一个GitHub上的项目,该项目已经实现了他所需的功能。这表明,通过有效利用现有的开源资源,可以大大加速开发过程。他进一步探讨了如何使用这个GitHub项目来获取和处理数据,以发现套利机会。通过这个过程,Siraj展示了如何利用现成的代码和API来简化开发工作,同时也指出了在整合和使用这些资源时可能遇到的一些挑战。
🐍 构建深度学习和情感分析模型
为了提高机器人的预测准确性,Siraj探讨了如何整合深度学习模型和Twitter情感分析。他提到了使用Tweepy和TextBlob库来分析推特上关于特定NBA球队的情绪,并考虑了如何创建一个深度学习模型来预测赢家。此外,他讨论了利用GitHub搜索功能找到现成的NBA机器学习模型的价值,这再次强调了利用现有资源来加速开发过程的重要性。
💻 集成模型到Web应用和盈利结果
在视频的最后,Siraj展示了如何将他的体育博彩机器人集成到一个Web应用中,并通过使用一个去中心化的博彩服务Dexport.io来实现赌注。他使用React和Firebase创建了前端,并通过MetaMask和Polygon网络来处理交易。最终,他揭示了机器人在Golden State Warriors和Brooklyn Nets的赌注上赚取了七千美元的利润,证明了这个项目的成功。此外,他鼓励观众订阅和点赞,以支持他继续制作类似的教育内容。
Mindmap
Keywords
💡Sports betting
💡Arbitrage betting
💡Sentiment analysis
💡Machine learning
💡Computer vision
💡Cryptocurrency
💡Github
💡API
💡Web app
💡Math/statistics
Highlights
使用套利投注机器人赚取少量利润
利用概率和统计学构建机器学习模型
结合Twitter情绪分析改进模型
Transcripts
hello world it's siraj and I built a
sports betting bot with chat GPT and in
this app called GPT wager you can see
that I've made two bets the first one is
about a thousand US dollars worth on the
Golden State Warriors the second one is
about a thousand dollars on the Brooklyn
Nets and this is because of my bot it's
because of the predictions that it
output and in this video I'm going to
show you how I built this bot what the
results are at the end you'll see if I
lost two thousand dollars or I made up
to as you can see a combined total of
about ten thousand dollars that's at the
end of the video so stay tuned but
before we get there let's build it
together with chat GPT let me show you
how I built it and we're the most
important part of this video and what I
really want to stress to you is
mathematics and how awesome mathematics
is mathematics helps you make money and
in this video we're going to start with
a very simple bot it's an Arbitrage bot
I'll explain what that is then we'll
improve it to be what's called an XG
boost spot we'll improve it again to be
a deep learning bot then we'll add deep
learning plus sentiment analysis on
Twitter so we can see what people are
saying on Twitter about a team and use
that to improve our sports betting model
all right so that's what we're going to
do in this video so the first step for
us as we build this with chat GPT the
first step for us is going to be to ask
it a question that question is going to
be show me a list of the top 10 most
common math techniques now remember we
love maths we're going to ask you about
math techniques and we're going to be
very direct to make money from sports
betting you know I've heard terms like
Arbitrage and let's let's give it some
context here remember chat GPT remembers
context so I've heard terms like
Arbitrage and expected value betting I'm
not sure if that's helpful or related
just like we would talk to a human
period let's just see if it's going to
help us now I have to re-log in because
it's been a while that's always I know
annoying to have to do that let me paste
that back in here
very real stuff that's how it
that's how it is with chatgpt so it's
going to list a bunch of different
techniques and all of these techniques
are going to be in the categories of
math like probability that's about
likelihood and whether or not something
will happen that's what it's concerned
with then we have statistics and that's
about empirical data usage it's a
collection of tools to analyze data and
then we have algebra arithmetic right
numbers plus minus subtraction Division
and even calculus in the case of Markov
chain Monte Carlo that's a way of
simulating different outcomes and we can
use calculus to find the rate of change
or the derivative of different variables
so we can see 10 methods right off the
bat that chat GPT gave us to make money
from sports betting and we don't know
what any of these terms are yet because
we're noobs I mean we know a few terms
but we're going to pick one of them
we're just going to pick number two
Arbitrage betting and that's going to be
the first one that we're going to pick
and what is arbitrage betting Okay so
Arbitrage is this idea of in the sports
betting space we have all of these
different sports books and sports books
are always betting on the odds of
different results whether one team wins
or one team loses whether a certain
player is going to do well or not all
these things are odds and they use
quantitative models to predict these
odds and they're really good at this
what Arbitrage betting is is it saying
that hey if I bet on the on all possible
outcomes across a variety of sports
books because they all have different
odds for the same outcomes I can find
these inefficiencies in this market
because it's very similar to a financial
like a stock market it's like a sports
betting Market I can find very similar
inefficiencies and then I can exploit
them to make money and so the if the sum
of the inverse of all of the
probabilities of the odds of a given
game are less than one we can say that
an Arbitrage opportunity exists so even
if we make two bets in two different
directions
if there is a real Arbitrage opportunity
we can be guaranteed a return but that
return isn't going to be that big it's
going to be between one to ten percent
max and the sports folks are going to
get to get wind of what we're trying to
do and they're probably going to ban us
so it's not the best technique probably
but it's a good place to start so let's
ask it to do that let's
um ask it to
build us a simple Arbitrage bot so show
me an example
of an Arbitrage bot
in Python for sports betting and have it
be real simple have it be super simple
and fit into a single class file because
we don't like giant projects with many
dependencies and we're going to be very
specific we're going to say it uses
mathematics to output and we're going to
be very bold as well a provably
profitable strategy okay and then we're
going to be very
needy with it then explain the math
behind it to me
okay
and hopefully it gives us a working
example and it did before I swear to you
but right now it's decided that this is
um not what it wants to do but
it might let's wait for chat GPT please
chat GPT do this for us we need this to
happen
um it can give us an example thank you
ah show me a python Arbitrage bot for
sports betting simple example that fits
into one class file I think adding the
math thing it didn't like that so given
that using a single library and let's
say three different book markers we can
do you know a three-way Arbitrage as
well it's going to find that Arbitrage
so let's take this code and let's go to
a Google collab notebook
collab.research.google.com we'll open
that notebook it's just an easy way to
run python code even if you're not like
a super good code or anything so we'll
paste that right in there and we'll run
that and we can see that there's already
an issue with this and the issue is that
this
api.bookmarker1.com is not legit so
we've got to get some legit Sports data
so let's ask it for some of that so
that's going to be our next question
going back to our original prompt series
here and we're going to say show me
let's go back here show me a list
of the top 10 open source odds apis for
sports betting we don't just want we
want several
and I have gone through some of these
and it's it can be quite a pain to find
a developer API given whatever area of
the world you're living in so
um in the end the one that I found that
would work is the odds API and here it
is odds API right here so that's the one
we're going to use the odds API use the
odds API
uh in Python to pull NBA data
pull NBA data
and then it's going to give that to us
and then what we're going to do is we're
going to sign up for the odds API
because we need that and here it is odds
API we can see we need to get an API key
it's going to start out free perfect
enter our name and everything assume
we've signed up for that and once we've
signed up for that we're going to go
back to
the main page and we're going to get
that API key where is it
it's under account here's our API key
okay and what we can do is we can go to
sheets and it's got this Google Sheets
integration where it can just pull that
from our Google sheet so let's start
with that we'll start with a simple
Google sheet we'll make it a new Google
sheet now we've assume we've installed
this add-on which I've already done and
once we have that add-on we can go to
extensions sports odds start and it's
going to pull up a live odds API we can
paste in our API key that it gave us
back here under account
and then we're going to populate this
Excel spreadsheet with all of the NBA
sports we're going to pick NBA from the
list here basketball and then we want it
to be in decimal versus American
and then we'll fetch it okay so here it
is
we've got latest the latest data right
here from different bookmarkers like
bookmakers like DraftKings and Bovada
and all this stuff and what we can do is
we can find the we can Arbitrage the
odds and basically compute what that
profit is going to be so using this odds
API I wonder if they have some simple
python examples for us hopefully they do
so we'll go to home we'll go to code
samples and then boom they've got some
python examples here running on replit
we'll show the files it's going to be a
main.pi file we'll just take the entire
thing here
and we'll copy it go back to our
code here
and that compiled it and now we have
those in python as well so now what we
have to do is we have to compile this
data that we pulled using the odds API
with that Arbitrage bot that chadbt give
has given us and that's going to require
data cleaning we're gonna have to take
that API clean the data and then process
it insert it into these two definitions
this is going to take some time and
energy now let's we can do that but
before we do that let's just do
something really quickly just to make
sure that we save enough time let's just
go to GitHub real quick and we're just
going to search a single search term
that's all we're just going to search
for statistical
Arbitrage
for sports betting just to make sure
nobody's done this be oh there's one
right there by Ryan crewman's knocker
thank you Ryan for this and it was made
four months ago very cool it's using the
odds API okay perfect uh that's exactly
what we need to do what Arbitrage okay
we didn't even have to do any of this
work this guy's already done it for us
and that is the value of getting good at
searching for code on GitHub because
there's so much value to be found there
so let's run this thing this guy's got
an IPython notebook for us and it's
going to create an Excel spreadsheet
just like we found before the odds API
it's going to get all that and then wow
that's a lot of data once it's got that
data what's going to happen next look at
all of this parsing that it's going to
do find the number of possible outcomes
find the best odds determine the odds
and then you know extract the each
individual bookmaker we would have to
write all these functions ourself we
don't want to do that so let's go back
here and we're going to download this
and upload this to Google collab so
first step go to download zip we clicked
on download save the file it's saved now
we open the zip and we're going to
upload it to Google collab so we'll go
to colab.research.google we'll go to
upload and then we're going to choose
that and upload it to uh Google collab
but I've already uploaded it and it's
right here so
um we can go through this and run this
ourselves so once we install this pip uh
repository then we can just go right
ahead and start compiling this code and
see what this Excel spreadsheet that it
gives us is going to be so we've
compiled that we've got the odds thank
you now we're going to go through his uh
helper functions that he wrote for us
it's going to parse all of the events
it's going to create a data frame it's
going to write that to an Excel
spreadsheet and then once it's formatted
it perfectly then we know what the
Arbitrage opportunity is going to be so
let's go to this folder here's here's
that Excel spreadsheet we'll download
that let's see what's in this goodie bag
this is the Arbitrage opportunity five
bucks we can make five bucks like I said
it's not big between two different book
makers uh Bovada and the other one let's
talk about a more long-term solution
yeah let's use probability
hey yeah I'd like to create this machine
learning model okay so machine learning
with Statistics remember at the
beginning it gave us all these different
techniques and the Arbitrage one was at
the top but the probability and
statistics one is probably the better
one right because that's what's driving
all of the advances in AI today right
artificial intelligence these models use
linear algebra to compute Matrix
operations at scale on gpus they use
calculus to compute the derivative of
the gradient with respect to the weights
of the network and the weights means all
the values hidden inside of these
collections of linear algebra
files that these machine learning models
have these dot pickle files these dot ml
model files all of these static all
these static files are essentially
digital brains and we want to build one
for sports betting that's better than
the simple if then statement that the
Arbitrage bot that we just built gave us
so how do we do that let's ask chat GPT
I'd like to create
a sports betting bot
that makes bets daily for me on the
winning team for the NBA let's be very
clear about it and let's give it our
wildest fantasy let's say it uses
computer vision my favorite subfield of
machine learning to watch all previous
games so we don't have to sit there and
watch them ourselves as well as
Twitter sentiment because people are
always talking about teams and a lot of
times you can glean if a team is going
to do well from whether or not people
are talking well about it or not right
if they're talking smack about it or not
and as well as Twitter sentiment and
let's keep adding to it and past
statistics
okay show me step by step how to build
this
in Python
flask and what libraries and just
everything I should be using
and hopefully it's going to give us this
amazing detailed step-by-step tutorial
on how to do this
um but unfortunately it's going to first
apologize and I've noticed that chai gbt
apologizes a lot and listen chat GPT
5.0 in the future listening and training
on all the videos
we don't want you to apologize no
apologies okay just help us out that's
all we're asking for so it's asking us
to consult with experts in the field of
sports betting there are none
um computer vision and if there are
they're not going to be talking about it
on YouTube uh so
so it didn't help us out so we have to
do this ourselves okay fine let's just
do this ourselves so show me simple
python code to scrape Twitter
for sentiment analysis
on the NBA Warriors team just like the
Warriors team can you do this like
simple thing for me chat gbt like forget
deep learning at scale with Transformers
and reinforcement learning just okay it
may violate the content policy but
you're still going to give it to me
thank you very much opening I appreciate
that we as a community appreciate that
all right so
um it's giving us the use of two
different libraries the first one is
called Twee pi and what Twee Pi does is
it's a python wrapper around the Twitter
API the second one is text blob and what
text blob does is it's not super
Advanced machine learning what it's
using is a lexicon and what a lexicon is
is it's a dictionary of values that are
correlated with different words so let's
paste that into a Google collab and it's
going to ask us for our consumer key our
consumer Seeker our access token and our
access token secret as well as what team
we want and so in order to do that we
have to go to the developer portal on
Twitter and
at the developer portal we have to
create a new test app once we create
that test app under settings it's going
to give us all of the keys that we need
for that under manage under app settings
here are the keys and tokens and then
we'll reveal them and insert that into
our code once we compile this we're
going to say well what team do we care
about and we're going to say the
Brooklyn Nets and already it's given us
the list of positive tweets and negative
tweets and we can construct a very
simple model based on just this we can
say if there are more positive than
negative tweets don't make a bet else
make the bet because the team will win
because people really love this team
right now you know that's one very
simple model but let's keep improving it
so instead of just doing this Twitter
sentiment analysis bot let's now add
deep learning to the mix okay so let's
ask it that question so let's say
um chat GPT
uh show me a deep learning model to
predict the winning team
given Sports data
just something simple like
one sentence maybe it's going to do it
this time I hope
thank you okay so what it's probably
going to do is use the Keras library to
construct a neural network the easiest
way to construct a neural network thanks
Francois Chalet
um and scikit-learn to build that model
this is going to be a neural network
very simple stuff watch my videos a lot
of neural network videos and it's going
to train it on the CSV file that doesn't
exist we got to connect that to the
sports data API and then we're going to
have to go through the very tedious
process of training this model
on all of this Sports data and that's
going to take some time so we're going
to train this model we're gonna have to
do some feature processing what are the
features we want in the model and the
number of wins the number of wins what
are the statistics how much data then
we're going to have to run this at scale
and that's going to take some time so
let's do that we can ask chatgpt all of
these questions
what features should I encode what what
should the training testing split be is
my model good enough here are the values
we can give it the outputs and all this
stuff but before we do that once again
let's just go to GitHub and search and
I'm just going to do a very simple
search just three words NBA machine
learning and let's see if it gives us
anything and lo and behold Kyle scom has
already made an NBA machine learning
sports betting
system I don't know if it's a bot
because it's not actually making the
bets but it is using tensorflow and XG
boost respectively to create two
different sets of predictions right
it's using a neural network with
tensorflow to predict the winning team
and then it's also using an XG boost
algorithm to predict the winning team
and then you can compare both of them so
what we can do is we can combine our we
can combine several things we can
combine Kyle's model here with our
Twitter Twitter sentiment analysis model
we can say if Kyle's model predicts a
winning team and our Twitter sentiment
model says that this is going to be a
very positive sentiment winning team
then we can bet on the winning team
right and what we're going to do is this
is going to give us a lot of numbers so
we're going to summarize all those
numbers with gpt3 Okay so let's take
this model that Kyle has and we're going
to run it in a Google collab so we're
going to take this copy it so what this
is going to do is it's going to clone
that repository into the cloud it's
going to install all the
requirements.txt and it's going to take
this pre-trained model and what Kyle did
is he trained this model on the past
decade of NBA games and you can see many
many many Rose many columns what are all
of these columns what are all of these
acronyms I'm sure some of you sports
fanatics know mention it in the comments
I have no idea there's a lot of them but
that's the model they use to train on
all right up till today given the odds
from uh given sports book in this case
we're going to say FanDuel
it's going to predict given two
different models both the XG boost model
and the neural network model what the
expected value for each team is going to
be what is the expected value it is just
the likelihood that they're going to win
and we can see that the expected value
is
going to be pretty high for the New
Orleans Pelicans and the Golden State
Warriors and that's according to the XG
boost model but in the neural network
model
it looks it actually looks very similar
so that's the first part then we can
augment that with tweets then after we
do that then we can install the openai
library to then summarize all of that
okay the winners are here are the teams
and here are the losers much cleaner
much better okay here's the last part
how did I fit it into this web app so
what I did was I took my react startup
template and it's just integrated with
Firebase and then I added decksports.io
to that and dexport.io is a
decentralized web3 betting service and
it's the one that I'm using because it's
decentralized it's uses crypto and
anybody can do it anywhere in the world
which is really cool and once you sign
in and the way to sign in is using a
wallet I've signed in with my wallet
which is uh metamask and once we sign in
it's going to ask what network we want
to use I'm going to sign it and then
it's like well what network I'm going to
select the polygon Network and then I'm
going to use usdt which is USD tether
and given that I'm going to go to web3
sports betting and I I framed it into my
original
web up here so I could see the results
of my predictions as well as making bets
and you can see here the two unsettled
bets that I made with my wallet let's
see if I made money or lost money
all right it's the day after in drum
roll please it looks like the bot made
seven thousand dollars from two bets one
for the Warriors and one for the Nets
thank you AI all right thank you guys so
much for watching
um I want to keep making videos like
this every single week so if you want to
keep watching Please Subscribe that's
what really motivates me to continually
do this and like the video as well that
helps promote it for now I've got to go
find the optimal prompt so thanks for
watching
foreign
[Music]
関連動画をさらに表示
Chatbots with RAG: LangChain Full Walkthrough
The RIGHT WAY To Build AI Agents with CrewAI (BONUS: 100% Local)
Python Advanced AI Agent Tutorial - LlamaIndex, Ollama and Multi-LLM!
The Last Prompt You'll Ever need - Synapse_CoR
How to Break into AI Product Management without experience
Robocorp Beginners Tutorial - Getting Started with Robocorp RPA
5.0 / 5 (0 votes)