# dharmik-solanki-g/indian-stock-market-screener architecture

> Architecture diagram of the GitHub repository dharmik-solanki-g/indian-stock-market-screener, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dharmik-solanki-g/indian-stock-market-screener
- Repository: https://github.com/dharmik-solanki-g/indian-stock-market-screener

## Overview

This is a Streamlit screener for Indian equities, with an interactive workflow that selects a strategy and screening limits, evaluates stocks using historical OHLCV data and technical indicators, then presents matches. A second workflow lets users build strategies visually or convert natural-language descriptions and uploaded documents into validated, editable strategies. The main application and screening logic are concentrated in app.py; AI conversion and validation have separate modules. Relationships for documented but unsampled features are supported by the README, not inferred from filenames.

Main entry points: [`app.py`](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py) (Screen execution), [`ollama_client.py`](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/ollama_client.py) (Ollama client), [`strategies`](https://github.com/dharmik-solanki-g/indian-stock-market-screener/tree/main/strategies) (Strategy files), [`strategy_validator.py`](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/strategy_validator.py) (Strategy validator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_screen["Stock screening"]
  node_app["Streamlit app<br/>[app.py]"]
  node_screen_controls["Screen controls<br/>[app.py]"]
  node_screen_engine["Screen execution<br/>[app.py]"]
  node_indicators["Indicators<br/>[app.py]"]
  node_results["Screen results<br/>[app.py]"]
end

subgraph group_strategy["Strategy management"]
  node_strategy_store[("Strategy files")]
  node_strategy_editor["Visual editor<br/>[app.py]"]
  node_strategy_format["JSON strategies<br/>[app.py]"]
end

subgraph group_ai["AI strategy builder"]
  node_ai_builder["AI builder UI<br/>[app.py]"]
  node_document_input["Document upload<br/>[app.py]"]
  node_ollama_client["Ollama client<br/>[ollama_client.py]"]
  node_ollama["Local Ollama"]
  node_validator["Strategy validator"]
  node_prompt["Conversion prompt"]
end

subgraph group_data["Market data"]
  node_stock_list["NSE stock list<br/>[stocks.csv]"]
  node_ohlcv_cache[("OHLCV cache")]
  node_yahoo["Yahoo Finance"]
end

node_user(("Trader"))

node_user -->|"uses"| node_app
node_app -->|"shows"| node_screen_controls
node_screen_controls -->|"starts screening"| node_screen_engine
node_screen_engine -->|"loads symbols"| node_stock_list
node_screen_engine -->|"reads cached data"| node_ohlcv_cache
node_screen_engine -->|"fetches market data"| node_yahoo
node_screen_engine -->|"evaluates conditions"| node_indicators
node_screen_engine -->|"applies strategy"| node_strategy_format
node_screen_engine -.->|"shows matches"| node_results
node_app -->|"loads strategies"| node_strategy_store
node_strategy_editor -->|"saves strategies"| node_strategy_store
node_strategy_editor -->|"edits JSON"| node_strategy_format
node_user -->|"creates strategy"| node_strategy_editor
node_user -->|"describes strategy"| node_ai_builder
node_user -->|"uploads document"| node_document_input
node_document_input -->|"extracts strategy"| node_ollama_client
node_ai_builder -->|"requests conversion"| node_ollama_client
node_ollama_client -->|"loads prompt"| node_prompt
node_ollama_client -->|"calls generation API"| node_ollama
node_ollama_client -->|"validates strategy"| node_validator
node_ai_builder -->|"previews and saves"| node_strategy_format
node_ai_builder -.->|"runs saved strategy"| node_strategy_editor

click node_app "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_screen_controls "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_screen_engine "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_indicators "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_results "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_stock_list "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/data/stocks.csv"
click node_ohlcv_cache "https://github.com/dharmik-solanki-g/indian-stock-market-screener/tree/main/ohlcv_cache"
click node_strategy_store "https://github.com/dharmik-solanki-g/indian-stock-market-screener/tree/main/strategies"
click node_strategy_editor "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_strategy_format "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_ai_builder "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_document_input "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py"
click node_ollama_client "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/ollama_client.py"
click node_validator "https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/strategy_validator.py"
click node_prompt "https://github.com/dharmik-solanki-g/indian-stock-market-screener/tree/main/prompts"

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_screen_controls,node_screen_engine,node_indicators,node_results toneBlue
class node_strategy_store,node_strategy_editor,node_strategy_format toneAmber
class node_ai_builder,node_document_input,node_ollama_client,node_ollama,node_validator,node_prompt toneMint
class node_stock_list,node_ohlcv_cache,node_yahoo toneRose
class node_user toneIndigo
```

## Components

### Stock screening

- [Streamlit app](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`
- [Screen controls](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`
- [Screen execution](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`
- [Indicators](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`
- [Screen results](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`

### Strategy management

- [Strategy files](https://github.com/dharmik-solanki-g/indian-stock-market-screener/tree/main/strategies): `strategies`
- [Visual editor](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`
- [JSON strategies](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`

### AI strategy builder

- [AI builder UI](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`
- [Document upload](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/app.py): `app.py`
- [Ollama client](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/ollama_client.py): `ollama_client.py`
- **Local Ollama**
- [Strategy validator](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/strategy_validator.py): `strategy_validator.py`
- [Conversion prompt](https://github.com/dharmik-solanki-g/indian-stock-market-screener/tree/main/prompts): `prompts`

### Market data

- [NSE stock list](https://github.com/dharmik-solanki-g/indian-stock-market-screener/blob/main/data/stocks.csv): `data/stocks.csv`
- [OHLCV cache](https://github.com/dharmik-solanki-g/indian-stock-market-screener/tree/main/ohlcv_cache): `ohlcv_cache`
- **Yahoo Finance**

### Other components

- **Trader**

## Connections

- Trader → Streamlit app: uses (evidence: `README.md`)
- Streamlit app → Screen controls: shows (evidence: `README.md`)
- Screen controls → Screen execution: starts screening (evidence: `README.md`)
- Screen execution → NSE stock list: loads symbols (evidence: `README.md`)
- Screen execution → OHLCV cache: reads cached data (evidence: `README.md`)
- Screen execution → Yahoo Finance: fetches market data (evidence: `README.md`)
- Screen execution → Indicators: evaluates conditions (evidence: `app.py`)
- Screen execution → JSON strategies: applies strategy (evidence: `README.md`)
- Screen execution → Screen results: shows matches (evidence: `app.py`)
- Streamlit app → Strategy files: loads strategies (evidence: `app.py`)
- Visual editor → Strategy files: saves strategies (evidence: `app.py`)
- Visual editor → JSON strategies: edits JSON (evidence: `README.md`)
- Trader → Visual editor: creates strategy (evidence: `README.md`)
- Trader → AI builder UI: describes strategy (evidence: `README.md`)
- Trader → Document upload: uploads document (evidence: `README.md`)
- Document upload → Ollama client: extracts strategy (evidence: `README.md`)
- AI builder UI → Ollama client: requests conversion (evidence: `README.md`)
- Ollama client → Conversion prompt: loads prompt (evidence: `README.md`)
- Ollama client → Local Ollama: calls generation API (evidence: `ollama_client.py`)
- Ollama client → Strategy validator: validates strategy (evidence: `ollama_client.py`)
- AI builder UI → JSON strategies: previews and saves (evidence: `README.md`)
- AI builder UI → Visual editor: runs saved strategy (evidence: `app.py`)
