# shadowghost-hacker/tradingstratergyscreanner architecture

> Architecture diagram of the GitHub repository shadowghost-hacker/tradingstratergyscreanner, 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/shadowghost-hacker/tradingstratergyscreanner
- Repository: https://github.com/shadowghost-hacker/tradingstratergyscreanner

## Overview

StrategyScreener is a web platform for scanning Indian equities, testing trading strategies, and exploring signals on charts. Users choose a stock universe, timeframe, and strategies; the API coordinates market-data retrieval and confluence evaluation, then returns scan results. The backtest workflow separately simulates trades and reports portfolio metrics. The UI also supports strategy editing and AI generation, chart annotations, account verification, and cloud persistence. The graph follows documented capabilities; several API and storage connections are inferred from README descriptions where endpoint implementations were not sampled.

Main entry points: [`app.py`](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/app.py) (FastAPI application), [`scanner_engine.py`](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/scanner_engine.py) (Confluence scanner), [`data_provider.py`](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/data_provider.py) (Market data and universes), [`backtest_engine.py`](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/backtest_engine.py) (Backtest simulator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_frontend["Web interface<br/>[index.html]"]
  node_controller["UI controller<br/>[app.js]"]
  node_chartui["Chart studio<br/>[chart.js]"]
  node_api["FastAPI application<br/>[app.py]"]
end

subgraph group_market["Market analysis"]
  node_scanner["Confluence scanner<br/>[scanner_engine.py]"]
  node_backtest["Backtest simulator<br/>[backtest_engine.py]"]
  node_marketdata["Market data and universes<br/>[data_provider.py]"]
end

subgraph group_strategy["Strategies"]
  node_strategyfiles["Strategy definitions"]
  node_ai["AI strategy generator<br/>[ai_generator.py]"]
end

subgraph group_account["Accounts and storage"]
  node_auth["Authentication<br/>[auth.py]"]
  node_email["OTP email service<br/>[email_service.py]"]
  node_database[("Persistent records<br/>[db.py]")]
end

subgraph group_integrations["External integrations"]
  node_yahoo["Yahoo Finance"]
  node_gemini["Google Gemini"]
  node_tradingview["TradingView charts"]
  node_smtp["SMTP provider"]
end

node_user(("Trader"))

node_user -->|"uses"| node_frontend
node_frontend -->|"loads"| node_controller
node_controller -->|"calls API"| node_api
node_chartui -->|"requests candles"| node_api
node_chartui -->|"embeds charts"| node_tradingview
node_api -->|"runs scans"| node_scanner
node_scanner -->|"fetches OHLCV"| node_marketdata
node_scanner -->|"loads strategies"| node_strategyfiles
node_api -->|"starts simulations"| node_backtest
node_backtest -->|"fetches history"| node_marketdata
node_backtest -->|"evaluates signals"| node_scanner
node_marketdata -->|"fetches prices"| node_yahoo
node_api -->|"serves universes"| node_marketdata
node_api -->|"handles accounts"| node_auth
node_auth -->|"reads and writes"| node_database
node_auth -->|"dispatches OTP"| node_email
node_email -.->|"sends mail"| node_smtp
node_api -->|"stores cloud records"| node_database
node_api -->|"generates strategy code"| node_ai
node_ai -->|"creates strategies"| node_strategyfiles
node_ai -.->|"requests generation"| node_gemini
node_api -->|"saves uploaded code"| node_strategyfiles

click node_frontend "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/static/index.html"
click node_controller "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/static/js/app.js"
click node_chartui "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/static/js/chart.js"
click node_api "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/app.py"
click node_scanner "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/scanner_engine.py"
click node_backtest "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/backtest_engine.py"
click node_marketdata "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/data_provider.py"
click node_strategyfiles "https://github.com/shadowghost-hacker/tradingstratergyscreanner/tree/master/strategies"
click node_ai "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/ai_generator.py"
click node_auth "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/auth.py"
click node_email "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/email_service.py"
click node_database "https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/db.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_frontend,node_controller,node_chartui,node_api toneBlue
class node_scanner,node_backtest,node_marketdata toneAmber
class node_strategyfiles,node_ai toneMint
class node_auth,node_email,node_database toneRose
class node_yahoo,node_gemini,node_tradingview,node_smtp,node_user toneIndigo
```

## Components

### Web experience

- [Web interface](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/static/index.html): `static/index.html`
- [UI controller](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/static/js/app.js): `static/js/app.js`
- [Chart studio](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/static/js/chart.js): `static/js/chart.js`
- [FastAPI application](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/app.py): `app.py`

### Market analysis

- [Confluence scanner](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/scanner_engine.py): `scanner_engine.py`
- [Backtest simulator](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/backtest_engine.py): `backtest_engine.py`
- [Market data and universes](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/data_provider.py): `data_provider.py`

### Strategies

- [Strategy definitions](https://github.com/shadowghost-hacker/tradingstratergyscreanner/tree/master/strategies): `strategies`
- [AI strategy generator](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/ai_generator.py): `ai_generator.py`

### Accounts and storage

- [Authentication](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/auth.py): `auth.py`
- [OTP email service](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/email_service.py): `email_service.py`
- [Persistent records](https://github.com/shadowghost-hacker/tradingstratergyscreanner/blob/master/db.py): `db.py`

### External integrations

- **Yahoo Finance**
- **Google Gemini**
- **TradingView charts**
- **SMTP provider**

### Other components

- **Trader**

## Connections

- Trader → Web interface: uses
- Web interface → UI controller: loads
- UI controller → FastAPI application: calls API
- Chart studio → FastAPI application: requests candles
- Chart studio → TradingView charts: embeds charts
- FastAPI application → Confluence scanner: runs scans
- Confluence scanner → Market data and universes: fetches OHLCV
- Confluence scanner → Strategy definitions: loads strategies
- FastAPI application → Backtest simulator: starts simulations
- Backtest simulator → Market data and universes: fetches history
- Backtest simulator → Confluence scanner: evaluates signals
- Market data and universes → Yahoo Finance: fetches prices
- FastAPI application → Market data and universes: serves universes
- FastAPI application → Authentication: handles accounts
- Authentication → Persistent records: reads and writes
- Authentication → OTP email service: dispatches OTP
- OTP email service → SMTP provider: sends mail
- FastAPI application → Persistent records: stores cloud records
- FastAPI application → AI strategy generator: generates strategy code
- AI strategy generator → Strategy definitions: creates strategies
- AI strategy generator → Google Gemini: requests generation
- FastAPI application → Strategy definitions: saves uploaded code
