# harsha943vf/real-time-stock-prediction architecture

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

- Interactive diagram: https://gitdiagram.com/harsha943vf/real-time-stock-prediction
- Repository: https://github.com/harsha943vf/real-time-stock-prediction

## Overview

This is a small Dash stock-forecasting application. A user enters a ticker, model choice, and date range; the callback fetches and prepares historical prices, trains the selected model, generates future forecasts, computes evaluation metrics, and returns a chart and metrics to the page. The README provides no additional capability detail; source excerpts show the main workflow and model variants. The root-level utility duplicates were not shown as application dependencies.

Main entry points: [`app.py`](https://github.com/harsha943vf/real-time-stock-prediction/blob/main/app.py) (Dash callback and results), [`utils/preprocessing.py`](https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/preprocessing.py) (Price fetch and sequences), [`utils/model_utils.py`](https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/model_utils.py) (LSTM forecast)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Forecast interface"]
  node_dash_app["Dash callback and results<br/>[app.py]"]
end

subgraph group_data["Market data preparation"]
  node_market_data["Price fetch and sequences<br/>[preprocessing.py]"]
end

subgraph group_models["Forecast models"]
  node_lstm["LSTM forecast<br/>[model_utils.py]"]
  node_bilstm["BiLSTM forecast<br/>[model_utils.py]"]
  node_svr["SVR forecast<br/>[model_utils.py]"]
end

node_user(("User"))
node_yfinance["Yahoo Finance"]

node_user -->|"submits inputs"| node_dash_app
node_dash_app -->|"prepares data"| node_market_data
node_market_data -->|"downloads prices"| node_yfinance
node_dash_app -->|"trains and forecasts"| node_lstm
node_dash_app -->|"trains and forecasts"| node_bilstm
node_dash_app -->|"trains and forecasts"| node_svr
node_dash_app -->|"returns chart and metrics"| node_user

click node_dash_app "https://github.com/harsha943vf/real-time-stock-prediction/blob/main/app.py"
click node_market_data "https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/preprocessing.py"
click node_lstm "https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/model_utils.py"
click node_bilstm "https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/model_utils.py"
click node_svr "https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/model_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_dash_app,node_user toneBlue
class node_market_data toneAmber
class node_lstm,node_bilstm,node_svr toneMint
class node_yfinance toneIndigo
```

## Components

### Forecast interface

- [Dash callback and results](https://github.com/harsha943vf/real-time-stock-prediction/blob/main/app.py): `app.py`

### Market data preparation

- [Price fetch and sequences](https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/preprocessing.py): `utils/preprocessing.py`

### Forecast models

- [LSTM forecast](https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/model_utils.py): `utils/model_utils.py`
- [BiLSTM forecast](https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/model_utils.py): `utils/model_utils.py`
- [SVR forecast](https://github.com/harsha943vf/real-time-stock-prediction/blob/main/utils/model_utils.py): `utils/model_utils.py`

### Other components

- **User**
- **Yahoo Finance**

## Connections

- User → Dash callback and results: submits inputs (evidence: `app.py`)
- Dash callback and results → Price fetch and sequences: prepares data (evidence: `app.py`)
- Price fetch and sequences → Yahoo Finance: downloads prices (evidence: `utils/preprocessing.py`)
- Dash callback and results → LSTM forecast: trains and forecasts (evidence: `app.py`)
- Dash callback and results → BiLSTM forecast: trains and forecasts (evidence: `app.py`)
- Dash callback and results → SVR forecast: trains and forecasts (evidence: `app.py`)
- Dash callback and results → User: returns chart and metrics (evidence: `app.py`)
