# sedemmler/wagerbrain architecture

> Architecture diagram of the GitHub repository sedemmler/wagerbrain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sedemmler/wagerbrain
- Repository: https://github.com/sedemmler/wagerbrain

## Overview

WagerBrain is a Python sports-betting calculation library with optional data scrapers and bundled historical datasets. A user supplies odds, probabilities, or data to its independent functions; the package converts odds and computes payouts, expected value, bookmaker costs, arbitrage, and bankroll sizing. The README also describes value-bet analysis and scraping capabilities. Edges among calculation modules are based on imports and calls visible in the supplied source index and excerpts; the bundled datasets' consumers were not sampled, so no usage links are inferred.

Main entry points: [`WagerBrain/probs.py`](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/probs.py) (Probabilities and EV), [`WagerBrain/odds.py`](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/odds.py) (Odds conversion), [`WagerBrain/strats/arb.py`](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/strats/arb.py) (Arbitrage evaluator), [`WagerBrain/data/scraper.py`](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/scraper.py) (Sports data scrapers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_odds_math["Odds and math"]
  node_odds["Odds conversion<br/>[odds.py]"]
  node_payouts["Payouts and profit<br/>[payouts.py]"]
  node_probabilities["Probabilities and EV<br/>[probs.py]"]
  node_market_costs["Market costs<br/>[utils.py]"]
end

subgraph group_betting_strategies["Betting strategies"]
  node_bankroll["Bankroll sizing<br/>[bankroll.py]"]
  node_arbitrage["Arbitrage evaluator<br/>[arb.py]"]
  node_value_bets["Value strategies<br/>[value.py]"]
end

subgraph group_data_collection["Data collection"]
  node_scraper["Sports data scrapers<br/>[scraper.py]"]
end

subgraph group_historical_data["Historical data"]
  node_mlb_odds_data["MLB odds CSV"]
  node_nba_odds_data["NBA odds CSV"]
  node_nfl_odds_data["NFL odds CSV"]
  node_mlb_team_data[("MLB team database")]
  node_nba_team_data[("NBA team database")]
  node_nfl_team_data[("NFL team database")]
  node_nhl_team_data[("NHL team database")]
end

node_user(("Package user"))
node_kenpom["KenPom site"]
node_basketball_reference["Basketball Reference"]

node_user -->|"converts odds"| node_odds
node_user -->|"calculates payouts"| node_payouts
node_user -->|"evaluates bets"| node_probabilities
node_user -->|"calculates costs"| node_market_costs
node_user -->|"sizes wagers"| node_bankroll
node_user -->|"checks arbitrage"| node_arbitrage
node_user -->|"evaluates strategies"| node_value_bets
node_user -->|"requests data"| node_scraper
node_payouts -->|"calculates parlays"| node_odds
node_probabilities -->|"uses payout math"| node_payouts
node_probabilities -->|"converts odds"| node_odds
node_probabilities -->|"uses break-even"| node_market_costs
node_bankroll -->|"normalizes odds"| node_odds
node_arbitrage -->|"derives probabilities"| node_probabilities
node_arbitrage -->|"normalizes odds"| node_odds
node_value_bets -->|"converts win rates"| node_probabilities
node_scraper -->|"fetches rankings"| node_kenpom
node_scraper -->|"fetches statistics"| node_basketball_reference

click node_odds "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/odds.py"
click node_payouts "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/payouts.py"
click node_probabilities "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/probs.py"
click node_market_costs "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/utils.py"
click node_bankroll "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/bankroll.py"
click node_arbitrage "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/strats/arb.py"
click node_value_bets "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/strats/value.py"
click node_scraper "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/scraper.py"
click node_mlb_odds_data "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/MLB%20Odds%20Complete.csv"
click node_nba_odds_data "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/NBA%20Odds%20Complete.csv"
click node_nfl_odds_data "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/NFL%20Odds%20Complete.csv"
click node_mlb_team_data "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/mlb_team_data_1970_2014.db"
click node_nba_team_data "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/nba_team_data_1980_2014.db"
click node_nfl_team_data "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/nfl_team_data_2000_2015.db"
click node_nhl_team_data "https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/nhl_team_data_2006_2015.db"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_odds,node_payouts,node_probabilities,node_market_costs,node_user toneBlue
class node_bankroll,node_arbitrage,node_value_bets toneAmber
class node_scraper toneMint
class node_mlb_odds_data,node_nba_odds_data,node_nfl_odds_data,node_mlb_team_data,node_nba_team_data,node_nfl_team_data,node_nhl_team_data toneRose
class node_kenpom,node_basketball_reference toneIndigo
```

## Components

### Odds and math

- [Odds conversion](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/odds.py): `WagerBrain/odds.py`
- [Payouts and profit](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/payouts.py): `WagerBrain/payouts.py`
- [Probabilities and EV](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/probs.py): `WagerBrain/probs.py`
- [Market costs](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/utils.py): `WagerBrain/utils.py`

### Betting strategies

- [Bankroll sizing](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/bankroll.py): `WagerBrain/bankroll.py`
- [Arbitrage evaluator](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/strats/arb.py): `WagerBrain/strats/arb.py`
- [Value strategies](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/strats/value.py): `WagerBrain/strats/value.py`

### Data collection

- [Sports data scrapers](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/scraper.py): `WagerBrain/data/scraper.py`

### Historical data

- [MLB odds CSV](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/MLB%20Odds%20Complete.csv): `WagerBrain/data/MLB Odds Complete.csv`
- [NBA odds CSV](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/NBA%20Odds%20Complete.csv): `WagerBrain/data/NBA Odds Complete.csv`
- [NFL odds CSV](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/NFL%20Odds%20Complete.csv): `WagerBrain/data/NFL Odds Complete.csv`
- [MLB team database](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/mlb_team_data_1970_2014.db): `WagerBrain/data/mlb_team_data_1970_2014.db`
- [NBA team database](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/nba_team_data_1980_2014.db): `WagerBrain/data/nba_team_data_1980_2014.db`
- [NFL team database](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/nfl_team_data_2000_2015.db): `WagerBrain/data/nfl_team_data_2000_2015.db`
- [NHL team database](https://github.com/sedemmler/wagerbrain/blob/master/WagerBrain/data/nhl_team_data_2006_2015.db): `WagerBrain/data/nhl_team_data_2006_2015.db`

### Other components

- **Package user**
- **KenPom site**
- **Basketball Reference**

## Connections

- Package user → Odds conversion: converts odds (evidence: `README.md`)
- Package user → Payouts and profit: calculates payouts (evidence: `README.md`)
- Package user → Probabilities and EV: evaluates bets (evidence: `README.md`)
- Package user → Market costs: calculates costs (evidence: `README.md`)
- Package user → Bankroll sizing: sizes wagers (evidence: `README.md`)
- Package user → Arbitrage evaluator: checks arbitrage (evidence: `README.md`)
- Package user → Value strategies: evaluates strategies (evidence: `README.md`)
- Package user → Sports data scrapers: requests data (evidence: `README.md`)
- Payouts and profit → Odds conversion: calculates parlays (evidence: `WagerBrain/payouts.py`)
- Probabilities and EV → Payouts and profit: uses payout math (evidence: `WagerBrain/probs.py`)
- Probabilities and EV → Odds conversion: converts odds (evidence: `WagerBrain/probs.py`)
- Probabilities and EV → Market costs: uses break-even (evidence: `WagerBrain/probs.py`)
- Bankroll sizing → Odds conversion: normalizes odds (evidence: `WagerBrain/bankroll.py`)
- Arbitrage evaluator → Probabilities and EV: derives probabilities (evidence: `WagerBrain/strats/arb.py`)
- Arbitrage evaluator → Odds conversion: normalizes odds (evidence: `WagerBrain/strats/arb.py`)
- Value strategies → Probabilities and EV: converts win rates (evidence: `WagerBrain/strats/value.py`)
- Sports data scrapers → KenPom site: fetches rankings (evidence: `WagerBrain/data/scraper.py`)
- Sports data scrapers → Basketball Reference: fetches statistics (evidence: `WagerBrain/data/scraper.py`)
