# harishkulkarni10/stock-intelligence-platform architecture

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

- Interactive diagram: https://gitdiagram.com/harishkulkarni10/stock-intelligence-platform
- Repository: https://github.com/harishkulkarni10/stock-intelligence-platform

## Overview

Stock Intelligence Platform is an equity-research desk: a user submits a ticker, receives a code-generated forecast, specialist interpretations, and a synthesized research brief. Its documented analyze path runs Performance, Market, Financial, Risk, then Report; the browser also offers product-help chat and session history. The repository combines a FastAPI service, web and Streamlit clients, a model-training/data path, market-data retrieval, and optional Redis caching. Several backend and agent implementations were not excerpted, so those connections reflect README documentation rather than inspected call sites.

Main entry points: [`src/agents/graph.py`](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/graph.py) (Agent orchestration), [`backend/api.py`](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/backend/api.py) (Analyze API), [`src/agents/tools.py`](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/tools.py) (Research tools), [`src/agents/performance_guardrails.py`](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/performance_guardrails.py) (Performance analyst)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desk["Research desk"]
  node_web_desk["Web desk<br/>[app.js]"]
  node_streamlit_desk["Streamlit desk<br/>[app.py]"]
  node_analyze_api["Analyze API<br/>[api.py]"]
  node_schemas["API schemas<br/>[schemas.py]"]
end

subgraph group_forecast["Forecast and data"]
  node_forecast["Forecast inference"]
  node_model["Forecast model<br/>[definition.py]"]
  node_ingestion["Market ingestion<br/>[ingestion.py]"]
  node_preparation["Sequence preparation<br/>[preparation.py]"]
  node_data_pipeline["Feature pipeline<br/>[data_pipeline.py]"]
  node_feature_store[("Feature store<br/>[features.py]")]
end

subgraph group_research["Research agents"]
  node_performance["Performance analyst"]
  node_market_agent["Market expert<br/>[news_guardrails.py]"]
  node_financial_agent["Financial analyst"]
  node_risk_agent["Risk analyst<br/>[risk_guardrails.py]"]
  node_report_agent["Research brief"]
  node_guide["Product guide<br/>[help_chat.py]"]
  node_agent_graph["Agent orchestration<br/>[graph.py]"]
  node_agent_tools["Research tools<br/>[tools.py]"]
  node_llm["LLM client<br/>[llm.py]"]
end

subgraph group_market["Market data"]
  node_company_data["Company profile<br/>[equity.py]"]
  node_fundamentals["Fundamentals snapshot<br/>[financials.py]"]
  node_risk_metrics["Coded risk metrics<br/>[risk_metrics.py]"]
  node_news_service["News providers"]
end

subgraph group_platform["State and observability"]
  node_redis[("Redis cache")]
  node_analyze_cache["Analyze cache<br/>[semantic_cache.py]"]
  node_app_state["Backend state<br/>[state.py]"]
  node_log_context["Request context<br/>[context.py]"]
  node_logger["Structured logging<br/>[logger.py]"]
  node_agent_evaluation["Agent evaluation<br/>[agent_eval.py]"]
  node_config["Configuration<br/>[config.py]"]
end

node_researcher(("Researcher"))
node_llm_provider["LLM provider"]

node_researcher -->|"submits ticker"| node_web_desk
node_web_desk -->|"requests analysis"| node_analyze_api
node_researcher -->|"submits ticker"| node_streamlit_desk
node_streamlit_desk -->|"requests analysis"| node_analyze_api
node_analyze_api -.->|"validates request"| node_schemas
node_analyze_api -->|"requests forecast"| node_forecast
node_forecast -.->|"predicts prices"| node_model
node_data_pipeline -->|"ingests prices"| node_ingestion
node_data_pipeline -->|"prepares sequences"| node_preparation
node_data_pipeline -.->|"writes features"| node_feature_store
node_analyze_api -->|"runs analysis"| node_agent_graph
node_agent_graph -->|"runs first"| node_performance
node_agent_graph -->|"runs second"| node_market_agent
node_agent_graph -->|"runs third"| node_financial_agent
node_agent_graph -->|"runs fourth"| node_risk_agent
node_agent_graph -->|"synthesizes notes"| node_report_agent
node_agent_graph -.->|"uses research tools"| node_agent_tools
node_performance -->|"invokes model"| node_llm
node_agent_tools -.->|"gets fundamentals"| node_fundamentals
node_agent_tools -.->|"gets profile"| node_company_data
node_agent_tools -.->|"gets risk metrics"| node_risk_metrics
node_agent_tools -.->|"fetches headlines"| node_news_service
node_fundamentals -->|"uses market data"| node_ingestion
node_market_agent -->|"interprets headlines"| node_news_service
node_financial_agent -->|"interprets snapshot"| node_fundamentals
node_risk_agent -->|"uses coded metrics"| node_risk_metrics
node_guide -.->|"answers questions"| node_llm
node_analyze_api -->|"reads or writes"| node_analyze_cache
node_analyze_cache -->|"gets Redis client"| node_app_state
node_app_state -.->|"connects"| node_redis
node_llm -->|"invokes provider"| node_llm_provider
node_llm -->|"logs events"| node_logger
node_performance -->|"sets ticker context"| node_log_context
node_performance -->|"logs analysis"| node_logger
node_data_pipeline -->|"loads settings"| node_config
node_agent_evaluation -->|"checks guardrails"| node_performance
node_agent_evaluation -->|"checks guardrails"| node_market_agent
node_agent_evaluation -->|"checks guardrails"| node_financial_agent
node_agent_evaluation -->|"checks guardrails"| node_report_agent

