# ashayk003/nse-sentiment-analyzer architecture

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

- Interactive diagram: https://gitdiagram.com/ashayk003/nse-sentiment-analyzer
- Repository: https://github.com/ashayk003/nse-sentiment-analyzer

## Overview

NSE Stock Sentiment Analyzer is a Streamlit dashboard for turning an NSE ticker or company name into market context, technical indicators, and a multi-source news signal. The main flow starts at the app, resolves the requested ticker and fetches prices/news, scores headlines with sentiment and event context, then presents analysis and related portfolio/market views. The README documents additional charting, cascade tracking, dissemination breadth, and adaptive predictions. Edges reflect explicit README statements or the SOURCE INDEX; unsampled implementation details are not inferred.

Main entry points: [`app.py`](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/app.py) (Streamlit app), [`data_fetcher.py`](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/data_fetcher.py) (Price and news fetch), [`persistence.py`](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/persistence.py) (Local and session state), [`adaptive_sentiment.py`](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/adaptive_sentiment.py) (Adaptive predictions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Analysis workflow"]
  node_app["Streamlit app<br/>[app.py]"]
  node_lookup["Ticker lookup<br/>[data_fetcher.py]"]
  node_quotes["Price and news fetch<br/>[data_fetcher.py]"]
end

subgraph group_scoring["News intelligence"]
  node_sentiment["Headline sentiment<br/>[sentiment.py]"]
  node_events["Event classification"]
  node_aggregation["SmartScore aggregation"]
  node_breadth["News breadth<br/>[data_fetcher.py]"]
  node_adaptive["Adaptive predictions"]
  node_cascade["Commodity impacts<br/>[cascade.py]"]
end

subgraph group_market["Market context"]
  node_indicators["Technical indicators<br/>[indicators.py]"]
  node_intraday["Intraday levels<br/>[intraday.py]"]
  node_marketdata["Market pulse and flows<br/>[market_data.py]"]
end

subgraph group_experience["Dashboard and state"]
  node_portfolio["Portfolio tracking<br/>[portfolio_ui.py]"]
  node_render["Dashboard rendering<br/>[render.py]"]
  node_state[("Local and session state<br/>[persistence.py]")]
  node_chart["Interactive price chart<br/>[render.py]"]
end

node_user(("Investor"))
node_yahoo["Yahoo Finance"]
node_newsfeeds["News feeds"]

node_user -->|"submits ticker"| node_app
node_app -->|"resolves ticker"| node_lookup
node_app -->|"requests analysis"| node_quotes
node_lookup -->|"searches online"| node_yahoo
node_quotes -->|"fetches prices"| node_yahoo
node_quotes -->|"fetches headlines"| node_newsfeeds
node_app -->|"scores headlines"| node_sentiment
node_app -->|"adjusts scores"| node_events
node_app -->|"combines scores"| node_aggregation
node_app -->|"clusters articles"| node_breadth
node_app -->|"predicts reactions"| node_adaptive
node_quotes -->|"uses learner"| node_adaptive
node_app -->|"finds related impacts"| node_cascade
node_app -->|"computes indicators"| node_indicators
node_indicators -->|"reads cached history"| node_quotes
node_app -->|"computes intraday levels"| node_intraday
node_app -->|"loads market context"| node_marketdata
node_app -->|"shows holdings"| node_portfolio
node_app -->|"renders analysis"| node_render
node_app -->|"persists analysis state"| node_state
node_quotes -->|"uses cache"| node_state
node_adaptive -->|"loads saved clusters"| node_state
node_portfolio -->|"loads portfolio data"| node_state
node_render -->|"displays chart"| node_chart

click node_app "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/app.py"
click node_lookup "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/data_fetcher.py"
click node_quotes "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/data_fetcher.py"
click node_sentiment "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/sentiment.py"
click node_events "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/event_classifier.py"
click node_aggregation "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/aggregate_sentiment.py"
click node_breadth "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/data_fetcher.py"
click node_adaptive "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/adaptive_sentiment.py"
click node_cascade "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/cascade.py"
click node_indicators "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/indicators.py"
click node_intraday "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/intraday.py"
click node_marketdata "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/market_data.py"
click node_portfolio "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/portfolio_ui.py"
click node_render "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/render.py"
click node_state "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/persistence.py"
click node_chart "https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/render.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_app,node_lookup,node_quotes toneBlue
class node_sentiment,node_events,node_aggregation,node_breadth,node_adaptive,node_cascade toneAmber
class node_indicators,node_intraday,node_marketdata toneMint
class node_portfolio,node_render,node_state,node_chart toneRose
class node_user,node_yahoo,node_newsfeeds toneIndigo
```

## Components

### Analysis workflow

- [Streamlit app](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/app.py): `app.py`
- [Ticker lookup](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/data_fetcher.py): `data_fetcher.py`
- [Price and news fetch](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/data_fetcher.py): `data_fetcher.py`

### News intelligence

- [Headline sentiment](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/sentiment.py): `sentiment.py`
- [Event classification](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/event_classifier.py): `event_classifier.py`
- [SmartScore aggregation](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/aggregate_sentiment.py): `aggregate_sentiment.py`
- [News breadth](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/data_fetcher.py): `data_fetcher.py`
- [Adaptive predictions](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/adaptive_sentiment.py): `adaptive_sentiment.py`
- [Commodity impacts](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/cascade.py): `cascade.py`

### Market context

- [Technical indicators](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/indicators.py): `indicators.py`
- [Intraday levels](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/intraday.py): `intraday.py`
- [Market pulse and flows](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/market_data.py): `market_data.py`

### Dashboard and state

- [Portfolio tracking](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/portfolio_ui.py): `portfolio_ui.py`
- [Dashboard rendering](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/render.py): `render.py`
- [Local and session state](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/persistence.py): `persistence.py`
- [Interactive price chart](https://github.com/ashayk003/nse-sentiment-analyzer/blob/master/render.py): `render.py`

### Other components

- **Investor**
- **Yahoo Finance**
- **News feeds**

## Connections

- Investor → Streamlit app: submits ticker (evidence: `README.md`)
- Streamlit app → Ticker lookup: resolves ticker (evidence: `app.py`)
- Streamlit app → Price and news fetch: requests analysis (evidence: `app.py`)
- Ticker lookup → Yahoo Finance: searches online (evidence: `README.md`)
- Price and news fetch → Yahoo Finance: fetches prices (evidence: `README.md`)
- Price and news fetch → News feeds: fetches headlines (evidence: `README.md`)
- Streamlit app → Headline sentiment: scores headlines (evidence: `app.py`)
- Streamlit app → Event classification: adjusts scores (evidence: `app.py`)
- Streamlit app → SmartScore aggregation: combines scores (evidence: `app.py`)
- Streamlit app → News breadth: clusters articles (evidence: `README.md`)
- Streamlit app → Adaptive predictions: predicts reactions (evidence: `README.md`)
- Price and news fetch → Adaptive predictions: uses learner (evidence: `data_fetcher.py`)
- Streamlit app → Commodity impacts: finds related impacts (evidence: `app.py`)
- Streamlit app → Technical indicators: computes indicators (evidence: `app.py`)
- Technical indicators → Price and news fetch: reads cached history (evidence: `indicators.py`)
- Streamlit app → Intraday levels: computes intraday levels (evidence: `app.py`)
- Streamlit app → Market pulse and flows: loads market context (evidence: `app.py`)
- Streamlit app → Portfolio tracking: shows holdings (evidence: `app.py`)
- Streamlit app → Dashboard rendering: renders analysis (evidence: `app.py`)
- Streamlit app → Local and session state: persists analysis state (evidence: `app.py`)
- Price and news fetch → Local and session state: uses cache (evidence: `data_fetcher.py`)
- Adaptive predictions → Local and session state: loads saved clusters (evidence: `adaptive_sentiment.py`)
- Portfolio tracking → Local and session state: loads portfolio data (evidence: `portfolio_ui.py`)
- Dashboard rendering → Interactive price chart: displays chart (evidence: `README.md`)
