# muhammadburaq123-cmyk/bmi architecture

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

- Interactive diagram: https://gitdiagram.com/muhammadburaq123-cmyk/bmi
- Repository: https://github.com/muhammadburaq123-cmyk/bmi

## Overview

BMI is a live market-monitoring and intelligence dashboard for XAUUSD, not an order-execution system. Its principal workflow is to load historical candle data, update timeframe analyses from MetaTrader 5, publish engine state for the dashboard, and send qualifying opportunity alerts. The README only names the project; the supplied source excerpts establish the runtime links, while the `core` implementation and dashboard markup were not included.

Main entry points: [`live_runner.py`](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/live_runner.py) (Live Runner), [`dashboard_server.py`](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/dashboard_server.py) (Dashboard Server), [`alerts.py`](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/alerts.py) (Alert Manager), [`dashboard.html`](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/dashboard.html) (Dashboard Page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_market["Market Data"]
  node_csv[("Candle CSVs")]
  node_loader["CSV Loader"]
  node_runner["Live Runner<br/>[live_runner.py]"]
end

subgraph group_analysis["Analysis"]
  node_engine["Engine State"]
  node_statefile[("Engine State JSON")]
end

subgraph group_delivery["Dashboard"]
  node_server["Dashboard Server"]
  node_page["Dashboard Page<br/>[dashboard.html]"]
end

subgraph group_alerts["Alerts"]
  node_alertsmanager["Alert Manager<br/>[alerts.py]"]
  node_config["Alert Config<br/>[config.py]"]
end

node_operator(("Operator"))
node_mt5["MetaTrader 5"]
node_discord["Discord Webhook"]
node_telegram["Telegram API"]
node_browser(("Dashboard Client"))

node_operator -->|"starts"| node_runner
node_operator -->|"opens"| node_server
node_runner -->|"fetches candles"| node_mt5
node_mt5 -->|"returns rates"| node_runner
node_runner -->|"loads history"| node_loader
node_loader -->|"reads"| node_csv
node_runner -->|"updates candles"| node_engine
node_runner -->|"appends candles"| node_csv
node_runner -->|"reads analysis"| node_engine
node_runner -->|"writes state"| node_statefile
node_server -->|"reads state"| node_statefile
node_server -->|"serves"| node_page
node_browser -->|"requests state"| node_server
node_server -->|"emits updates"| node_browser
node_runner -->|"checks opportunities"| node_alertsmanager
node_alertsmanager -->|"reads settings"| node_config
node_alertsmanager -->|"posts alerts"| node_discord
node_alertsmanager -.->|"sends status"| node_telegram

click node_runner "https://github.com/muhammadburaq123-cmyk/bmi/blob/main/live_runner.py"
click node_alertsmanager "https://github.com/muhammadburaq123-cmyk/bmi/blob/main/alerts.py"
click node_config "https://github.com/muhammadburaq123-cmyk/bmi/blob/main/config.py"
click node_server "https://github.com/muhammadburaq123-cmyk/bmi/blob/main/dashboard_server.py"
click node_page "https://github.com/muhammadburaq123-cmyk/bmi/blob/main/dashboard.html"

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_csv,node_loader,node_runner,node_browser toneBlue
class node_engine,node_statefile toneAmber
class node_server,node_page,node_discord,node_telegram toneMint
class node_alertsmanager,node_config toneRose
class node_operator,node_mt5 toneIndigo
```

## Components

### Market Data

- **Candle CSVs**
- **CSV Loader**
- [Live Runner](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/live_runner.py): `live_runner.py`

### Analysis

- **Engine State**
- **Engine State JSON**

### Dashboard

- [Dashboard Server](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/dashboard_server.py): `dashboard_server.py`
- [Dashboard Page](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/dashboard.html): `dashboard.html`

### Alerts

- [Alert Manager](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/alerts.py): `alerts.py`
- [Alert Config](https://github.com/muhammadburaq123-cmyk/bmi/blob/main/config.py): `config.py`

### Other components

- **Operator**
- **MetaTrader 5**
- **Discord Webhook**
- **Telegram API**
- **Dashboard Client**

## Connections

- Operator → Live Runner: starts
- Operator → Dashboard Server: opens
- Live Runner → MetaTrader 5: fetches candles
- MetaTrader 5 → Live Runner: returns rates
- Live Runner → CSV Loader: loads history
- CSV Loader → Candle CSVs: reads
- Live Runner → Engine State: updates candles
- Live Runner → Candle CSVs: appends candles
- Live Runner → Engine State: reads analysis
- Live Runner → Engine State JSON: writes state
- Dashboard Server → Engine State JSON: reads state
- Dashboard Server → Dashboard Page: serves
- Dashboard Client → Dashboard Server: requests state
- Dashboard Server → Dashboard Client: emits updates
- Live Runner → Alert Manager: checks opportunities
- Alert Manager → Alert Config: reads settings
- Alert Manager → Discord Webhook: posts alerts
- Alert Manager → Telegram API: sends status
