DEV Community

Cover image for How I Built a Sports Betting Edge Scanner: NHL & NBA Value Bets with Python, Polymarket & Forebet
migach92
migach92

Posted on • Originally published at dev.to

How I Built a Sports Betting Edge Scanner: NHL & NBA Value Bets with Python, Polymarket & Forebet

The hustle is real: ⛹️‍♂️ I'm on a quest to find that sweet spot where data science outsmarts the sports prediction market. If you're into Python, sports analytics, or just love a good side project, you're in the right place.


The "Aha!" Moment 💡

I've always been a fan of hockey (NHL) and basketball (NBA). It struck me that there are two completely independent worlds: the statistical prediction models of Forebet and the live, opinion-driven prices on Polymarket.

Logically, if Forebet's model says the Boston Bruins have a 62% chance to win, but the Polymarket price implies only a 56% chance, there might be a value bet. I wanted a way to automatically spot these disagreements without manually checking 20+ websites every day.

That's when Value Bet Scanner: Forebet vs Polymarket was born.

What Does It Do? 🛠️

This Python project:

  1. Scrapes upcoming NHL or NBA matches from Forebet.com. (Forebet provides a probability estimate based on their statistical model)
  2. Fetches the current Moneyline markets from the Polymarket Gamma API (the real-time prediction market prices).
  3. Matches team names with fuzzy logic (because "Boston Bruins" vs "bruins" shouldn't be a human problem).
  4. Calculates the percentage difference.
  5. Flags any discrepancy greater than a configurable threshold (default 5%) as a potential value signal.

The output is a clean terminal table showing you exactly where the potential edge is.


bash
python nhl_scanner.py

All matched matches:
Boston Bruins vs Buffalo Sabres
Forebet: 62.0% / 38.0%
Polymarket: 56.0% / 44.0%
Difference: Boston +6.0%, Buffalo -6.0%

VALUE SIGNALS (diff ≥ 5%)
#1 Boston Bruins vs Buffalo Sabres
Bet on: Boston Bruins
Forebet: 62.0%
Polymarket: 56.0% (price 0.560)
Value: +6.0%
https://polymarket.com/event/...
Enter fullscreen mode Exit fullscreen mode

Top comments (0)