Skip to main content

Soccer betting screener using Livescore API

Project description

๐ŸŽฐ SlickBet - Soccer Betting Screener

A Python-based betting screener for soccer games using the Livescore API. Fetches upcoming matches, analyzes team statistics, and ranks betting opportunities by win probability.

Features

  • ๐Ÿ“… Multi-Day Screening - Screen matches for the next N days
  • ๐Ÿ“Š 11-Factor Analysis - Comprehensive statistical model with xG and reliability metrics
  • ๐ŸŽฒ Double Chance Bets - Safer betting options (1X, X2, 12)
  • ๐Ÿ† Major European Leagues - Bundesliga, Premier League, La Liga, Serie A, Ligue 1
  • ๐ŸŒ Minor European Leagues - Belgian Pro League, Primeira Liga, Super Lig, Eredivisie, 1. HNL, Ekstraklasa, Premiership, Super League
  • ๐ŸŒ Asia Leagues - Saudi Pro League, Hyundai A-League (Australia)
  • ๐ŸŒŽ Americas Leagues - Liga Professional (Argentina), Serie A (Brazil), Liga MX (Mexico)
  • ๐ŸŽฏ Confidence Grades - Visual indicators (๐Ÿ”ฅ HIGH VALUE, โœ… GOOD BET, ๐Ÿ‘ DECENT, โš ๏ธ RISKY)
  • ๐Ÿ“ˆ Backtesting - Validate model accuracy against historical data
  • ๐Ÿ’ป CLI Interface - Easy-to-use command-line tool
  • ๐Ÿ“„ PDF Export - Export results to shareable PDF reports

Installation

This project uses uv for fast, reliable Python package management.

# Clone the repository
git clone https://github.com/your-username/slick-bet.git
cd slick-bet

# Install dependencies with uv
uv sync

# Install with dev dependencies
uv sync --dev

Configuration

Set your Livescore API credentials as environment variables:

export LIVESCORE_API_KEY="your_api_key"
export LIVESCORE_API_SECRET="your_api_secret"

Quick Start

# Screen all leagues for tomorrow with top 20 results
poe run-all --days=1 --top=20

# Screen major European leagues only (tomorrow's games)
poe run-major

# Screen Asia leagues only for 3 days
poe run-asia --days=3

# Screen Americas leagues only for 3 days
poe run-americas --days=3

# Backtest all leagues for 1 week
poe backtest-all-global --weeks=1

๐Ÿ“‹ All Commands

Screener Commands

All Leagues (Major + Minor European + Asia + Americas)

Command Description
poe run-all --days N Screen ALL leagues for next N days
poe run-all-week Screen ALL leagues for next 7 days

Major European Leagues

Command Description
poe run-major Screen major European leagues (tomorrow)
poe run-major-week Screen major European leagues for 7 days
poe run-bundesliga --days N ๐Ÿ‡ฉ๐Ÿ‡ช Bundesliga only
poe run-pl --days N ๐Ÿ‡ฌ๐Ÿ‡ง Premier League only
poe run-laliga --days N ๐Ÿ‡ช๐Ÿ‡ธ La Liga only
poe run-seriea --days N ๐Ÿ‡ฎ๐Ÿ‡น Serie A only
poe run-ligue1 --days N ๐Ÿ‡ซ๐Ÿ‡ท Ligue 1 only

Asia Leagues

Command Description
poe run-asia --days N Screen all Asia leagues for N days
poe run-saudi --days N ๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Pro League only
poe run-australia --days N ๐Ÿ‡ฆ๐Ÿ‡บ Hyundai A-League only

Americas Leagues

Command Description
poe run-americas --days N Screen all Americas leagues for N days
poe run-argentina --days N ๐Ÿ‡ฆ๐Ÿ‡ท Liga Professional only
poe run-brazil --days N ๐Ÿ‡ง๐Ÿ‡ท Serie A only
poe run-mexico --days N ๐Ÿ‡ฒ๐Ÿ‡ฝ Liga MX only

Basic Commands

Command Description
poe run Screen tomorrow's games
poe run-top --top K Show top K betting opportunities
poe run-days --days N Screen next N days

Backtest Commands

Aggregated Backtests

