# sahniaditya007/stock-sense architecture

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

- Interactive diagram: https://gitdiagram.com/sahniaditya007/stock-sense
- Repository: https://github.com/sahniaditya007/stock-sense

## Overview

This is a stock-question answering demo: a user submits a natural-language or structured query, the Flask interface passes it to the orchestrator, and the orchestrator identifies a ticker, gathers price-change and news data, and produces a summary. The repository also has a current-price agent, but the sampled orchestrator imports it without invoking it. API wiring is based on sampled source; the README documents the intended capabilities and integrations.

Main entry points: [`orchestrator.py`](https://github.com/sahniaditya007/stock-sense/blob/main/orchestrator.py) (Query orchestrator), [`utils.py`](https://github.com/sahniaditya007/stock-sense/blob/main/utils.py) (API configuration), [`web_demo.py`](https://github.com/sahniaditya007/stock-sense/blob/main/web_demo.py) (Flask demo), [`agents/ticker_price_change.py`](https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_price_change.py) (Price change)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Web interface"]
  node_web["Flask demo<br/>[web_demo.py]"]
end

subgraph group_coordination["Query coordination"]
  node_orchestrator["Query orchestrator<br/>[orchestrator.py]"]
end

subgraph group_agents["Stock agents"]
  node_identify["Ticker identification<br/>[identify_ticker.py]"]
  node_pricechange["Price change"]
  node_news["Recent news<br/>[ticker_news.py]"]
  node_analysis["Movement analysis<br/>[ticker_analysis.py]"]
  node_currentprice["Current price<br/>[ticker_price.py]"]
end

subgraph group_shared["Shared configuration"]
  node_utils["API configuration<br/>[utils.py]"]
end

node_user(("User"))
node_av(("Alpha Vantage"))
node_newsapi(("News API"))

node_user -->|"submits query"| node_web
node_web -->|"calls query handler"| node_orchestrator
node_orchestrator -->|"identifies ticker"| node_identify
node_identify -->|"searches symbols"| node_av
node_orchestrator -->|"gets price change"| node_pricechange
node_pricechange -->|"requests daily series"| node_av
node_orchestrator -->|"gets recent news"| node_news
node_news -->|"searches articles"| node_newsapi
node_orchestrator -->|"analyzes inputs"| node_analysis
node_news -->|"provides headlines"| node_analysis
node_pricechange -->|"provides change"| node_analysis
node_analysis -->|"returns summary"| node_orchestrator
node_orchestrator -->|"returns result"| node_web
node_web -->|"displays result"| node_user
node_currentprice -->|"requests quote"| node_av
node_utils -->|"provides API settings"| node_identify
node_utils -->|"provides API settings"| node_pricechange
node_utils -->|"provides API settings"| node_news
node_utils -->|"provides API settings"| node_currentprice

click node_web "https://github.com/sahniaditya007/stock-sense/blob/main/web_demo.py"
click node_orchestrator "https://github.com/sahniaditya007/stock-sense/blob/main/orchestrator.py"
click node_identify "https://github.com/sahniaditya007/stock-sense/blob/main/agents/identify_ticker.py"
click node_pricechange "https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_price_change.py"
click node_news "https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_news.py"
click node_analysis "https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_analysis.py"
click node_currentprice "https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_price.py"
click node_utils "https://github.com/sahniaditya007/stock-sense/blob/main/utils.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_web,node_user toneBlue
class node_orchestrator toneAmber
class node_identify,node_pricechange,node_news,node_analysis,node_currentprice,node_newsapi toneMint
class node_utils toneRose
class node_av toneIndigo
```

## Components

### Web interface

- [Flask demo](https://github.com/sahniaditya007/stock-sense/blob/main/web_demo.py): `web_demo.py`

### Query coordination

- [Query orchestrator](https://github.com/sahniaditya007/stock-sense/blob/main/orchestrator.py): `orchestrator.py`

### Stock agents

- [Ticker identification](https://github.com/sahniaditya007/stock-sense/blob/main/agents/identify_ticker.py): `agents/identify_ticker.py`
- [Price change](https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_price_change.py): `agents/ticker_price_change.py`
- [Recent news](https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_news.py): `agents/ticker_news.py`
- [Movement analysis](https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_analysis.py): `agents/ticker_analysis.py`
- [Current price](https://github.com/sahniaditya007/stock-sense/blob/main/agents/ticker_price.py): `agents/ticker_price.py`

### Shared configuration

- [API configuration](https://github.com/sahniaditya007/stock-sense/blob/main/utils.py): `utils.py`

### Other components

- **User**
- **Alpha Vantage**
- **News API**

## Connections

- User → Flask demo: submits query
- Flask demo → Query orchestrator: calls query handler
- Query orchestrator → Ticker identification: identifies ticker
- Ticker identification → Alpha Vantage: searches symbols
- Query orchestrator → Price change: gets price change
- Price change → Alpha Vantage: requests daily series
- Query orchestrator → Recent news: gets recent news
- Recent news → News API: searches articles
- Query orchestrator → Movement analysis: analyzes inputs
- Recent news → Movement analysis: provides headlines
- Price change → Movement analysis: provides change
- Movement analysis → Query orchestrator: returns summary
- Query orchestrator → Flask demo: returns result
- Flask demo → User: displays result
- Current price → Alpha Vantage: requests quote
- API configuration → Ticker identification: provides API settings
- API configuration → Price change: provides API settings
- API configuration → Recent news: provides API settings
- API configuration → Current price: provides API settings
