尚未检测到更新。GitHub 发布版本后会显示在这里。
Simulate a simple betting strategy for NBA games (2016-17 to 2025-26 seasons).
翻译准备中
正在加载完整 README。
查看完整 README ↗Simulates a simple NBA betting strategy against historical moneyline odds: pick a team, season, prediction direction (bet on win vs. bet on loss), and wager size, and see what the season result would have been.
Status: no longer updated with new seasons. The web app and the dashboard both still work, with the 2016-17 through 2025-26 regular seasons (11,979 games).
Shipped two ways:
| Link | Stack | |
|---|---|---|
| Tableau dashboard | public.tableau.com/…/NBAMoneyline | Tableau Public — parameter-driven calculated fields, a running-total table calc, a favorite/underdog breakdown |
| Web app | nba-moneyline.vercel.app | Node/Express + PostgreSQL + vanilla JS, deployed on Vercel |
Both are fed by the same Python/Selenium data pipeline (data/). The rest of this README covers the web app; see Tableau dashboard below for that version.
The web app lets a user choose a team, season, prediction direction (bet on win vs bet on loss), and wager size, then computes what the season result would have been. It combines:
pg)app/
routes/
resultSummary.js # /api/result-summary
topBets.js # /api/top-bets
utils/
createQueryRoute.js # Shared API route factory
parseSQL.js # Loads SQL files from disk
dbConfig.js # Shared PG pool
queries/
resultSummary.sql
topBets.sql
public/
index.html
js/
api/ # Fetch + response adapters
events/ # Submit/interaction orchestration
view/ # Result rendering
data/
main.py # The whole pipeline: extract, transform, load
extract/ # Step 1: OddsPortal (odds) + basketball-reference (schedule), then checks
transform/ # Step 2: one dated record per game
load/ # Step 3: load into production, update frontend
util/ # Shared data model, constants, and output formatting
tests/ # pytest suite, mirroring the folders above
sample_queries.sql # SQL for inspecting the database by hand
README.md # Setup, adding a season, the database, troubleshooting
tableau/
NBA Moneyline.twbx # Published Tableau Public workbook
games.csv # Data export the workbook reads
POST /api/result-summary
season_start_year, team, prediction, wagerPOST /api/top-bets
Requires Node 24 (pinned in .nvmrc; fnm switches to it automatically).
npm install
Create .env.development.local in the project root:
POSTGRES_URL=postgres://username:password@host/database
npm run dev
App runs at http://localhost:3000.
npm start # Production-style local start
npm run dev # Development with nodemon
npm run sync-env
The data/ directory contains the ingestion flow that collected each season:
teams, one row per game in games, and a
team_games view the app reads) in one all-or-nothing transaction, only with
all checks passing or an explicit override; the tables' constraints reject bad
rows too - then update the web app's season optionsSee data/README.md for setup, how a season is added, and troubleshooting.
tableau/NBA Moneyline.twbx is the published workbook
(Tableau Public) —
a data-analyst-portfolio rebuild of the same simulator.
以上为 README 的开头部分。其余内容请阅读原文。 查看完整 README ↗