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
  • ๐Ÿ“Š 9-Factor Analysis - Comprehensive statistical model for predictions
  • ๐ŸŽฒ 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
  • ๐ŸŸ๏ธ Persian Gulf Leagues - Saudi Pro League, Qatar Stars League, UAE Pro League
  • ๐ŸŽฏ 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 Persian Gulf leagues only for 3 days
poe run-gulf --days=3

# Backtest all leagues for 4 weeks
poe backtest-all-global --weeks=4

๐Ÿ“‹ All Commands

Screener Commands

All Leagues (Major + Minor European + Persian Gulf)

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

Persian Gulf Leagues

Command Description
poe run-gulf --days N Screen all Persian Gulf leagues for N days
poe run-saudi --days N ๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Pro League only
poe run-qatar --days N ๐Ÿ‡ถ๐Ÿ‡ฆ Qatar Stars League only
poe run-uae --days N ๐Ÿ‡ฆ๐Ÿ‡ช UAE Pro League 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-gulf --weeks N Backtest ALL Persian Gulf leagues
poe backtest-all-global --weeks N Backtest ALL leagues (Major + Minor European + Persian Gulf)
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-qatar --weeks N ๐Ÿ‡ถ๐Ÿ‡ฆ Qatar Stars League
poe backtest-uae --weeks N ๐Ÿ‡ฆ๐Ÿ‡ช UAE Pro League

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

Persian Gulf Leagues

ID League Country
313 Saudi Pro League ๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Arabia
305 Qatar Stars League ๐Ÿ‡ถ๐Ÿ‡ฆ Qatar
354 UAE Pro League ๐Ÿ‡ฆ๐Ÿ‡ช UAE

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

๐Ÿง  How the Model Works

The betting model uses a 9-factor weighted scoring system:

Factor Weight Description
Position 20% League table standing differential
Odds 18% Bookmaker pre-match odds (implied probability)
Form 16% Recent match results (last 5 games)
Goals 12% Attack/defense strength (goals scored/conceded per game)
Home Advantage 9% Historical home team advantage
Momentum 7% 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

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 (103 matches):

Aggregated Results

  • Total Matches: 103
  • Correct Predictions: 59
  • Overall Accuracy: 57.3%
  • Draws Encountered: 31 (30.1%)
  • Accuracy (excl. draws): 81.9%
  • Best Recommended Double Chance: 87.4%

League Comparison

League Matches Accuracy Excl. Draws Best DC
๐Ÿ‡ฎ๐Ÿ‡น Serie A 8 87.5% 100.0% 100.0%
๐Ÿ‡ต๐Ÿ‡น Primeira Liga 7 71.4% 100.0% 100.0%
๐Ÿ‡ฉ๐Ÿ‡ช Bundesliga 11 63.6% 87.5% 90.9%
๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Pro League 12 58.3% 87.5% 91.7%
๐Ÿ‡ฌ๐Ÿ‡ง Premier League 9 55.6% 83.3% 88.9%
๐Ÿ‡ซ๐Ÿ‡ท Ligue 1 9 55.6% 83.3% 88.9%
๐Ÿ‡น๐Ÿ‡ท Super Lig 8 62.5% 83.3% 87.5%
๐Ÿ‡ณ๐Ÿ‡ฑ Eredivisie 9 44.4% 80.0% 88.9%
๐Ÿ‡ถ๐Ÿ‡ฆ Qatar Stars League 6 50.0% 75.0% 83.3%
๐Ÿ‡ง๐Ÿ‡ช Belgian Pro League 8 50.0% 66.7% 75.0%
๐Ÿ‡ฆ๐Ÿ‡ช UAE Pro League 7 57.1% 66.7% 71.4%
๐Ÿ‡ช๐Ÿ‡ธ La Liga 9 33.3% 60.0% 77.8%

12-Week Backtest Results

Based on 12-week backtests across all leagues (979 matches):

Aggregated Results

  • Total Matches: 979
  • Correct Predictions: 553
  • Overall Accuracy: 56.5%
  • Draws Encountered: 262 (26.8%)
  • Accuracy (excl. draws): 77.1%
  • Best Recommended Double Chance: 83.2%

League Comparison

League Matches Accuracy Excl. Draws Best DC
๐Ÿ‡ต๐Ÿ‡น Primeira Liga 79 64.6% 85.0% 88.6%
๐Ÿ‡ธ๐Ÿ‡ฆ Saudi Pro League 94 63.8% 82.2% 86.2%
๐Ÿ‡น๐Ÿ‡ท Super Lig 71 49.3% 81.4% 88.7%
๐Ÿ‡ฉ๐Ÿ‡ช Bundesliga 89 58.4% 81.2% 86.5%
๐Ÿ‡ฎ๐Ÿ‡น Serie A 118 60.2% 78.0% 83.1%
๐Ÿ‡ซ๐Ÿ‡ท Ligue 1 72 62.5% 77.6% 81.9%
๐Ÿ‡ช๐Ÿ‡ธ La Liga 98 57.1% 76.7% 82.7%
๐Ÿ‡ณ๐Ÿ‡ฑ Eredivisie 79 50.6% 75.5% 83.5%
๐Ÿ‡ฆ๐Ÿ‡ช UAE Pro League 49 55.1% 73.0% 79.6%
๐Ÿ‡ถ๐Ÿ‡ฆ Qatar Stars League 29 62.1% 72.0% 75.9%
๐Ÿ‡ฌ๐Ÿ‡ง Premier League 129 48.8% 70.8% 79.8%
๐Ÿ‡ง๐Ÿ‡ช Belgian Pro League 72 48.6% 68.6% 77.8%

Key Findings

  • 1-week results show higher accuracy (81.9% excl. draws) but smaller sample size (103 matches)
  • 12-week results provide more reliable statistics with 77.1% accuracy (excl. draws) across 979 matches
  • Double Chance is the safest bet type with 83.2% accuracy (12-week) and 87.4% (1-week)
  • Primeira Liga and Saudi Pro League consistently show high accuracy across both time periods
  • Draw rate: 26.8% (12-week) to 30.1% (1-week) - use Double Chance for safer bets
  • Best leagues for predictions: Primeira Liga, Saudi Pro League, Super Lig, Bundesliga

๐Ÿ’ป 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 --gulf-only              # Persian Gulf leagues only
slickbet --all-leagues            # All supported leagues (Major + Minor European + Persian Gulf)
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 --gulf-only --weeks 4     # All Persian Gulf leagues
slickbet backtest-all --include-gulf --weeks 4  # Major + Minor European + Persian Gulf
slickbet backtest-all --include-gulf --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         # 9-factor betting model
โ”‚       โ”œโ”€โ”€ 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.1.0.tar.gz (132.5 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.1.0-py3-none-any.whl (50.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slickbet-0.1.0.tar.gz
  • Upload date:
  • Size: 132.5 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.1.0.tar.gz
Algorithm Hash digest
SHA256 26225935fb25b58a41683d41a33541f1e75daebc4330fba2c861f30aeacc1f0a
MD5 269a1b60c67c348e273e46bdf42035a2
BLAKE2b-256 59de6fc1c2bd10ce635ae796731b886f03ee9706ef3812e4ba5b56e43e818e34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: slickbet-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 50.7 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3757468c73d1aa190e2baeaa443dbac64ab18c0e7d1ad59919e5c2300a6c0725
MD5 fac2c65d86b826da43e7b0c3926b4aa5
BLAKE2b-256 b779d42dbdc88c11daa635f3185d5a3e5e8922107789b06ad09aed56f736a49e

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