
Life & Journey
Oin - an online Sports Betting Platform
2024-12-24
Github
1. System Analysis
-
Objective: Create an online NBA betting system named Oin.
-
Users:
- User: Regular bettors who can deposit money, place bets, update/cancel bets, and check results.
- Admin: Operators who update odds, settle games, and manage user bet records.
2. System Functions
User Functions
- View season rankings (current + past 10 seasons).
- View personal account info and bet history.
- Check match details, betting options, and odds.
- Search games by date.
- Deposit money and place bets.
- Update personal info and cancel bets before matches start.
Admin Functions
- Query top 5 ROI users.
- View all bets placed on a specific day.
- Open/close betting options by setting odds.
- Settle games and update balances automatically.
System Commands
- Update odds.
- Update game scores.
- Add new games.
3. System Design
- ER Diagram: 8 entities + 1 weak entity (e.g., Gambler, Game, Bet Odds, Stadium, Season, Team).
- Relational Schema: 10 tables (GAMBLER, CASHFLOW_RECORD, GAMBLER_BETS, BET_ODDS_RECORD, etc.).
- Normalization: Schema satisfies 1NF → 4NF (no partial, transitive, or multi-valued dependencies).
4. System Implementation
-
Data Sources: NBA data from Kaggle (games, seasons, teams, stadiums); synthetic data for bets, odds, and cashflows.
-
SQL Functions:
- Users: place/cancel bets, query games, view odds, check standings.
- Admin: open bets, settle results, query top users.
- System: update odds, scores, and add matches.
-
Optimization: Indexing
home_team_idandaway_team_idimproved query efficiency for past match history. -
Transaction Management: Each insert/update wrapped in transaction with
commit/rollback. -
Concurrency Control: Not required since bets are independent and only open games are available.
5. Reflections
- Building a database system gave strong sense of achievement.
- Required careful planning to avoid cascading errors.
- Learned practical skills beneficial for future system development.
Share...