# jugaad-py/jugaad-data architecture

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

- Interactive diagram: https://gitdiagram.com/jugaad-py/jugaad-data
- Repository: https://github.com/jugaad-py/jugaad-data

## Overview

jugaad-data is a Python library and CLI for retrieving Indian market and economic data. Users request historical archives, historical stock/index/derivatives series, live market information, mutual-fund NAV history, or RBI rates, then receive parsed data or saved CSV/files. The documented product also includes BSE live-data capabilities, holiday-calendar data, caching, and optional pandas conversion. The graph reflects sampled calls and explicit README statements; several implementation details are unsampled, so uncertain connections are omitted or marked dashed.

Main entry points: [`jugaad_data/nse/history.py`](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/nse/history.py) (Historical series), [`jugaad_data/cli.py`](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/cli.py) (Download CLI), [`jugaad_data/amfi/__init__.py`](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/amfi/__init__.py) (NAV history), [`jugaad_data/nse/archives.py`](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/nse/archives.py) (Archives and bhavcopy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_cli["Download CLI<br/>[cli.py]"]
end

subgraph group_nse["NSE data"]
  node_archives["Archives and bhavcopy<br/>[archives.py]"]
  node_history["Historical series<br/>[history.py]"]
  node_nselive["Live NSE data<br/>[live.py]"]
end

subgraph group_other["Other data sources"]
  node_bselive["Live BSE data<br/>[live.py]"]
  node_amfi["NAV history<br/>[__init__.py]"]
  node_rbi["Current RBI rates<br/>[__init__.py]"]
  node_holidays["Trading holidays<br/>[holidays.py]"]
end

subgraph group_shared["Shared runtime"]
  node_cache["Cache and conversions<br/>[util.py]"]
end

node_user(("Python or CLI user"))
node_nseweb{{"NSE websites"}}
node_niftyweb{{"Nifty Indices site"}}
node_bseweb{{"BSE website"}}
node_amfiweb{{"AMFI website"}}
node_rbiweb{{"RBI website"}}

node_user -->|"runs commands"| node_cli
node_user -->|"requests archives"| node_archives
node_user -->|"requests history"| node_history
node_user -->|"requests live data"| node_nselive
node_user -->|"requests NAV data"| node_amfi
node_user -->|"requests rates"| node_rbi
node_cli -->|"downloads files"| node_archives
node_cli -->|"downloads series"| node_history
node_cli -->|"dispatches commands"| node_amfi
node_archives -->|"fetches reports"| node_nseweb
node_history -->|"fetches stock data"| node_nseweb
node_history -->|"fetches index data"| node_niftyweb
node_nselive -->|"fetches live data"| node_nseweb
node_amfi -->|"downloads NAV report"| node_amfiweb
node_rbi -->|"reads current rates"| node_rbiweb
node_bselive -.->|"fetches market data"| node_bseweb
node_history -->|"uses archive helpers"| node_archives
node_history -->|"caches results"| node_cache
node_nselive -->|"caches live calls"| node_cache
node_amfi -->|"caches reports"| node_cache

click node_cli "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/cli.py"
click node_archives "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/nse/archives.py"
click node_history "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/nse/history.py"
click node_nselive "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/nse/live.py"
click node_bselive "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/bse/live.py"
click node_amfi "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/amfi/__init__.py"
click node_rbi "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/rbi/__init__.py"
click node_holidays "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/holidays.py"
click node_cache "https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/util.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_cli,node_user toneBlue
class node_archives,node_history,node_nselive toneAmber
class node_bselive,node_amfi,node_rbi,node_holidays toneMint
class node_cache toneRose
class node_nseweb,node_niftyweb,node_bseweb,node_amfiweb,node_rbiweb toneIndigo
```

## Components

### User entry points

- [Download CLI](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/cli.py): `jugaad_data/cli.py`

### NSE data

- [Archives and bhavcopy](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/nse/archives.py): `jugaad_data/nse/archives.py`
- [Historical series](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/nse/history.py): `jugaad_data/nse/history.py`
- [Live NSE data](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/nse/live.py): `jugaad_data/nse/live.py`

### Other data sources

- [Live BSE data](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/bse/live.py): `jugaad_data/bse/live.py`
- [NAV history](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/amfi/__init__.py): `jugaad_data/amfi/__init__.py`
- [Current RBI rates](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/rbi/__init__.py): `jugaad_data/rbi/__init__.py`
- [Trading holidays](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/holidays.py): `jugaad_data/holidays.py`

### Shared runtime

- [Cache and conversions](https://github.com/jugaad-py/jugaad-data/blob/master/jugaad_data/util.py): `jugaad_data/util.py`

### Other components

- **Python or CLI user**
- **NSE websites**
- **Nifty Indices site**
- **BSE website**
- **AMFI website**
- **RBI website**

## Connections

- Python or CLI user → Download CLI: runs commands (evidence: `README.md`)
- Python or CLI user → Archives and bhavcopy: requests archives (evidence: `README.md`)
- Python or CLI user → Historical series: requests history (evidence: `README.md`)
- Python or CLI user → Live NSE data: requests live data (evidence: `README.md`)
- Python or CLI user → NAV history: requests NAV data (evidence: `README.md`)
- Python or CLI user → Current RBI rates: requests rates (evidence: `README.md`)
- Download CLI → Archives and bhavcopy: downloads files (evidence: `jugaad_data/cli.py`)
- Download CLI → Historical series: downloads series (evidence: `jugaad_data/cli.py`)
- Download CLI → NAV history: dispatches commands (evidence: `jugaad_data/cli.py`)
- Archives and bhavcopy → NSE websites: fetches reports (evidence: `jugaad_data/nse/archives.py`)
- Historical series → NSE websites: fetches stock data (evidence: `jugaad_data/nse/history.py`)
- Historical series → Nifty Indices site: fetches index data (evidence: `README.md`)
- Live NSE data → NSE websites: fetches live data (evidence: `README.md`)
- NAV history → AMFI website: downloads NAV report (evidence: `jugaad_data/amfi/__init__.py`)
- Current RBI rates → RBI website: reads current rates (evidence: `jugaad_data/rbi/__init__.py`)
- Live BSE data → BSE website: fetches market data
- Historical series → Archives and bhavcopy: uses archive helpers (evidence: `jugaad_data/nse/history.py`)
- Historical series → Cache and conversions: caches results (evidence: `jugaad_data/nse/history.py`)
- Live NSE data → Cache and conversions: caches live calls (evidence: `jugaad_data/nse/live.py`)
- NAV history → Cache and conversions: caches reports (evidence: `jugaad_data/amfi/__init__.py`)
