# sameer-stack23/indexcollector architecture

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

- Interactive diagram: https://gitdiagram.com/sameer-stack23/indexcollector
- Repository: https://github.com/sameer-stack23/indexcollector

## Overview

IndexCollector collects five-minute NIFTY candle data from Angel One, stores full candle records in SQLite, and maintains a row-wise CSV of close-minus-open values. Its main workflow is scheduled/live collection or batched historical import, followed by persistence and CSV synchronization. A local dashboard can start, stop, and monitor the collector. The excerpts show the orchestration and dashboard control paths; broader links are omitted where the sampled code does not establish them.

Main entry points: [`IndexCollector.py/main.py`](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/main.py) (Collector runtime), [`IndexCollector.py/angel_feed.py`](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/angel_feed.py) (Angel feed), [`IndexCollector.py/config.py`](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/config.py) (Settings), [`IndexCollector.py/database.py`](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/database.py) (Candle store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_collection["Collection runtime"]
  node_collector["Collector runtime<br/>[main.py]"]
  node_settings["Settings<br/>[config.py]"]
  node_market_time["Market time<br/>[market_time.py]"]
end

subgraph group_provider["Market data"]
  node_angel_feed["Angel feed<br/>[angel_feed.py]"]
end

subgraph group_persistence["Persistence and export"]
  node_candle_store[("Candle store<br/>[database.py]")]
  node_csv_export["CSV export<br/>[export_csv.py]"]
end

subgraph group_dashboard["Local dashboard"]
  node_dashboard_ui["Dashboard UI<br/>[app.js]"]
  node_dashboard_api["Dashboard API<br/>[app.py]"]
  node_process_manager["Process manager"]
end

node_operator(("Operator"))
node_angel_one{{"Angel One"}}

node_operator -->|"controls"| node_dashboard_ui
node_dashboard_ui -->|"requests status"| node_dashboard_api
node_dashboard_api -->|"manages process"| node_process_manager
node_process_manager -->|"starts process"| node_collector
node_collector -->|"fetches candles"| node_angel_feed
node_angel_feed -->|"requests market data"| node_angel_one
node_collector -->|"saves candles"| node_candle_store
node_collector -->|"syncs CSV"| node_csv_export
node_collector -->|"reads settings"| node_settings
node_collector -->|"uses market time"| node_market_time
node_angel_feed -->|"reads settings"| node_settings
node_angel_feed -->|"uses time helpers"| node_market_time
node_candle_store -->|"reads database setting"| node_settings

click node_dashboard_ui "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/dashboard/static/app.js"
click node_dashboard_api "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/dashboard/app.py"
click node_process_manager "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/dashboard/collector_manager.py"
click node_collector "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/main.py"
click node_settings "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/config.py"
click node_market_time "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/market_time.py"
click node_angel_feed "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/angel_feed.py"
click node_candle_store "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/database.py"
click node_csv_export "https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/export_csv.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_collector,node_settings,node_market_time toneBlue
class node_angel_feed toneAmber
class node_candle_store,node_csv_export toneMint
class node_dashboard_ui,node_dashboard_api,node_process_manager toneRose
class node_operator,node_angel_one toneIndigo
```

## Components

### Collection runtime

- [Collector runtime](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/main.py): `IndexCollector.py/main.py`
- [Settings](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/config.py): `IndexCollector.py/config.py`
- [Market time](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/market_time.py): `IndexCollector.py/market_time.py`

### Market data

- [Angel feed](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/angel_feed.py): `IndexCollector.py/angel_feed.py`

### Persistence and export

- [Candle store](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/database.py): `IndexCollector.py/database.py`
- [CSV export](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/export_csv.py): `IndexCollector.py/export_csv.py`

### Local dashboard

- [Dashboard UI](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/dashboard/static/app.js): `IndexCollector.py/dashboard/static/app.js`
- [Dashboard API](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/dashboard/app.py): `IndexCollector.py/dashboard/app.py`
- [Process manager](https://github.com/sameer-stack23/indexcollector/blob/main/IndexCollector.py/dashboard/collector_manager.py): `IndexCollector.py/dashboard/collector_manager.py`

### Other components

- **Operator**
- **Angel One**

## Connections

- Operator → Dashboard UI: controls (evidence: `IndexCollector.py/dashboard/static/app.js`)
- Dashboard UI → Dashboard API: requests status (evidence: `IndexCollector.py/dashboard/static/app.js`)
- Dashboard API → Process manager: manages process (evidence: `IndexCollector.py/dashboard/app.py`)
- Process manager → Collector runtime: starts process (evidence: `IndexCollector.py/dashboard/collector_manager.py`)
- Collector runtime → Angel feed: fetches candles (evidence: `IndexCollector.py/main.py`)
- Angel feed → Angel One: requests market data (evidence: `IndexCollector.py/angel_feed.py`)
- Collector runtime → Candle store: saves candles (evidence: `IndexCollector.py/main.py`)
- Collector runtime → CSV export: syncs CSV (evidence: `IndexCollector.py/main.py`)
- Collector runtime → Settings: reads settings (evidence: `IndexCollector.py/main.py`)
- Collector runtime → Market time: uses market time (evidence: `IndexCollector.py/main.py`)
- Angel feed → Settings: reads settings (evidence: `IndexCollector.py/angel_feed.py`)
- Angel feed → Market time: uses time helpers (evidence: `IndexCollector.py/angel_feed.py`)
- Candle store → Settings: reads database setting (evidence: `IndexCollector.py/database.py`)