click node_web_desk "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/frontend/web/app.js"
click node_streamlit_desk "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/frontend/app.py"
click node_analyze_api "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/backend/api.py"
click node_schemas "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/backend/schemas.py"
click node_forecast "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/pipelines/inference_pipeline.py"
click node_model "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/model/definition.py"
click node_ingestion "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/data/ingestion.py"
click node_preparation "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/data/preparation.py"
click node_data_pipeline "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/pipelines/data_pipeline.py"
click node_feature_store "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/feature_store/features.py"
click node_performance "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/performance_guardrails.py"
click node_market_agent "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/news_guardrails.py"
click node_financial_agent "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/financial_guardrails.py"
click node_risk_agent "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/risk_guardrails.py"
click node_report_agent "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/report_guardrails.py"
click node_guide "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/help_chat.py"
click node_agent_graph "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/graph.py"
click node_agent_tools "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/tools.py"
click node_llm "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/llm.py"
click node_company_data "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/market/equity.py"
click node_fundamentals "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/market/financials.py"
click node_risk_metrics "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/market/risk_metrics.py"
click node_analyze_cache "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/memory/semantic_cache.py"
click node_app_state "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/backend/state.py"
click node_log_context "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/logger/context.py"
click node_logger "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/logger/logger.py"
click node_agent_evaluation "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/monitoring/agent_eval.py"
click node_config "https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/config.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_desk,node_streamlit_desk,node_analyze_api,node_schemas toneBlue
class node_forecast,node_model,node_ingestion,node_preparation,node_data_pipeline,node_feature_store toneAmber
class node_performance,node_market_agent,node_financial_agent,node_risk_agent,node_report_agent,node_guide,node_agent_graph,node_agent_tools,node_llm toneMint
class node_company_data,node_fundamentals,node_risk_metrics,node_news_service toneRose
class node_redis,node_analyze_cache,node_app_state,node_log_context,node_logger,node_agent_evaluation,node_config,node_researcher,node_llm_provider toneIndigo
```

## Components

### Research desk

- [Web desk](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/frontend/web/app.js): `frontend/web/app.js`
- [Streamlit desk](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/frontend/app.py): `frontend/app.py`
- [Analyze API](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/backend/api.py): `backend/api.py`
- [API schemas](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/backend/schemas.py): `backend/schemas.py`

### Forecast and data

- [Forecast inference](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/pipelines/inference_pipeline.py): `src/pipelines/inference_pipeline.py`
- [Forecast model](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/model/definition.py): `src/model/definition.py`
- [Market ingestion](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/data/ingestion.py): `src/data/ingestion.py`
- [Sequence preparation](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/data/preparation.py): `src/data/preparation.py`
- [Feature pipeline](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/pipelines/data_pipeline.py): `src/pipelines/data_pipeline.py`
- [Feature store](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/feature_store/features.py): `feature_store/features.py`

### Research agents

- [Performance analyst](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/performance_guardrails.py): `src/agents/performance_guardrails.py`
- [Market expert](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/news_guardrails.py): `src/agents/news_guardrails.py`
- [Financial analyst](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/financial_guardrails.py): `src/agents/financial_guardrails.py`
- [Risk analyst](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/risk_guardrails.py): `src/agents/risk_guardrails.py`
- [Research brief](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/report_guardrails.py): `src/agents/report_guardrails.py`
- [Product guide](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/help_chat.py): `src/agents/help_chat.py`
- [Agent orchestration](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/graph.py): `src/agents/graph.py`
- [Research tools](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/tools.py): `src/agents/tools.py`
- [LLM client](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/agents/llm.py): `src/agents/llm.py`

### Market data

- [Company profile](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/market/equity.py): `src/market/equity.py`
- [Fundamentals snapshot](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/market/financials.py): `src/market/financials.py`
- [Coded risk metrics](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/market/risk_metrics.py): `src/market/risk_metrics.py`
- **News providers**

### State and observability

- **Redis cache**
- [Analyze cache](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/memory/semantic_cache.py): `src/memory/semantic_cache.py`
- [Backend state](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/backend/state.py): `backend/state.py`
- [Request context](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/logger/context.py): `logger/context.py`
- [Structured logging](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/logger/logger.py): `logger/logger.py`
- [Agent evaluation](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/monitoring/agent_eval.py): `src/monitoring/agent_eval.py`
- [Configuration](https://github.com/harishkulkarni10/stock-intelligence-platform/blob/main/src/config.py): `src/config.py`

### Other components

- **Researcher**
- **LLM provider**

## Connections

- Researcher → Web desk: submits ticker (evidence: `README.md`)
- Web desk → Analyze API: requests analysis (evidence: `frontend/web/app.js`)
- Researcher → Streamlit desk: submits ticker (evidence: `frontend/app.py`)
- Streamlit desk → Analyze API: requests analysis (evidence: `frontend/app.py`)
- Analyze API → API schemas: validates request
- Analyze API → Forecast inference: requests forecast (evidence: `README.md`)
- Forecast inference → Forecast model: predicts prices
- Feature pipeline → Market ingestion: ingests prices (evidence: `src/pipelines/data_pipeline.py`)
- Feature pipeline → Sequence preparation: prepares sequences (evidence: `src/pipelines/data_pipeline.py`)
- Feature pipeline → Feature store: writes features
- Analyze API → Agent orchestration: runs analysis (evidence: `README.md`)
- Agent orchestration → Performance analyst: runs first (evidence: `README.md`)
- Agent orchestration → Market expert: runs second (evidence: `README.md`)
- Agent orchestration → Financial analyst: runs third (evidence: `README.md`)
- Agent orchestration → Risk analyst: runs fourth (evidence: `README.md`)
- Agent orchestration → Research brief: synthesizes notes (evidence: `README.md`)
- Agent orchestration → Research tools: uses research tools
- Performance analyst → LLM client: invokes model (evidence: `src/agents/performance_guardrails.py`)
- Research tools → Fundamentals snapshot: gets fundamentals
- Research tools → Company profile: gets profile
- Research tools → Coded risk metrics: gets risk metrics
- Research tools → News providers: fetches headlines
- Fundamentals snapshot → Market ingestion: uses market data (evidence: `src/market/financials.py`)
- Market expert → News providers: interprets headlines (evidence: `README.md`)
- Financial analyst → Fundamentals snapshot: interprets snapshot (evidence: `README.md`)
- Risk analyst → Coded risk metrics: uses coded metrics (evidence: `README.md`)
- Product guide → LLM client: answers questions
- Analyze API → Analyze cache: reads or writes (evidence: `README.md`)
- Analyze cache → Backend state: gets Redis client (evidence: `src/memory/semantic_cache.py`)
- Backend state → Redis cache: connects
- LLM client → LLM provider: invokes provider (evidence: `src/agents/llm.py`)
- LLM client → Structured logging: logs events (evidence: `src/agents/llm.py`)
- Performance analyst → Request context: sets ticker context (evidence: `src/agents/performance_guardrails.py`)
- Performance analyst → Structured logging: logs analysis (evidence: `src/agents/performance_guardrails.py`)
- Feature pipeline → Configuration: loads settings (evidence: `src/pipelines/data_pipeline.py`)
- Agent evaluation → Performance analyst: checks guardrails (evidence: `src/monitoring/agent_eval.py`)
- Agent evaluation → Market expert: checks guardrails (evidence: `src/monitoring/agent_eval.py`)
- Agent evaluation → Financial analyst: checks guardrails (evidence: `src/monitoring/agent_eval.py`)
- Agent evaluation → Research brief: checks guardrails (evidence: `src/monitoring/agent_eval.py`)
