# shivin1234/nifty-intelligence architecture

> Architecture diagram of the GitHub repository shivin1234/nifty-intelligence, 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/shivin1234/nifty-intelligence
- Repository: https://github.com/shivin1234/nifty-intelligence

## Overview

NIFTY Intelligence combines a FastAPI market-analysis API and a React trading dashboard. The principal flow is live NIFTY data retrieval, feature engineering and model inference, strategy selection, then dashboard presentation with prediction confidence and periodic refresh. Separate branches provide prediction history, OHLC candles, and a client-side options payoff simulator. Backend and dashboard links are visible in the README and excerpts; the chart branches are supported by sampled imports and calls. Other dashboard details are described in the README but their unsampled implementation is not asserted.

Main entry points: [`backend/main.py`](https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py) (FastAPI API), [`frontend-app/frontend-v2/src/TradingDashboard.jsx`](https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/TradingDashboard.jsx) (Dashboard), [`frontend-app/frontend-v2/src/ChartSection.jsx`](https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/ChartSection.jsx) (Chart Tabs), [`frontend-app/frontend-v2/src/CandlestickChart.jsx`](https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/CandlestickChart.jsx) (Candlestick Chart)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_market["Market Data"]
  node_yfinance["yfinance NIFTY"]
  node_candle_api["Candle Endpoint<br/>[main.py]"]
end

subgraph group_analysis["Prediction Engine"]
  node_api["FastAPI API<br/>[main.py]"]
  node_features["Feature Engineering<br/>[main.py]"]
  node_models[("Trained Models")]
  node_strategy["Strategy Mapping<br/>[main.py]"]
  node_history["Prediction History<br/>[main.py]"]
end

subgraph group_dashboard["Trading Dashboard"]
  node_dashboard_app["Dashboard"]
end

subgraph group_visuals["Charts &amp; Simulation"]
  node_chart_section["Chart Tabs<br/>[ChartSection.jsx]"]
  node_candlestick["Candlestick Chart"]
  node_payoff["Payoff Simulator<br/>[PayoffGraph.jsx]"]
end

node_user(("Trader"))
node_market_service["Market API"]

node_user -->|"uses"| node_dashboard_app
node_dashboard_app -->|"requests predictions"| node_api
node_api -->|"downloads NIFTY"| node_yfinance
node_api -->|"computes features"| node_features
node_features -->|"uses feature list"| node_models
node_api -->|"runs inference"| node_models
node_api -->|"maps outputs"| node_strategy
node_api -->|"serves history"| node_history
node_history -->|"downloads prices"| node_yfinance
node_api -->|"serves candles"| node_candle_api
node_candle_api -->|"downloads prices"| node_yfinance
node_dashboard_app -->|"fetches history"| node_history
node_dashboard_app -->|"renders"| node_chart_section
node_chart_section -->|"renders tab"| node_candlestick
node_chart_section -->|"renders tab"| node_payoff
node_candlestick -->|"fetches candles"| node_candle_api
node_dashboard_app -->|"refreshes prediction"| node_market_service

click node_dashboard_app "https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/TradingDashboard.jsx"
click node_api "https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py"
click node_features "https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py"
click node_models "https://github.com/shivin1234/nifty-intelligence/tree/main/backend/models"
click node_strategy "https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py"
click node_history "https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py"
click node_candle_api "https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py"
click node_chart_section "https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/ChartSection.jsx"
click node_candlestick "https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/CandlestickChart.jsx"
click node_payoff "https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/PayoffGraph.jsx"

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_yfinance,node_candle_api toneBlue
class node_api,node_features,node_models,node_strategy,node_history toneAmber
class node_dashboard_app,node_market_service toneMint
class node_chart_section,node_candlestick,node_payoff toneRose
class node_user toneIndigo
```

## Components

### Market Data

- **yfinance NIFTY**
- [Candle Endpoint](https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py): `backend/main.py`

### Prediction Engine

- [FastAPI API](https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py): `backend/main.py`
- [Feature Engineering](https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py): `backend/main.py`
- [Trained Models](https://github.com/shivin1234/nifty-intelligence/tree/main/backend/models): `backend/models`
- [Strategy Mapping](https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py): `backend/main.py`
- [Prediction History](https://github.com/shivin1234/nifty-intelligence/blob/main/backend/main.py): `backend/main.py`

### Trading Dashboard

- [Dashboard](https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/TradingDashboard.jsx): `frontend-app/frontend-v2/src/TradingDashboard.jsx`

### Charts & Simulation

- [Chart Tabs](https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/ChartSection.jsx): `frontend-app/frontend-v2/src/ChartSection.jsx`
- [Candlestick Chart](https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/CandlestickChart.jsx): `frontend-app/frontend-v2/src/CandlestickChart.jsx`
- [Payoff Simulator](https://github.com/shivin1234/nifty-intelligence/blob/main/frontend-app/frontend-v2/src/PayoffGraph.jsx): `frontend-app/frontend-v2/src/PayoffGraph.jsx`

### Other components

- **Trader**
- **Market API**

## Connections

- Trader → Dashboard: uses (evidence: `README.md`)
- Dashboard → FastAPI API: requests predictions (evidence: `README.md`)
- FastAPI API → yfinance NIFTY: downloads NIFTY (evidence: `backend/main.py`)
- FastAPI API → Feature Engineering: computes features (evidence: `backend/main.py`)
- Feature Engineering → Trained Models: uses feature list (evidence: `backend/main.py`)
- FastAPI API → Trained Models: runs inference (evidence: `backend/main.py`)
- FastAPI API → Strategy Mapping: maps outputs (evidence: `backend/main.py`)
- FastAPI API → Prediction History: serves history (evidence: `backend/main.py`)
- Prediction History → yfinance NIFTY: downloads prices (evidence: `backend/main.py`)
- FastAPI API → Candle Endpoint: serves candles (evidence: `README.md`)
- Candle Endpoint → yfinance NIFTY: downloads prices (evidence: `backend/main.py`)
- Dashboard → Prediction History: fetches history (evidence: `frontend-app/frontend-v2/src/TradingDashboard.jsx`)
- Dashboard → Chart Tabs: renders (evidence: `frontend-app/frontend-v2/src/TradingDashboard.jsx`)
- Chart Tabs → Candlestick Chart: renders tab (evidence: `frontend-app/frontend-v2/src/ChartSection.jsx`)
- Chart Tabs → Payoff Simulator: renders tab (evidence: `frontend-app/frontend-v2/src/ChartSection.jsx`)
- Candlestick Chart → Candle Endpoint: fetches candles (evidence: `frontend-app/frontend-v2/src/CandlestickChart.jsx`)
- Dashboard → Market API: refreshes prediction (evidence: `frontend-app/frontend-v2/src/TradingDashboard.jsx`)
