返回 Skill 列表
extension
分类: 数据与分析无需 API Key

Worldcup Predictor

FIFA世界杯比赛预测器:双模式比分模型+Elo评分。提供胜/平/负概率及比分预测。

person作者: ravenquasarhubclawhub

World Cup Predictor

A FIFA World Cup match prediction tool based on real schedule data, group standings, and an Elo rating model.

Data Sources

Primary: NetEase Sports

  • URL: https://sports.163.com/caipiao/worldcup2026
  • Provides: full schedule, live scores, half-time scores, group info
  • Data is fetched via browser snapshot and cached to schedule.json

Secondary: BALLDONTLIE FIFA World Cup API

  • Website: https://fifa.balldontlie.io
  • API Base URL: https://api.balldontlie.io/fifa/worldcup/v1
  • Auth: HTTP Header Authorization: YOUR_API_KEY
  • Free tier: team list, stadium list

API Key Configuration

Store your API key in ~/.openclaw/openclaw.json:

{
  "skills": {
    "worldcup-predictor": {
      "api_key": "***"
    }
  }
}

Prediction Model (v2.3)

Dual-Mode Score Prediction

The key innovation: different models for different match types.

Mode A — Blowout Mode (strength gap ≥ 15 points) Uses an attack × defense weakness product model with a collapse factor:

  • Strong team's attack λ is multiplied by the weak team's defensive weakness
  • When a weak team (strength < 65) faces a strong team (strength > 85), weakness is amplified by the gap
  • Collapse factor: weakness × (1 + gap × 0.007) — e.g. gap=34 → 1.24x multiplier
  • Result: correctly predicts blowouts like Germany 6-1 Curaçao (actual: 7-1)

Mode B — Balanced Mode (strength gap < 15 points) A compressed Poisson model that keeps total goals reasonable:

  • Base λ is compressed to 1.0-2.0 range
  • Opponent strength provides gentle moderation
  • Prevents over-predicting goal fests in close matches
  • Result: correctly predicts close matches like Netherlands 3-2 Japan (actual: 2-2)

Multi-Dimensional Elo Rating Model

  1. Base Strength — 48 teams with preset strength scores (50-95), mapped to Elo 1300-2000
  2. Group Standings — Auto-calculated from match data; rank bonuses (#1: +20, #2: +10, #3: -5, #4: -15)
  3. Recent Form — Completed match performance (win +3/draw +1 pts), +5 Elo per point
  4. Goal Data — Average goals scored/conceded calibrate Poisson λ parameters
  5. Tournament Draw Rate — Real-time tournament draw rate weighted 50:50 with model draw probability
  6. Draw Bias Correction — When draw probability is high and attacking data is close, score tilts toward a draw
  7. Home Advantage — +70 Elo

Prediction Output Format

📊 Match Prediction
══════════════════════════════════════
🇦🇷 Argentina vs 🇧🇷 Brazil

📈 Team Strength:
🇦🇷 Argentina [█████████░] 95
🇧🇷 Brazil    [█████████░] 93

🏅 Group Ranking:
🇦🇷 Argentina: Group #1
🇧🇷 Brazil:    Group #2

⚽ Recent Data:
🇦🇷 Argentina: 2.0 goals/game avg
🇧🇷 Brazil:    1.0 goals/game avg

📊 Win Probability
🇦🇷 Argentina Win: 48.2%
🤝 Draw:           32.2%
🇧🇷 Brazil Win:    19.6%

⚽ Predicted Score: 🇦🇷 2 - 1 🇧🇷

📈 Tournament Draw Rate: 38% (reference)

🔑 Key Analysis
  • Argentina ranked higher in group
  • Argentina in better form
  • Predicted narrow Argentina win

Backtest Accuracy

v2.3 achieved 78% (7/9) correct win/draw/loss direction on completed matches.

Usage

Predict a match

python3 predict.py match Australia Turkey

Predict a team's next match

python3 predict.py team Brazil

View group standings (auto-calculated)

python3 predict.py standings

Today's matches + predictions

python3 predict.py today

View full schedule

python3 predict.py schedule

Update schedule cache

After fetching latest schedule from NetEase:

python3 predict.py update

Scripts

scripts/predict.py

Core prediction script with the following commands:

| Command | Description | |---------|-------------| | teams | List all 48 teams (grouped by confederation) | | standings | Auto-calculate group standings | | schedule | View full match schedule | | today | Today's matches + predictions | | match <home> <away> | Predict a specific match | | team <name> | Predict a team's next match | | update | Update schedule cache | | --upcoming | Flag for schedule: show only upcoming matches |

Configuration

The script reads the API key from ~/.openclaw/openclaw.json (optional, for BALLDONTLIE data enrichment):

{
  "skills": {
    "worldcup-predictor": {
      "api_key": "***"
    }
  }
}

File Structure

worldcup-predictor/
├── SKILL.md
└── scripts/
    ├── predict.py      # Core prediction script
    └── schedule.json   # Schedule cache (auto-generated)