# knightfox11/stock_portfolio_management architecture

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

- Interactive diagram: https://gitdiagram.com/knightfox11/stock_portfolio_management
- Repository: https://github.com/knightfox11/stock_portfolio_management

## Overview

##### Main Components
- Data Ingestion Module – Illustrate the process where stock data is imported from yfinance (specifically for the period from the year 2010 onward). Indicate that the raw data includes fields like Date, Open, High, Low, Close, Volume, and Dividend.
- Data Analysis and Preprocessing Component – Detail how the notebook cleans and processes the data. This might involve handling timestamps, missing values, and preparing the dataset for time-series analysis.
- Modeling / Forecasting Engine – Break this into submodules for each forecasting method used:
– FB Prophet Module
– LSTM (Long Short-Term Memory based predictions)
– ARIMA / SARIMA Modules
– XGBoost based prediction module
- Visualization and Reporting Component – Capture elements where the results, such as predictions and analytical insights, are visualized (plots, charts, performance metrics, etc.).
- Portfolio Management Logic – Although integrated within the notebook, note any specific logic used to recommend management strategies based on the analysis outcomes.

##### Relationships and Interactions
- That preprocessing feeds into multiple forecasting modules concurrently.
- That analysis results from each module are then integrated and passed into the Visualization component.

##### Architectural Patterns and Design Principles
- Modular Design: Emphasize that even though everything is in one notebook, the functional segregation (data ingestion, preprocessing, modeling, and visualization) suggests a modular design.

##### Relevant Technologies and Frameworks
- Use of the yfinance library as the data source.
- Mention time-series analysis libraries and forecasting frameworks such as FB Prophet, deep learning frameworks (for LSTM), stats models (for ARIMA/SARIMA), and XGBoost.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Data Ingestion – yfinance<br/>(Stock Data: Date,Open,High,Low,Close,Volume,Dividend)"]:::ingestion
    B["Data Preprocessing<br/>(Cleaning, Timestamp Handling, Missing Values)"]:::preprocessing

    subgraph "Forecasting Engine"
        F1["FB Prophet Module"]:::forecasting
        F2["LSTM Module"]:::forecasting
        F3["ARIMA/SARIMA Module"]:::forecasting
        F4["XGBoost Prediction Module"]:::forecasting
        FC["Model Comparison"]:::comparison
    end

    V["Visualization and Reporting<br/>(Plots, Charts,Metrics)"]:::visualization
    P["Portfolio Management Logic<br/>(Strategy Recommendations)"]:::portfolio

    A -->|"feeds"| B
    B -->|"processed_data"| F1
    B -->|"processed_data"| F2
    B -->|"processed_data"| F3
    B -->|"processed_data"| F4

    F1 --> FC
    F2 --> FC
    F3 --> FC
    F4 --> FC

    FC -->|"integrated_results"| V
    FC -->|"forecast_influence"| P
    V -->|"report_insights"| P

    click A "https://github.com/knightfox11/stock_portfolio_management/blob/main/Final_Project_DSEM_VF.ipynb"
    click B "https://github.com/knightfox11/stock_portfolio_management/blob/main/Final_Project_DSEM_VF.ipynb"
    click F1 "https://github.com/knightfox11/stock_portfolio_management/blob/main/Final_Project_DSEM_VF.ipynb"
    click F2 "https://github.com/knightfox11/stock_portfolio_management/blob/main/Final_Project_DSEM_VF.ipynb"
    click F3 "https://github.com/knightfox11/stock_portfolio_management/blob/main/Final_Project_DSEM_VF.ipynb"
    click F4 "https://github.com/knightfox11/stock_portfolio_management/blob/main/Final_Project_DSEM_VF.ipynb"
    click V "https://github.com/knightfox11/stock_portfolio_management/blob/main/Final_Project_DSEM_VF.ipynb"
    click P "https://github.com/knightfox11/stock_portfolio_management/blob/main/Final_Project_DSEM_VF.ipynb"

    classDef ingestion fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef preprocessing fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef forecasting fill:#FFFF99,stroke:#333,stroke-width:2px;
    classDef visualization fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef portfolio fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef comparison fill:#FFD700,stroke:#333,stroke-width:2px;
```