Command Description
poe backtest-all --weeks N Backtest ALL major + minor European leagues
poe backtest-asia --weeks N Backtest ALL Asia leagues (Saudi, Australia)
poe backtest-all-global --weeks N Backtest ALL leagues (Major + Minor European + Asia + Americas)
poe backtest-all-global --weeks N --debug=1 Same as above with detailed match-by-match debug output

Note: Add --debug=1 to any backtest command (or --debug for direct CLI usage) to see detailed match-by-match information including:

  • Match details (date, teams, competition)
  • Actual match results
  • Our predictions (team, probability, confidence)
  • Whether the prediction was correct or incorrect
  • Key reasoning factors

Individual League Backtests

Command Description
poe backtest-bundesliga --weeks N ๐Ÿ‡ฉ๐Ÿ‡ช Bundesliga
poe backtest-pl --weeks N ๐Ÿ‡ฌ๐Ÿ‡ง Premier League
poe backtest-liga --weeks N ๐Ÿ‡ช๐Ÿ‡ธ La Liga
poe backtest-seriea --weeks N ๐Ÿ‡ฎ๐Ÿ‡น Serie A
poe backtest-ligue1 --weeks N ๐Ÿ‡ซ๐Ÿ‡ท Ligue 1
poe backtest-saudi --weeks N ๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Pro League
poe backtest-australia --weeks N ๐Ÿ‡ฆ๐Ÿ‡บ Hyundai A-League
poe backtest-argentina --weeks N ๐Ÿ‡ฆ๐Ÿ‡ท Liga Professional
poe backtest-brazil --weeks N ๐Ÿ‡ง๐Ÿ‡ท Serie A
poe backtest-mexico --weeks N ๐Ÿ‡ฒ๐Ÿ‡ฝ Liga MX

Development Commands

Command Description
poe lint Run linter
poe lint-fix Fix linting issues
poe format Format code
poe typecheck Run type checker
poe test Run tests
poe test-cov Run tests with coverage
poe check Run all code quality checks
poe fix Fix linting and format code
poe dev Fix code and run tests

๐Ÿ† League IDs

Major European Leagues

ID League Country
1 Bundesliga ๐Ÿ‡ฉ๐Ÿ‡ช Germany
2 Premier League ๐Ÿ‡ฌ๐Ÿ‡ง England
3 La Liga ๐Ÿ‡ช๐Ÿ‡ธ Spain
4 Serie A ๐Ÿ‡ฎ๐Ÿ‡น Italy
5 Ligue 1 ๐Ÿ‡ซ๐Ÿ‡ท France

Minor European Leagues

ID League Country
68 Belgian Pro League ๐Ÿ‡ง๐Ÿ‡ช Belgium
8 Primeira Liga ๐Ÿ‡ต๐Ÿ‡น Portugal
6 Super Lig ๐Ÿ‡น๐Ÿ‡ท Turkey
196 Eredivisie ๐Ÿ‡ณ๐Ÿ‡ฑ Netherlands
17 1. HNL ๐Ÿ‡ญ๐Ÿ‡ท Croatia
60 Ekstraklasa ๐Ÿ‡ต๐Ÿ‡ฑ Poland
75 Premiership ๐Ÿด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ Scotland
9 Super League ๐Ÿ‡ฌ๐Ÿ‡ท Greece

Asia Leagues

ID League Country
313 Saudi Pro League ๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Arabia
67 Hyundai A-League ๐Ÿ‡ฆ๐Ÿ‡บ Australia

Americas Leagues

ID League Country
23 Liga Professional ๐Ÿ‡ฆ๐Ÿ‡ท Argentina
24 Serie A ๐Ÿ‡ง๐Ÿ‡ท Brazil
45 Liga MX ๐Ÿ‡ฒ๐Ÿ‡ฝ Mexico

Use slickbet competitions --country <name> to find more competition IDs.

๐Ÿง  How the Model Works

The betting model uses an 11-factor weighted scoring system with advanced statistics:

Factor Weight Description
Position 19% League table standing differential
Odds 17% Bookmaker pre-match odds (implied probability)
Form 15% Recent match results (last 5 games)
Goals 11% Attack/defense strength (goals scored/conceded per game)
Home Advantage 9% Historical home team advantage
Momentum 6% First-half lead rate + win rate + comeback ability
H2H 7% Historical head-to-head record
Venue Form 6% Home/away specific win rates
Defense 5% Clean sheet rate
Match Stats 5% Possession, attacks, shots (includes xG at 28%, xGD at 15%, Shot Accuracy at 10%)
Reliability 4% Team discipline based on cards (fewer cards = more reliable)

