# km-art/egypt-stock-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/km-art/egypt-stock-analyzer
- Repository: https://github.com/km-art/egypt-stock-analyzer

## Overview

Eagle is a Streamlit decision-support tool for technical and financial analysis across Egyptian, US, and UAE equities, plus global assets. Its principal workflow is a user-requested analysis in the live app, using shared scoring logic and optional price-behavior context to present a decision; the app also offers market screening, portfolio views, global-asset analysis, and sector history. Backtesting and the separate EGX screener are additional capabilities. Relationships below are limited to README statements and shown imports; unsampled implementation details are not inferred.

Main entry points: [`final_bot.py`](https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py) (Live app), [`sector_historical_archive.py`](https://github.com/km-art/egypt-stock-analyzer/blob/main/sector_historical_archive.py) (Sector archive), [`egx_screener_app.py`](https://github.com/km-art/egypt-stock-analyzer/blob/main/egx_screener_app.py) (Screener app), [`egx_screener.py`](https://github.com/km-art/egypt-stock-analyzer/blob/main/egx_screener.py) (Screening engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_live["Live analysis"]
  node_live_app["Live app<br/>[final_bot.py]"]
  node_stock_check["Stock analysis<br/>[final_bot.py]"]
  node_market_scan["Market scan<br/>[final_bot.py]"]
  node_portfolio["Portfolio view<br/>[final_bot.py]"]
  node_global_assets["Global assets<br/>[final_bot.py]"]
end

subgraph group_engines["Analysis engines"]
  node_score_engine["Score and decision<br/>[eagle_core.py]"]
  node_price_context["Price behavior"]
end

subgraph group_history["Historical analysis"]
  node_sector_archive["Sector archive"]
  node_historical_analyzer["Seasonality analysis"]
  node_market_data(("Market data"))
end

subgraph group_screener["EGX screener"]
  node_screener_ui["Screener app"]
  node_screener_engine["Screening engine<br/>[egx_screener.py]"]
  node_data_providers["Data providers<br/>[data_providers.py]"]
end

subgraph group_validation["Backtesting"]
  node_backtest["Backtest engine<br/>[backtest_engine.py]"]
end

node_investor(("Investor"))

node_investor -->|"uses"| node_live_app
node_live_app -->|"imports shared logic"| node_score_engine
node_live_app -->|"imports context"| node_price_context
node_live_app -->|"imports archive"| node_sector_archive
node_backtest -->|"imports shared logic"| node_score_engine
node_sector_archive -->|"reuses analysis"| node_historical_analyzer
node_investor -.->|"uses"| node_screener_ui
node_screener_ui -->|"calls screener"| node_screener_engine
node_screener_engine -->|"uses providers"| node_data_providers
node_market_data -.->|"supplies price history"| node_sector_archive
node_market_data -->|"supplies price history"| node_historical_analyzer

click node_live_app "https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py"
click node_stock_check "https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py"
click node_market_scan "https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py"
click node_portfolio "https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py"
click node_global_assets "https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py"
click node_score_engine "https://github.com/km-art/egypt-stock-analyzer/blob/main/eagle_core.py"
click node_price_context "https://github.com/km-art/egypt-stock-analyzer/blob/main/price_behavior_engine.py"
click node_sector_archive "https://github.com/km-art/egypt-stock-analyzer/blob/main/sector_historical_archive.py"
click node_historical_analyzer "https://github.com/km-art/egypt-stock-analyzer/blob/main/egx_historical_analyzer.py"
click node_screener_ui "https://github.com/km-art/egypt-stock-analyzer/blob/main/egx_screener_app.py"
click node_screener_engine "https://github.com/km-art/egypt-stock-analyzer/blob/main/egx_screener.py"
click node_data_providers "https://github.com/km-art/egypt-stock-analyzer/blob/main/data_providers.py"
click node_backtest "https://github.com/km-art/egypt-stock-analyzer/blob/main/backtest_engine.py"

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_live_app,node_stock_check,node_market_scan,node_portfolio,node_global_assets toneBlue
class node_score_engine,node_price_context toneAmber
class node_sector_archive,node_historical_analyzer,node_market_data toneMint
class node_screener_ui,node_screener_engine,node_data_providers toneRose
class node_backtest,node_investor toneIndigo
```

## Components

### Live analysis

- [Live app](https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py): `final_bot.py`
- [Stock analysis](https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py): `final_bot.py`
- [Market scan](https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py): `final_bot.py`
- [Portfolio view](https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py): `final_bot.py`
- [Global assets](https://github.com/km-art/egypt-stock-analyzer/blob/main/final_bot.py): `final_bot.py`

### Analysis engines

- [Score and decision](https://github.com/km-art/egypt-stock-analyzer/blob/main/eagle_core.py): `eagle_core.py`
- [Price behavior](https://github.com/km-art/egypt-stock-analyzer/blob/main/price_behavior_engine.py): `price_behavior_engine.py`

### Historical analysis

- [Sector archive](https://github.com/km-art/egypt-stock-analyzer/blob/main/sector_historical_archive.py): `sector_historical_archive.py`
- [Seasonality analysis](https://github.com/km-art/egypt-stock-analyzer/blob/main/egx_historical_analyzer.py): `egx_historical_analyzer.py`
- **Market data**

### EGX screener

- [Screener app](https://github.com/km-art/egypt-stock-analyzer/blob/main/egx_screener_app.py): `egx_screener_app.py`
- [Screening engine](https://github.com/km-art/egypt-stock-analyzer/blob/main/egx_screener.py): `egx_screener.py`
- [Data providers](https://github.com/km-art/egypt-stock-analyzer/blob/main/data_providers.py): `data_providers.py`

### Backtesting

- [Backtest engine](https://github.com/km-art/egypt-stock-analyzer/blob/main/backtest_engine.py): `backtest_engine.py`

### Other components

- **Investor**

## Connections

- Investor → Live app: uses (evidence: `README.md`)
- Live app → Score and decision: imports shared logic (evidence: `final_bot.py`)
- Live app → Price behavior: imports context (evidence: `final_bot.py`)
- Live app → Sector archive: imports archive (evidence: `final_bot.py`)
- Backtest engine → Score and decision: imports shared logic (evidence: `backtest_engine.py`)
- Sector archive → Seasonality analysis: reuses analysis (evidence: `sector_historical_archive.py`)
- Investor → Screener app: uses (evidence: `README.md`)
- Screener app → Screening engine: calls screener (evidence: `egx_screener_app.py`)
- Screening engine → Data providers: uses providers (evidence: `egx_screener.py`)
- Market data → Sector archive: supplies price history (evidence: `README.md`)
- Market data → Seasonality analysis: supplies price history (evidence: `egx_historical_analyzer.py`)
