# chris5992/niftyscalpingbot architecture

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

- Interactive diagram: https://gitdiagram.com/chris5992/niftyscalpingbot
- Repository: https://github.com/chris5992/niftyscalpingbot

## Overview

This is a Streamlit NIFTY intraday strategy research dashboard. Its main flow loads and cleans five-minute CSV bars, engineers features and market regimes, generates walk-forward ML signals, simulates risk-sized trades, and presents performance analysis. Additional dashboard branches cover replay, volatility analytics, regime reporting, Monte Carlo simulation, and robustness testing. The README documents all nine dashboard areas; several modules were not excerpted, so their existence and capability are represented, but unshown internal calls are omitted.

Main entry points: [`app/main.py`](https://github.com/chris5992/niftyscalpingbot/blob/main/app/main.py) (Dashboard UI), [`app/data_loader.py`](https://github.com/chris5992/niftyscalpingbot/blob/main/app/data_loader.py) (Data Cleaning), [`app/strategy.py`](https://github.com/chris5992/niftyscalpingbot/blob/main/app/strategy.py) (Feature Engineering), [`FINAL_NIFTY_MASTER_ATM_5min.csv`](https://github.com/chris5992/niftyscalpingbot/blob/main/FINAL_NIFTY_MASTER_ATM_5min.csv) (NIFTY Bars CSV)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_streamlit["Dashboard UI<br/>[main.py]"]
end

subgraph group_strategy["Strategy Pipeline"]
  node_loader["Data Cleaning<br/>[data_loader.py]"]
  node_features["Feature Engineering<br/>[strategy.py]"]
  node_ml["Walk-Forward ML<br/>[strategy.py]"]
  node_backtest["Trade Backtest<br/>[strategy.py]"]
  node_cache[("ML Cache<br/>[ml_cache.pkl]")]
end

subgraph group_analysis["Research Analytics"]
  node_metrics["Performance Metrics<br/>[metrics.py]"]
  node_plots["Charts<br/>[plots.py]"]
  node_replay["Day Replay<br/>[trade_replay.py]"]
  node_regimes["Regime Analysis<br/>[regime_analysis.py]"]
  node_iv["Volatility Analytics<br/>[iv_analytics.py]"]
  node_montecarlo["Monte Carlo<br/>[monte_carlo.py]"]
  node_robustness["Robustness Tests<br/>[robustness.py]"]
end

subgraph group_settings["Configuration"]
  node_config["Strategy Settings<br/>[config.py]"]
end

node_user(("Researcher"))
node_csv["NIFTY Bars CSV"]

node_user -->|"uses"| node_streamlit
node_csv -->|"loads"| node_loader
node_streamlit -->|"loads data"| node_loader
node_loader -.->|"cleaned bars"| node_features
node_streamlit -->|"engineers features"| node_features
node_features -.->|"feature data"| node_ml
node_streamlit -->|"trains or loads"| node_ml
node_ml -.->|"reads or writes"| node_cache
node_streamlit -->|"runs backtest"| node_backtest
node_backtest -->|"trade results"| node_metrics
node_streamlit -->|"gets settings"| node_config
node_streamlit -->|"renders charts"| node_plots
node_streamlit -->|"requests day data"| node_replay
node_streamlit -->|"shows analysis"| node_regimes
node_streamlit -->|"shows analytics"| node_iv
node_streamlit -->|"runs simulation"| node_montecarlo
node_streamlit -->|"runs tests"| node_robustness

click node_streamlit "https://github.com/chris5992/niftyscalpingbot/blob/main/app/main.py"
click node_csv "https://github.com/chris5992/niftyscalpingbot/blob/main/FINAL_NIFTY_MASTER_ATM_5min.csv"
click node_loader "https://github.com/chris5992/niftyscalpingbot/blob/main/app/data_loader.py"
click node_features "https://github.com/chris5992/niftyscalpingbot/blob/main/app/strategy.py"
click node_ml "https://github.com/chris5992/niftyscalpingbot/blob/main/app/strategy.py"
click node_backtest "https://github.com/chris5992/niftyscalpingbot/blob/main/app/strategy.py"
click node_config "https://github.com/chris5992/niftyscalpingbot/blob/main/app/config.py"
click node_metrics "https://github.com/chris5992/niftyscalpingbot/blob/main/app/metrics.py"
click node_plots "https://github.com/chris5992/niftyscalpingbot/blob/main/app/plots.py"
click node_replay "https://github.com/chris5992/niftyscalpingbot/blob/main/app/trade_replay.py"
click node_regimes "https://github.com/chris5992/niftyscalpingbot/blob/main/app/regime_analysis.py"
click node_iv "https://github.com/chris5992/niftyscalpingbot/blob/main/app/iv_analytics.py"
click node_montecarlo "https://github.com/chris5992/niftyscalpingbot/blob/main/app/monte_carlo.py"
click node_robustness "https://github.com/chris5992/niftyscalpingbot/blob/main/app/robustness.py"
click node_cache "https://github.com/chris5992/niftyscalpingbot/blob/main/cache/ml_cache.pkl"

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_streamlit toneBlue
class node_loader,node_features,node_ml,node_backtest,node_cache toneAmber
class node_metrics,node_plots,node_replay,node_regimes,node_iv,node_montecarlo,node_robustness toneMint
class node_config toneRose
class node_user toneIndigo
class node_csv toneTeal
```

## Components

### Dashboard

- [Dashboard UI](https://github.com/chris5992/niftyscalpingbot/blob/main/app/main.py): `app/main.py`

### Strategy Pipeline

- [Data Cleaning](https://github.com/chris5992/niftyscalpingbot/blob/main/app/data_loader.py): `app/data_loader.py`
- [Feature Engineering](https://github.com/chris5992/niftyscalpingbot/blob/main/app/strategy.py): `app/strategy.py`
- [Walk-Forward ML](https://github.com/chris5992/niftyscalpingbot/blob/main/app/strategy.py): `app/strategy.py`
- [Trade Backtest](https://github.com/chris5992/niftyscalpingbot/blob/main/app/strategy.py): `app/strategy.py`
- [ML Cache](https://github.com/chris5992/niftyscalpingbot/blob/main/cache/ml_cache.pkl): `cache/ml_cache.pkl`

### Research Analytics

- [Performance Metrics](https://github.com/chris5992/niftyscalpingbot/blob/main/app/metrics.py): `app/metrics.py`
- [Charts](https://github.com/chris5992/niftyscalpingbot/blob/main/app/plots.py): `app/plots.py`
- [Day Replay](https://github.com/chris5992/niftyscalpingbot/blob/main/app/trade_replay.py): `app/trade_replay.py`
- [Regime Analysis](https://github.com/chris5992/niftyscalpingbot/blob/main/app/regime_analysis.py): `app/regime_analysis.py`
- [Volatility Analytics](https://github.com/chris5992/niftyscalpingbot/blob/main/app/iv_analytics.py): `app/iv_analytics.py`
- [Monte Carlo](https://github.com/chris5992/niftyscalpingbot/blob/main/app/monte_carlo.py): `app/monte_carlo.py`
- [Robustness Tests](https://github.com/chris5992/niftyscalpingbot/blob/main/app/robustness.py): `app/robustness.py`

### Configuration

- [Strategy Settings](https://github.com/chris5992/niftyscalpingbot/blob/main/app/config.py): `app/config.py`

### Other components

- **Researcher**
- [NIFTY Bars CSV](https://github.com/chris5992/niftyscalpingbot/blob/main/FINAL_NIFTY_MASTER_ATM_5min.csv): `FINAL_NIFTY_MASTER_ATM_5min.csv`

## Connections

- Researcher → Dashboard UI: uses (evidence: `README.md`)
- NIFTY Bars CSV → Data Cleaning: loads (evidence: `app/data_loader.py`)
- Dashboard UI → Data Cleaning: loads data (evidence: `app/main.py`)
- Data Cleaning → Feature Engineering: cleaned bars
- Dashboard UI → Feature Engineering: engineers features (evidence: `app/main.py`)
- Feature Engineering → Walk-Forward ML: feature data (evidence: `app/strategy.py`)
- Dashboard UI → Walk-Forward ML: trains or loads (evidence: `app/main.py`)
- Walk-Forward ML → ML Cache: reads or writes
- Dashboard UI → Trade Backtest: runs backtest (evidence: `app/main.py`)
- Trade Backtest → Performance Metrics: trade results (evidence: `verify_pipeline.py`)
- Dashboard UI → Strategy Settings: gets settings (evidence: `app/main.py`)
- Dashboard UI → Charts: renders charts (evidence: `app/main.py`)
- Dashboard UI → Day Replay: requests day data (evidence: `app/main.py`)
- Dashboard UI → Regime Analysis: shows analysis (evidence: `app/main.py`)
- Dashboard UI → Volatility Analytics: shows analytics (evidence: `app/main.py`)
- Dashboard UI → Monte Carlo: runs simulation (evidence: `app/main.py`)
- Dashboard UI → Robustness Tests: runs tests (evidence: `app/main.py`)