Note: The Match Stats factor includes xG (Expected Goals) weighted at 28%, xGD (Expected Goal Difference) at 15%, and Shot Accuracy at 10% within that factor. The Reliability factor measures team discipline - teams with fewer yellow/red cards are more predictable and reliable for betting.

๐Ÿ“Š Key Statistical Predictors

The model incorporates advanced statistical metrics that are proven predictors of soccer match outcomes:

Expected Goals (xG)

  • Premier metric for evaluating the quality of scoring chances
  • Directly correlates with team success and future performance
  • Weighted at 28% within the Match Stats factor (highest weight)
  • Calculated from historical match statistics, measuring shot quality and chance creation
  • Teams with higher xG averages are more likely to score and win

Expected Goal Difference (xGD)

  • Strong predictor of a team's points per match over a season
  • Calculated as the difference between team's xG and opponent's xG (xG - xGA)
  • Weighted at 15% within the Match Stats factor
  • Teams with positive xGD consistently outperform those with negative xGD

Shots on Target

  • Often cited as the strongest in-game correlate of winning
  • Outperforms raw possession or total shots in predictive power
  • Weighted at 12% within the Match Stats factor
  • More reliable indicator than total shots, as it measures actual goal-scoring opportunities

Shot Accuracy

  • Measures the quality of chances created (shots on target / total shots)
  • More predictive than total shots alone - indicates better chance quality
  • Weighted at 10% within the Match Stats factor
  • Teams with higher shot accuracy create better scoring opportunities

Goal Conversion Rate

  • Measures efficiency in turning opportunities into actual goals
  • Calculated from goals scored relative to shots on target
  • Weighted at 8% within the Match Stats factor
  • Teams with higher conversion rates are more clinical and dangerous

Defensive Metrics (xGA - Expected Goals Against)

  • Lowering expected goals against is as crucial for predicting wins as high offensive xG
  • Measured through goals conceded per game in the Goals factor
  • Defense factor (5% weight) specifically evaluates clean sheet rates
  • Teams that consistently limit opponent chances (low xGA) are more likely to win

How These Metrics Work Together

The model combines these statistical predictors with traditional factors (form, position, H2H) to create a comprehensive prediction:

  • Match Stats (5% total):
    • xG: 28% (most predictive metric)
    • xGD: 15% (strong predictor of points per match)
    • Possession: 18%
    • Shots on Target: 12% (strongest in-game correlate)
    • Shot Accuracy: 10% (quality indicator)
    • Goal Conversion Rate: 8% (efficiency)
    • Dangerous Attacks: 6%
    • Attacks: 2%
    • Corners: 1%
  • Goals (11%): Incorporates attack/defense differential (goals scored vs conceded)
  • Defense (5%): Clean sheet rate as a proxy for defensive xGA performance

This multi-layered approach ensures that both offensive quality (xG, xGD, shots on target, shot accuracy) and defensive solidity (xGA, clean sheets) are properly weighted in predictions.

Double Chance Betting

