Skip to main content

Command Palette

Search for a command to run...

Building a Real-Time Betting Odds Monitor with Arbitrage Detection

Have you ever wondered how betting odds work and if it’s possible to make a bet on both sides and always win?

Updated
4 min read
Building a Real-Time Betting Odds Monitor with Arbitrage Detection
S

CSE Grad (AI & ML), MSRIT ’25 | Love building practical tech, contributing to open-source, and sharing my learnings. Always exploring new ideas to make tech more useful.

I recently built PariScrapper : a real-time betting odds monitor, basic arbitrage detection, and a Streamlit dashboard for live visualisation of odds, implied probabilities, and bookmaker margins.

TLDR: I randomly built a real-time arbitrage detector that called out guaranteed-profit moments with surprising accuracy. I paper-tested it, trusted it, switched to real money, and it didn’t miss even once. But hey, bet smart, this is still betting and you are just taking a calulated risk here.

DISCLAIMER - BETTING IS RISKY AND I AM NOT PROMOTING IT

This blog walks through the math behind betting odds, how bookmakers make money, and how I built this project to track odds and detect arbitrage opportunities in real time.


1. Understanding Betting Odds (With a Simple Example)

Betting odds tell you how much you can win relative to your stake.

For example:

  • India: 1.14

  • Australia: 5.60

If you bet ₹200:

  • On India: 200 × 1.14 = ₹228₹28 profit if they win.

  • On Australia: 200 × 5.60 = ₹1120₹920 profit if they win.

The formula is simple:

$$\text{Payout} = \text{Bet Amount} \times \text{Odds}$$


2. Can You Bet on Both Teams and Always Win? (Arbitrage Betting)

This is where arbitrage betting comes in. (may not occur at single instance)

It’s a strategy where you bet on all possible outcomes in such a way that you guarantee profit no matter what happens.

The key condition for a two-outcome event:

For two outcomes with odds ( a ) and ( b ), the key condition is:

$$\frac{1}{a} + \frac{1}{b} < 1$$

Where ( a ) and ( b ) are the odds for both teams.


Example:
India: 1.14
Australia: 15.60

Substituting:

$$\frac{1}{1.14} + \frac{1}{15.60} \approx 0.91 < 1$$

This means you can split your stake to guarantee profit.

  • Bet ₹186.38 on India | if India wins then profit of Rs.26.09 | (Total returns: Rs.212.47)

  • Bet ₹13.62 on Australia | if Australia wins then profit of Rs. 198.85 | (Total returns: Rs.212.47)

  • No matter who wins, you end up with a small risk-free profit.

This doesn’t happen often but when it does, it’s a free money situation.

It will occur at two instances and we just need a live monitor to track and pool the money. Thats what i did and made profits during IPL and T20 matches. [when betting was legal]

I used paper money to test on the few match and each time there was a guaranteed profits before I used realy money for this project.


3. How Do Bookmakers Always Make Money?

Bookmakers aren’t in the business of losing. They bake in a margin (or "overround") by slightly skewing the odds.

The implied probability of each outcome is:

$$\text{Probability} = \frac{1}{\text{Odds}}$$

For our example:

  • India: 1 / 1.14 ≈ 87.72%

  • Australia: 1 / 5.60 ≈ 17.86%

Total: 87.72 + 17.86 ≈ 105.58%

That extra 5.58%? That’s the bookmaker’s profit margin.


4. The Project: Real-Time Odds Monitoring & Arbitrage Detection

Above is the screenshot of the app that i developed that monitoed and notified when the arbitrage detected

I wanted to monitor live odds, and visualize them in real time.

So I built PariScrapper, which has three main components:

a) Flask API (main.py)

  • Uses Selenium to scrape live odds from Parimatch.

  • Runs a background thread to continuously update odds for a given event.

  • Developed a REST API at /odds?event=<id> to fetch the latest data.

b) Arbitrage Detection (arbitrage.py)

  • Initialize a small amount on one side. (determined by AI deep research)

  • Periodically queries the API. (websocket response from the betting platform to streamlit app)

  • Checks if the arbitrage condition is met.

  • Logs alerts when opportunities are found.

  • Then we immidiately procede to make a bet based on this scenario.

c) Streamlit Dashboard (streamlit_ui.py)

  • Displays real-time odds, implied probabilities, and bookmaker margins.

  • Plots historical trends for better insights.


5. Key Features

  • Live Odds Monitoring: Continuous updates from the betting platform.

  • Arbitrage Detection: Detects when a guaranteed profit opportunity arises.

  • Bookmaker Margin Estimation: Shows how much profit bookmakers make.

  • Streamlit Dashboard: Interactive visualization for odds & probabilities.

  • REST API: Transformed websocket response from the UI to endpoint to quick algo run.


6. What’s Next?

I’m planning to add:

  • Advanced notifications (Telegram/email alerts when arbitrage appears).

  • Better scaling (switching to async scraping for many events).


Disclaimer

This project is built to fun. Betting involves financial risk, and arbitrage opportunities are rare and time-sensitive. Use this tool responsibly.

Check it out on GitHub: PariScrapper

H
hashnode10mo ago

nice