# jebin1999/algotrading- architecture

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

- Interactive diagram: https://gitdiagram.com/jebin1999/algotrading-
- Repository: https://github.com/jebin1999/algotrading-

## Overview

##### Project type and purpose
- This is a single-script Python application for time-series forecasting. It uses an LSTM neural network to predict stock prices based on historical data fetched from Yahoo Finance.

##### File structure
- There are only two top-level files:
- CopyLSTMPredAPPL.py – the main Python script that orchestrates data fetching, preprocessing, model training, prediction, and visualization
- README.md – documentation

##### README for additional insights
- The README confirms the workflow:
- Fetch stock data via yfinance
- MinMax scaling preprocessing
- Build & train LSTM (TensorFlow)
- Plot actual vs. predicted
- No external microservices or databases—everything runs in-memory in one script

a. Main components
1. Data Source (Yahoo Finance API)
2. Data Ingestion Module (yfinance wrapper)
3. Preprocessing Module (pandas + scikit-learn MinMaxScaler)
4. Model Training Module (TensorFlow LSTM)
5. Prediction Module (uses trained LSTM to forecast)
6. Visualization Module (matplotlib)
7. Logging / Configuration (script parameters, hyperparameters)

b. Relationships & interactions
- Ingestion Module → Preprocessing
- Preprocessing → Model Training
- Trained Model → Prediction Module
- Prediction Module → Visualization
- All modules read global config/hyperparameters

c. Architectural patterns & design principles
- Linear data-pipeline (ETL → Model → Output)
- Single responsibility per component

d. Key technologies & libraries
- numpy & pandas for data handling
- yfinance for live historical data fetch
- scikit-learn’s MinMaxScaler for normalization
- tensorflow.keras for LSTM model
- matplotlib for plotting

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Configuration & Hyperparameters"
        Config["Config & Hyperparameters"]:::config
    end

    DataSource["Yahoo Finance API"]:::external
    Ingestion["Data Ingestion Module<br/>(yfinance)"]:::data
    Preprocessing["Preprocessing Module<br/>(pandas, MinMaxScaler)"]:::data
    Training["LSTM Model Training<br/>(TensorFlow)"]:::model
    Prediction["Prediction Module"]:::model
    Visualization["Visualization Module<br/>(matplotlib)"]:::output
    Documentation["Project Documentation<br/>(README.md)"]:::external

    Config --> Ingestion
    Config --> Preprocessing
    Config --> Training

    DataSource -->|"OHLCV DataFrame"| Ingestion
    Ingestion -->|"Raw DataFrame"| Preprocessing
    Preprocessing -->|"Scaled Data"| Training
    Training -->|"Trained LSTM Model"| Prediction
    Prediction -->|"Forecast Data"| Visualization

    %% Click Events
    click Ingestion "https://github.com/jebin1999/algotrading-/blob/main/CopyLSTMPredAPPL.py"
    click Preprocessing "https://github.com/jebin1999/algotrading-/blob/main/CopyLSTMPredAPPL.py"
    click Training "https://github.com/jebin1999/algotrading-/blob/main/CopyLSTMPredAPPL.py"
    click Prediction "https://github.com/jebin1999/algotrading-/blob/main/CopyLSTMPredAPPL.py"
    click Visualization "https://github.com/jebin1999/algotrading-/blob/main/CopyLSTMPredAPPL.py"
    click Config "https://github.com/jebin1999/algotrading-/blob/main/CopyLSTMPredAPPL.py"
    click Documentation "https://github.com/jebin1999/algotrading-/blob/main/README.md"

    %% Styles
    classDef data fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef model fill:#90EE90,stroke:#333,stroke-width:1px
    classDef output fill:#FFA500,stroke:#333,stroke-width:1px
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#CCCCCC,stroke:#333,stroke-width:1px
```
