How I Beat The Bookmakers With JavaScript

Jacob Naryan - Full-Stack Developer

Posted: Sat Feb 17 2024

Last updated: Tue Feb 20 2024

The Idea

You may be thinking my title is complete BS, but it’s not. I am going to show you exactly how I started earning risk-free money from my sports betting accounts using just JavaScript and free resources.

This all started when I read a book called The Ten Equations That Rule The World. In the book, I discovered that all of the world's sports betting markets are run by simple math. When you learn these equations you can find opportunities where it’s possible to bet on both outcomes of an event and always win no matter the outcome!

This strategy is called arbitrage betting, and it is mathematically risk-free.

To better explain let me give you an example of an arbitrage bet my software found. On January 27th there was a boxing match between Jose Perez and Omar Trinidad. Omar Trinidad was the favorite to win (-245) against Perez (+280). My software first calculated the implied probability of the odds and found out there was an arbitrage opportunity. It then calculated the exact bet amount I needed to place on each outcome to ensure that I always win no matter who wins. In the end, I put $52.60 to win $199.98 on Perez and $141.80 to win $199.68 on Trinidad. As you can I had bet a total of $194.40 and was going to win $199.68 or $199.88 no matter who won! That is an easy $5.15 or 2.7% guaranteed return risk-free!

The Code

Once I realized that this was real I got to work coding!

First I needed a reliable source of live odds data from multiple sources. I ended up using a popular live odds API so I didn’t have to scrape the odds myself. This API also came with a free tier that gave me a certain number of requests a month completely free!

First I built a prototype in Python. It simply compared all the odds between the sportsbooks and printed out all the arbitrage opportunities it found. This was great but odds update quickly and I needed a more user-friendly way to view and quickly place the arbitrage bets before they evaporated.

This is where the JavaScript comes in! I chose Angular for my framework, Netlify as the web host, and an SQL database as my database solution (only because I had one freely available for my use). This allowed me to create a simple UI with Angular, and host an entire automated serverless API with Netlify functions. The best part again is that all of this is completely free.

The API was essentially my Python bot split into individual functions I could call to pull odds and find arbitrage opportunities. Netlif also allows you to schedule these functions at whatever interval you'd like.

Once I was finished with the full automated API that found bets for me, I started building the user interface. The user interface simply and clearly showed what bets it found, what team, and what type of bet to bet on, and then gave me the link to the sportsbook page where I could place the bet. Simple but highly effective.

Improvements

After using my software for about a week I became overwhelmed trying to keep track of all the bets I had placed and how much money I had earned, so I made a bet tracker!

With the bet tracker you can mark your bets and every night my software automatically figures out who won and updates your winnings accordingly.

This was a game-changer for me because I was quickly feeling like I didn’t know where my money was going. I was using 7 sportsbook accounts and placing 5 to 10 bets a day.

Further Improvements

I didn’t stop there though. After using the sportsbooks I realized they offered daily profit boosts and odds boosts to encourage you to bet more.

A light bulb went off in my head and I realized I could use the profit boosts to create arbitrage opportunities that weren’t normally there! This would exponentially increase the amount of bets I was finding!

Once I made this change I realized I had made something that could make people a lot of money! So I decided to build a subscription service around it.

More JavaScript

Since I wanted to open this up to other people I now needed a way to manage user accounts and payments.

I chose GoTrue.js for my authentication. GoTrue.js is a JavaScript library that allows you to manage user authentication easily. It allowed me to easily create user log-in and sign-up forms and even secure my API endpoints from unwanted users.

For payments, I went with Stripe Pricing tables which allowed me to set up a fully functional checkout with promo codes, free trials, and multiple payment types accepted with almost no code at all.

And with that, I was ready to launch!

If you want to try out what I created go to betsleuth.com!

Thanks for reading, please consider tipping some BTC if you liked the blog!
Click or scan the QR code below.

bitcoin address for tips if you are so inclined.

Need a developer?

Hire me for all your Angular needs.