The model also calculates double chance probabilities for safer bets:

  • 1X - Home wins OR Draw (Home doesn't lose)
  • X2 - Away wins OR Draw (Away doesn't lose)
  • 12 - Home OR Away wins (No draw)

Confidence Grades

Each prediction is assigned a grade based on backtest performance:

  • ๐Ÿ”ฅ HIGH VALUE - Best picks (DC โ‰ฅ80%, Win โ‰ฅ65%)
  • โœ… GOOD BET - Reliable picks (DC โ‰ฅ75%, Win โ‰ฅ60%)
  • ๐Ÿ‘ DECENT - Ok picks (DC โ‰ฅ70%)
  • โš ๏ธ RISKY - Use double chance only

๐Ÿ“Š Backtest Results

1-Week Backtest Results

Based on 1-week backtests across all leagues (147 matches):

Aggregated Results

  • Total Matches: 147
  • Correct Predictions: 84
  • Overall Accuracy: 57.1%
  • Draws Encountered: 42 (28.6%)
  • Accuracy (excl. draws): 80.0%
  • Best Recommended Double Chance: 84.3%

League Comparison

League Matches Accuracy Excl. Draws Best DC
๐Ÿ‡ซ๐Ÿ‡ท Ligue 1 9 66.7% 100.0% 100.0%
๐Ÿ‡ฌ๐Ÿ‡ท Super League 7 85.7% 100.0% 100.0%
๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Pro League 15 60.0% 100.0% 100.0%
๐Ÿ‡ง๐Ÿ‡ท Serie A 3 100.0% 100.0% 100.0%
๐Ÿ‡ฒ๐Ÿ‡ฝ Liga MX 9 66.7% 100.0% 100.0%
๐Ÿ‡ฎ๐Ÿ‡น Serie A 10 80.0% 88.9% 90.0%
๐Ÿ‡ฉ๐Ÿ‡ช Bundesliga 9 66.7% 85.7% 88.9%
๐Ÿ‡ฌ๐Ÿ‡ง Premier League 10 60.0% 85.7% 90.0%
๐Ÿ‡ต๐Ÿ‡น Primeira Liga 9 66.7% 85.7% 88.9%
๐Ÿ‡น๐Ÿ‡ท Super Lig 9 66.7% 85.7% 88.9%
๐Ÿ‡ณ๐Ÿ‡ฑ Eredivisie 9 44.4% 80.0% 88.9%
๐Ÿด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ Premiership 7 57.1% 80.0% 85.7%
๐Ÿ‡ต๐Ÿ‡ฑ Ekstraklasa 9 77.8% 77.8% 77.8%
๐Ÿ‡ช๐Ÿ‡ธ La Liga 10 40.0% 66.7% 80.0%
๐Ÿ‡ง๐Ÿ‡ช Belgian Pro League 8 50.0% 66.7% 75.0%
๐Ÿ‡ฆ๐Ÿ‡ท Liga Professional 21 38.1% 66.7% 81.0%
๐Ÿ‡ญ๐Ÿ‡ท 1. HNL 5 40.0% 50.0% 60.0%
๐Ÿ‡ฆ๐Ÿ‡บ Hyundai A-League 5 40.0% 50.0% 60.0%

Key Findings (1-Week Results)

  • Overall accuracy: 57.1% (80.0% excluding draws) across 147 matches
  • Double Chance is the safest bet type with 84.3% accuracy
  • Top performing leagues (excl. draws):
    • ๐Ÿ‡ซ๐Ÿ‡ท Ligue 1: 100.0% (9 matches)
    • ๐Ÿ‡ฌ๐Ÿ‡ท Super League: 100.0% (7 matches)
    • ๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Pro League: 100.0% (15 matches)
    • ๐Ÿ‡ง๐Ÿ‡ท Serie A: 100.0% (3 matches)
    • ๐Ÿ‡ฒ๐Ÿ‡ฝ Liga MX: 100.0% (9 matches)
    • ๐Ÿ‡ฎ๐Ÿ‡น Serie A: 88.9% (10 matches)
  • Draw rate: 28.6% - use Double Chance for safer bets
  • Best leagues for predictions: Ligue 1, Super League, Saudi Pro League, Serie A (Brazil), Liga MX

๐Ÿ’ป Direct CLI Usage

# Basic screening
slickbet                          # Screen tomorrow's games
slickbet --top 10                 # Show top 10 opportunities
slickbet --days 5                 # Screen next 5 days

# League filters
slickbet --major-only             # Major European leagues only
slickbet --asia-only              # Asia leagues only (Saudi, Australia)
slickbet --americas-only          # Americas leagues only (Argentina, Brazil, Mexico)
slickbet --all-leagues            # All supported leagues (Major + Minor European + Asia + Americas)
slickbet --league 2               # Specific league by ID

# Probability filters
slickbet --min-prob 0.60          # Only โ‰ฅ60% probability
slickbet --min-conf 0.30          # Only โ‰ฅ30% confidence

# Output options
slickbet --json                   # JSON output
slickbet --pdf                    # Export to PDF (auto-generated filename)
slickbet --pdf my_report.pdf      # Export to specific PDF file
slickbet --no-stats               # Fast mode (skip detailed stats)

# Backtesting
slickbet backtest --competition 2 --weeks 4     # Premier League, 4 weeks
slickbet backtest --competition 2 --weeks 4 --pdf  # Export backtest to PDF
slickbet backtest --competition 2 --weeks 4 --debug  # With detailed match-by-match debug output
slickbet backtest-all --weeks 4                 # All major + minor European leagues
slickbet backtest-all --weeks 4 --pdf           # Export aggregated results to PDF
slickbet backtest-all --asia-only --weeks 4     # All Asia leagues (Saudi, Australia)
slickbet backtest-all --americas-only --weeks 4 # All Americas leagues (Argentina, Brazil, Mexico)
slickbet backtest-all --include-asia --weeks 4 # Major + Minor European + Asia
slickbet backtest-all --include-asia --include-americas --weeks 4  # Major + Minor European + Asia + Americas
slickbet backtest-all --include-asia --include-americas --weeks 4 --debug  # With detailed match-by-match debug output

๐Ÿ Python API

from slickbet import BettingScreener, ScreenerConfig

# Create a screener for all leagues
config = ScreenerConfig(
    min_probability=0.60,
    all_leagues=True,
)
screener = BettingScreener(config=config)

# Screen next 3 days
result = screener.screen_days(3)

# Get top 10 betting opportunities (sorted by double chance probability)
for bet in result.get_top_k(10):
    match = bet.match
    dc = bet.double_chance
    
    print(f"๐ŸŸ๏ธ  {match.home_team.name} ({match.home_position}) vs "
          f"{match.away_team.name} ({match.away_position})")
    print(f"๐Ÿ†  {match.competition}")
    
    # Double chance recommendation
    best_dc, prob = dc.best_double_chance
    print(f"โญ Recommended: {best_dc} - {prob:.1%}")
    
    # Win bet
    print(f"๐Ÿ’ฐ Win bet: {bet.probability:.1%}")
    print()

Backtesting

from slickbet import Backtester, format_backtest_report

backtester = Backtester()

# Run backtest on Saudi Pro League (4 weeks)
results = backtester.run(
    competition_id="313",
    weeks=4,
)

# Print report
print(format_backtest_report(results))

# Access metrics
print(f"Accuracy (excl. draws): {results.accuracy_excluding_draws:.1%}")
print(f"Best Double Chance: {results.best_double_chance_accuracy:.1%}")

๐Ÿ“ Project Structure

slick-bet/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ slickbet/
โ”‚       โ”œโ”€โ”€ __init__.py      # Package exports
โ”‚       โ”œโ”€โ”€ api.py           # Livescore API client
โ”‚       โ”œโ”€โ”€ model.py         # 11-factor betting model (includes xG and reliability)
โ”‚       โ”œโ”€โ”€ screener.py      # Main screener logic
โ”‚       โ”œโ”€โ”€ backtest.py      # Backtesting module
โ”‚       โ”œโ”€โ”€ cli.py           # Command-line interface
โ”‚       โ””โ”€โ”€ pdf_export.py    # PDF report generation
โ”œโ”€โ”€ tests/                   # Test files
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ test_model.py
โ”œโ”€โ”€ assets/
โ”‚   โ””โ”€โ”€ predictions/        # Generated PDF reports
โ”œโ”€โ”€ pyproject.toml          # Project config (uv, poe, ruff, mypy)
โ”œโ”€โ”€ uv.lock                 # Lock file (auto-generated)
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md

โš ๏ธ Disclaimer

This tool is for educational and entertainment purposes only.

  • Past performance does not guarantee future results
  • Sports betting involves risk of financial loss
  • Always predict responsibly and within your means
  • Check local laws regarding sports betting in your jurisdiction

License

MIT License - See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slickbet-0.2.0.tar.gz (154.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slickbet-0.2.0-py3-none-any.whl (61.0 kB view details)

Uploaded Python 3

File details

Details for the file slickbet-0.2.0.tar.gz.

File metadata

  • Download URL: slickbet-0.2.0.tar.gz
  • Upload date:
  • Size: 154.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for slickbet-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0b13eb194f94ddda654d73627055257de4ec2cd11272104382942c7b6c395727
MD5 76330614aa6c7094e248064d8164c943
BLAKE2b-256 b0ffe5894249746d23d4d223162b39dafe8e5b917ea5ada83d22efb9ca741992

See more details on using hashes here.

File details

Details for the file slickbet-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: slickbet-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 61.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for slickbet-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc9e4bf821126088975df0fbd7d6182a20588c62c906476520dd3bbf50a6c756
MD5 23dbd407e1c05a56b5dfc7a9021f94df
BLAKE2b-256 14d90ec105fc43f83ef051515cadb4907259b86ba7f771ab99e77164f9432173

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page