A terminal-based betting assistant for Toronto Blue Jays games. Built in COBOL with Python data fetchers. Pulls live data from the MLB Stats API and ranks home-run candidates using a weighted statistical model.
This is a curses-style TUI app that helps you make smarter bets on Blue Jays games by surfacing the batters most likely to hit home runs against the upcoming opposing pitcher.
| Feature | Description |
|---|---|
| 📅 Schedule Viewer | Last 7 days + next 7 days of Jays games with scores |
| 📝 Bet Recorder | Log and track your wagers with timestamps |
| 💣 HR Tracker | Predicts top home-run candidates for the next game |
| 🌬️ Weather Impact | Wind direction & speed, temperature bonuses |
| ⚾ Pitcher Vulnerability | Starting pitcher HR/9 factored into every score |
| 🤜🤛 Head-to-Head History | Career HR count vs the exact pitcher facing them |
| ✅ Lineup Confirmation | Switches from roster preview to confirmed starters |
| 🔄 Live Refresh | Pull fresh data from MLB API anytime |
┌─────────────────────────────────────────────────────────────┐
│ BLUE JAYS SMART BET SYSTEM HR TRACKER │
│ ─────────────────────────────────────────────────────────── │
│ │
│ 2026-05-03 Minnesota Twins Target Field 16:45 │
│ WEATHER: Unknown WIND: 0mph TEMP: ?? F │
│ JAYS HR/9: 1.13 OPP HR/9: 0.97 │
│ MODE: PREV PITCHER: Joe Ryan HAND: R HR/9: 0.70 │
│ │
│ NAME POS GM HR AB vH AVG SCORE │
│ ─────────────────────────────────────────────────────────── │
│ Kazuma Okamoto 3B 5 3 20 .300 20.0 │
│ Daulton Varsho CF 5 1 20 1 .200 19.4 │
│ Brandon ValenzuelaC 5 2 12 .333 14.0 │
│ Andres Gimenez SS 5 0 19 1 .105 13.8 │
│ Ernie Clement 2B 5 1 19 .158 8.0 │
│ Lenyn Sosa 2B 5 1 19 .316 8.0 │
│ Myles Straw RF 5 1 11 .182 8.0 │
│ Davis Schneider LF 5 0 8 .125 2.0 │
│ George Springer DH 5 0 13 .308 2.0 │
│ Jesus Sanchez LF 5 0 17 .059 2.0 │
│ │
│ Press ENTER to return to menu. │
└─────────────────────────────────────────────────────────────┘
Each batter gets a Score (0–100) based on six weighted factors:
| Factor | Weight | What It Means |
|---|---|---|
| Recent Power | HRs in last 5 / Games × 30 |
Hot batters score higher |
| Wind | +4 to +20 | Blowing OUT at 15mph = +20 |
| Opp Bullpen HR/9 | (HR/9 − 0.80) × 12 |
Team-wide pitching vulnerability |
| Starter HR/9 | (HR/9 − 0.80) × 15 |
The biggest situational factor |
| Temperature | +2 to +8 | 85°F = +8 (ball carries farther) |
| H2H History | HRs vs pitcher × 8 + OPS × 5 |
Past success against this exact pitcher |
- Recent: 1 HR in 5 games → base = 6.0
- Starter HR/9: 0.70 (below 0.80) → 0 bonus
- Head-to-head: 1 career HR vs Ryan in 10 AB, OPS .682 → +11.4
- Total Score: 19.4
- GnuCOBOL ≥ 3.1 (with SCREEN / curses support)
- Python 3 (stdlib only:
urllib,json,datetime,re,unicodedata) - Internet connection (MLB Stats API)
# Build
cobc -x -Wall jays_bet.cbl -o jays_bet
# Run
./jays_betfetch_jays.pypulls schedule & scores →jays_data.txtfetch_hr_tracker.pypulls stats, weather, and lineups →hr_tracker_data.txt- The COBOL TUI launches with a live menu
| # | Option | When to Use |
|---|---|---|
| 1 | View Historical Game Data | Check past results |
| 2 | Record New Bet | Log a wager before the game |
| 3 | View My Bets | Review your bet history |
| 4 | Refresh Data from API | Update scores / weather / lineups |
| 5 | Home Run Tracker | The main event — see HR predictions |
| 6 | Exit | Close the app |
| Confidence | Signal | Action |
|---|---|---|
| 🟢 High | MODE: CONF + Score ≥ 25 + vH > 0 |
Strong HR prop candidate |
| 🟡 Medium | MODE: PREV + Score ≥ 25 |
Good signal; verify batter is starting |
| 🔴 Low | Pitcher HR/9 < 0.8 + Score < 15 | Pitcher suppresses HRs; avoid |
PREV(Preview) — Lineup not posted yet. Uses the full active roster (~13 players). Good for morning research.CONF(Confirmed) — Starting lineup is locked in (usually 2–3 hours before first pitch). Only the 9 starters are ranked. This is your green light for placing bets.
Pro tip: Run the tracker in the morning for a preview. Hit Refresh 30–60 minutes before first pitch to lock in the confirmed lineup and final weather.
MLB Stats API
│
▼
┌─────────────────┐ ┌─────────────────┐
│ fetch_jays.py │────▶│ jays_data.txt │
│(schedule/scores)│ │ (fixed-width) │
└─────────────────┘ └─────────────────┘
│
┌─────────────────────┐ ┌─────────────────────┐
│ fetch_hr_tracker.py │────▶│ hr_tracker_data.txt │
│ (stats/weather/H2H) │ │ (fixed-width) │
└─────────────────────┘ └─────────────────────┘
│
┌─────▼─────┐
│ jays_bet │
│ (COBOL) │
│ SCREEN │
│ SECTION │
└───────────┘
- Python handles all API calls, parsing, and score math.
- COBOL handles the TUI, user input, and file I/O.
- Both sides communicate through fixed-width text files with exact byte layouts.
| File | Purpose |
|---|---|
jays_bet.cbl |
Main COBOL application (SCREEN SECTION TUI) |
fetch_jays.py |
Schedule & scores fetcher |
fetch_hr_tracker.py |
HR prediction engine |
GUIDE.md |
Deep-dive metric reference & troubleshooting |
.gitignore |
Excludes generated data files |
| File | Description |
|---|---|
jays_data.txt |
49-byte fixed-width game records |
hr_tracker_data.txt |
104-byte header + 41-byte player records |
bets.dat |
COBOL sequential file for recorded bets |
jays_bet |
Compiled binary |
Data provided by the MLB Stats API (© MLB Advanced Media, L.P.). This is an unofficial fan project and is not affiliated with Major League Baseball or the Toronto Blue Jays.
MIT — use at your own risk. Gambling involves financial loss. This tool is for informational purposes only.
For the full metric reference, troubleshooting guide, and byte-level file format specs, see GUIDE.md.