Pay-per-call tennis analytics API. Elo ratings, match predictions, and betting edge detection. Powered by 25+ years of ATP data. Paid in USDC on Base via the x402 protocol.
- Python 3.10+ (for data pipeline)
- Node.js 18+ (for API server)
- Git
- A Base wallet with some USDC (for testing payments)
cd scripts
pip install pandas numpy
python 01_download_and_build_elo.pyThis will:
- Clone Jeff Sackmann's ATP dataset from GitHub
- Parse ~60,000+ matches from 2000–present
- Compute Elo ratings (overall + per surface) for all players
- Output
data/processed/player_elo.csvanddata/processed/matches_enriched.csv - Print a backtest showing ~65%+ accuracy
pip install scikit-learn xgboost
python 02_train_prediction_model.pyThis will:
- Engineer features (Elo delta, H2H, form, fatigue, surface)
- Train an XGBoost classifier on 2005–2023 data
- Validate on 2024–2025 matches
- Output
models/xgb_match_predictor.json
chmod +x 03_setup_api.sh
./03_setup_api.shThis scaffolds the Hono project with x402 middleware.
cd api
# Edit wrangler.toml — set your Base wallet address
# The facilitator is already set to xpay.sh (free, no auth needed)
# Test locally
npx wrangler dev
# Deploy to Cloudflare Workers
npx wrangler deploy# Your API is now live! Test the free discovery endpoint:
curl https://aceoracle.YOUR_SUBDOMAIN.workers.dev/
# To test a paid endpoint, use an x402 client:
# npm install @x402/fetch
# See docs at https://docs.x402.org┌──────────────────────────────────────────────────┐
│ Data Layer (Python, runs nightly via cron) │
│ ├── Sackmann GitHub → parse CSVs │
│ ├── Compute Elo ratings (overall + surface) │
│ ├── Train/update XGBoost model │
│ └── Push to Supabase / Cloudflare D1 / KV │
├──────────────────────────────────────────────────┤
│ API Layer (Hono on Cloudflare Workers) │
│ ├── @x402/hono middleware (xpay.sh facilitator) │
│ ├── USDC on Base mainnet │
│ ├── Cached predictions in KV │
│ └── 6 endpoints: $0.01 – $0.50 per call │
├──────────────────────────────────────────────────┤
│ Consumers │
│ ├── AI agents (Claude, ChatGPT, custom) │
│ ├── Betting bots │
│ ├── Fantasy tennis apps │
│ └── Sports analytics platforms │
└──────────────────────────────────────────────────┘
| Endpoint | Price | Description |
|---|---|---|
GET / |
Free | API discovery + schema |
GET /player/:id |
$0.01 | Player profile + Elo ratings |
GET /matchup |
$0.05 | Head-to-head analysis |
GET /predict |
$0.10 | Match outcome prediction |
GET /tournament/:slug |
$0.25 | Tournament bracket predictions |
GET /edge-finder |
$0.50 | Betting edge detection |
- Match data: Jeff Sackmann / Tennis Abstract (CC-BY-NC-SA 4.0)
- Odds data: The Odds API (free tier, Phase 4)
- Live scores: TBD (Phase 5)
Using xpay.sh (https://facilitator.xpay.sh):
- Free, no API key required
- Supports Base mainnet + Base Sepolia testnet
- Sponsors gas for settlement transactions
- Zero fees for merchants
To switch to CDP Facilitator later (for Bazaar auto-listing + OFAC screening):
- Sign up at cdp.coinbase.com
- Create API key
- Update
FACILITATOR_URLin wrangler.toml
API code: MIT Tennis data: CC-BY-NC-SA 4.0 (per Sackmann's license — commercial use of the raw data requires permission; your derived predictions and Elo ratings as an API service should be reviewed against the license terms)