A Telegram bot that detects value betting edges in tennis matches using surface-adjusted Elo ratings.
Fetch Odds (AllSportsAPI)
↓
4-Factor Model (Elo, Form, Surface, H2H)
↓
Value Edge = (Model Prob * Market Odds) - 1
True Edge = Value Edge * Confidence
↓
If Value Edge ≥ 4% and Model Prob ≥ 35% → Send Signal via Telegram
↓
Deduct 1 Credit from User
/backtest uses Pinnacle implied probabilities (de-vigged) as the primary model
and applies point-in-time Elo as a secondary confirmation filter.
Use paper trading + CLV metrics as the primary validator for live behavior.
cd tennisedge
python -m venv venv
venv\Scripts\activate # Windows
pip install -r requirements.txtcopy .env.example .env
# then edit .env with your valuespsql -U postgres
CREATE DATABASE tennisedge;
\qpython bot.pyLeave MOCK_MODE=true in your .env — the bot will use fake match data so you can test all commands.
To trigger a manual scan (as admin):
/scan
To add credits to a user (as admin):
/addcredits <telegram_id> <amount>
| Command | Description |
|---|---|
| /start | Register & welcome |
| /balance | Check your credits |
| /buy | Purchase credits info |
| /signals | View recent signals |
| /matches | Upcoming matches |
| /predict | AI match analysis |
| /portfolio | Paper trading stats |
| /beta | Join free beta channel |
| /help | How it works |
| /scan | (Admin) Run pipeline now |
| /addcredits | (Admin) Add credits manually |
| /broadcastbeta | (Admin) Invite all users to beta channel |
| /backtest | (Admin) Pinnacle+Elo backtest |
tennisedge/
├── bot.py ← main entry point
├── config.py ← all settings
├── requirements.txt
├── .env.example
│
├── ingestion/
│ └── fetch_odds.py ← AllSportsAPI + mock data
│
├── models/
│ └── elo_model.py ← surface-adjusted Elo
│
├── signals/
│ ├── edge_detector.py ← edge detection engine
│ └── formatter.py ← Telegram message formatter
│
├── scheduler/
│ └── job.py ← 30-min automation pipeline
│
└── database/
└── db.py ← PostgreSQL all-in-one
- Set
MOCK_MODE=falsein.env - Add your real
ODDS_API_KEY - Add your real
TELEGRAM_BOT_TOKEN - Set
BETA_CHANNEL_LINKto your free Telegram beta channel invite - Deploy to any VPS (DigitalOcean, Hetzner, etc.)
- Run with:
python bot.py
- Scheduler now performs the first pipeline run immediately on startup.
- Use this status command daily until 100 resolved paper bets are reached:
python paper_trading_status.py- JSON mode:
python paper_trading_status.py --json
- Elo calibration diagnostics:
python -m tennis_backtest.elo_calibration_check - Baseline probability build:
python -m tennis_backtest.step4b_baseline_probs --input <in.csv> --output <out.csv> - Elo K sweep:
python -m tennis_backtest.elo_k_calibration --input-csv <out.csv> - Backtest wrapper:
python -m tennis_backtest.step6_backtest_v2 - Hard-stop pipeline runner:
python -m tennis_backtest.run_sprint2_pipeline --input-csv <in.csv>
Add a Render Cron Job to keep Elo ratings updated from finished matches:
- Schedule:
0 6 * * *(06:00 UTC daily) - Command:
python -m scheduler.update_elo_job - Optional dry-run check:
python -m scheduler.update_elo_job --dry-run
| Plan | Credits | Price |
|---|---|---|
| Starter | 10 | ₹199 |
| Pro | 50 | ₹799 |
| VIP | 200 | ₹2499 |
Credits are added manually by admin after UPI payment confirmation.