# omondi-je/football-stock-exchange architecture

> Architecture diagram of the GitHub repository omondi-je/football-stock-exchange, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/omondi-je/football-stock-exchange
- Repository: https://github.com/omondi-je/football-stock-exchange

## Overview

Football Stock Exchange is a browser-based World Cup market simulator. A user opens the app, which initializes simulated team prices and a live match; match results update prices and indices. Users can inspect team analytics, forecasts and market-risk views, and trade through a portfolio whose holdings and audit trail persist in browser storage. The README documents additional analytics capabilities; the sampled code confirms many view implementations, but does not expose every route or dispatch call, so uncertain view wiring is omitted.

Main entry points: [`js/app.js`](https://github.com/omondi-je/football-stock-exchange/blob/main/js/app.js) (App & Match Loop), [`js/portfolio.js`](https://github.com/omondi-je/football-stock-exchange/blob/main/js/portfolio.js) (Portfolio State), [`js/data.js`](https://github.com/omondi-je/football-stock-exchange/blob/main/js/data.js) (Match & Pricing Engine), [`js/predictions.js`](https://github.com/omondi-je/football-stock-exchange/blob/main/js/predictions.js) (Match Predictions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Market Runtime"]
  node_app["App &amp; Match Loop<br/>[app.js]"]
  node_marketdata["Match &amp; Pricing Engine<br/>[data.js]"]
end

subgraph group_trading["Portfolio &amp; Trading"]
  node_portfolio["Portfolio State<br/>[portfolio.js]"]
  node_storage[("Browser Storage")]
  node_tradehistory["Trade Audit View<br/>[trade-history.js]"]
end

subgraph group_analytics["Market Analytics"]
  node_indices["Market Indices<br/>[indices-view.js]"]
  node_volatility["Volatility Lab<br/>[volatility.js]"]
  node_correlations["Correlation Matrix<br/>[correlations.js]"]
  node_predictions["Match Predictions<br/>[predictions.js]"]
end

subgraph group_engagement["Team Discovery"]
  node_teamdetail["Team Detail<br/>[team-detail.js]"]
  node_watchlist["Team Watchlist<br/>[watchlist.js]"]
end

node_user(("Browser User"))

node_user -->|"uses"| node_app
node_app -->|"simulates matches"| node_marketdata
node_app -->|"calculates price impact"| node_marketdata
node_app -->|"executes trades"| node_portfolio
node_portfolio -->|"persists state"| node_storage
node_app -->|"renders view"| node_indices
node_app -->|"renders view"| node_volatility
node_app -->|"renders view"| node_correlations
node_app -->|"renders view"| node_predictions
node_predictions -->|"uses Elo model"| node_marketdata
node_app -->|"renders view"| node_teamdetail
node_app -->|"renders view"| node_watchlist
node_watchlist -->|"persists favorites"| node_storage
node_tradehistory -->|"reads trades"| node_portfolio

click node_app "https://github.com/omondi-je/football-stock-exchange/blob/main/js/app.js"
click node_marketdata "https://github.com/omondi-je/football-stock-exchange/blob/main/js/data.js"
click node_portfolio "https://github.com/omondi-je/football-stock-exchange/blob/main/js/portfolio.js"
click node_tradehistory "https://github.com/omondi-je/football-stock-exchange/blob/main/js/trade-history.js"
click node_indices "https://github.com/omondi-je/football-stock-exchange/blob/main/js/indices-view.js"
click node_volatility "https://github.com/omondi-je/football-stock-exchange/blob/main/js/volatility.js"
click node_correlations "https://github.com/omondi-je/football-stock-exchange/blob/main/js/correlations.js"
click node_predictions "https://github.com/omondi-je/football-stock-exchange/blob/main/js/predictions.js"
click node_teamdetail "https://github.com/omondi-je/football-stock-exchange/blob/main/js/team-detail.js"
click node_watchlist "https://github.com/omondi-je/football-stock-exchange/blob/main/js/watchlist.js"

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_app,node_marketdata,node_user toneBlue
class node_portfolio,node_storage,node_tradehistory toneAmber
class node_indices,node_volatility,node_correlations,node_predictions toneMint
class node_teamdetail,node_watchlist toneRose
```

## Components

### Market Runtime

- [App & Match Loop](https://github.com/omondi-je/football-stock-exchange/blob/main/js/app.js): `js/app.js`
- [Match & Pricing Engine](https://github.com/omondi-je/football-stock-exchange/blob/main/js/data.js): `js/data.js`

### Portfolio & Trading

- [Portfolio State](https://github.com/omondi-je/football-stock-exchange/blob/main/js/portfolio.js): `js/portfolio.js`
- **Browser Storage**
- [Trade Audit View](https://github.com/omondi-je/football-stock-exchange/blob/main/js/trade-history.js): `js/trade-history.js`

### Market Analytics

- [Market Indices](https://github.com/omondi-je/football-stock-exchange/blob/main/js/indices-view.js): `js/indices-view.js`
- [Volatility Lab](https://github.com/omondi-je/football-stock-exchange/blob/main/js/volatility.js): `js/volatility.js`
- [Correlation Matrix](https://github.com/omondi-je/football-stock-exchange/blob/main/js/correlations.js): `js/correlations.js`
- [Match Predictions](https://github.com/omondi-je/football-stock-exchange/blob/main/js/predictions.js): `js/predictions.js`

### Team Discovery

- [Team Detail](https://github.com/omondi-je/football-stock-exchange/blob/main/js/team-detail.js): `js/team-detail.js`
- [Team Watchlist](https://github.com/omondi-je/football-stock-exchange/blob/main/js/watchlist.js): `js/watchlist.js`

### Other components

- **Browser User**

## Connections

- Browser User → App & Match Loop: uses (evidence: `README.md`)
- App & Match Loop → Match & Pricing Engine: simulates matches (evidence: `js/app.js`)
- App & Match Loop → Match & Pricing Engine: calculates price impact (evidence: `js/app.js`)
- App & Match Loop → Portfolio State: executes trades (evidence: `js/app.js`)
- Portfolio State → Browser Storage: persists state (evidence: `js/portfolio.js`)
- App & Match Loop → Market Indices: renders view (evidence: `js/app.js`)
- App & Match Loop → Volatility Lab: renders view (evidence: `js/app.js`)
- App & Match Loop → Correlation Matrix: renders view (evidence: `js/app.js`)
- App & Match Loop → Match Predictions: renders view (evidence: `js/app.js`)
- Match Predictions → Match & Pricing Engine: uses Elo model (evidence: `js/predictions.js`)
- App & Match Loop → Team Detail: renders view (evidence: `js/app.js`)
- App & Match Loop → Team Watchlist: renders view (evidence: `js/app.js`)
- Team Watchlist → Browser Storage: persists favorites (evidence: `js/watchlist.js`)
- Trade Audit View → Portfolio State: reads trades (evidence: `js/trade-history.js`)
