# conthobansung/bitcoin-prediction-changes architecture

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

- Interactive diagram: https://gitdiagram.com/conthobansung/bitcoin-prediction-changes
- Repository: https://github.com/conthobansung/bitcoin-prediction-changes

## Overview

##### Project Purpose and Type
- This is a machine learning system focused on real-time cryptocurrency (Bitcoin) analysis.
- It combines multiple models to deliver price predictions, trend forecasts, and trading signals.
- The system fetches live data using Yahoo Finance (via the yfinance library) and calculates technical indicators (like RSI, MACD, SMA, Bollinger Bands, etc.) to inform its predictions.

##### Breakdown of the File Structure
- Model Files:
- bitcoin_price_prediction_model.h5: A time-series deep learning model.
- hybrid_trend_prediction.h5: A hybrid model predicting trend directions.
- trading_signal_model_gbm.pkl: A Gradient Boosting Machine for generating buy/sell signals.
- Prediction Scripts:
- bitcoin_price_predict.py: Likely handles the price prediction workflow.
- trading_signal_predict.py: Dedicated to generating trading signals.
- trending_predict.py: Focuses on overall trend prediction.
- Data & Utility Scripts:
- dataset.py: Possibly prepares or fetches the data (and might calculate technical indicators).
- data_transfering.py: Could be involved in data handling between modules.
- test_all.py: Contains tests for validating the system’s components.
- README.md: Provides overall documentation and usage instructions.

A. Data Acquisition & Ingestion:
- Component: Data Fetcher (using the yfinance API) that retrieves live Bitcoin price data.
- Technology: yfinance library.
- Direction: External service (Yahoo Finance) → Data Acquisition Component.
B. Data Preprocessing & Feature Engineering:
- Component: Data Processor (likely represented by dataset.py and parts of data_transfering.py).
- Functions: Calculate technical indicators (RSI, SMA, EMA, Bollinger Bands, MACD, etc.) and preprocess data for the models.
- Direction: Data Acquisition → Data Processor.
C. Price Prediction Module:
- Component: Price Prediction Engine (handled by bitcoin_price_predict.py).
- Model: bitcoin_price_prediction_model.h5.
- Role: Predicts current and next minute Bitcoin prices.
- Direction: Data Processor → Price Prediction Model.
D. Trend Prediction Module:
- Component: Trend Forecast Component (using trending_predict.py and hybrid_trend_prediction.h5).
- Role: Provides overall directional trend (Increase or Decrease) based on combined inputs.
- Direction: Data Processor → Trend Prediction Model.
E. Trading Signal Module:
- Component: Trading Signal Generator (implemented in trading_signal_predict.py).
- Model: trading_signal_model_gbm.pkl.
- Role: Outputs trading signals (Buy/Sell) using technical indicators.
- Direction: Data Processor + Price/Trend predictions → Trading Signal Model.
F. Testing and Validation:
- Component: Test Suite (test_all.py) ensuring reliability of each module.
- Role: Integration and unit testing across components.

##### Architectural Patterns and Design Principles
- Modular Design: Each functional area (data acquisition, processing, prediction, and signal generation) is encapsulated in separate scripts or modules.
- Real-Time Data Pipeline: Emphasize how data flows from acquisition through pre-processing to inference.
- Separation of Concerns: Clearly divide the responsibilities of price prediction, trend forecasting, and trading signal generation.
- Integration: Although the system acts as a monolithic script setup, you might conceptualize it as a pipeline that could be modularized for scalability.

##### Specific Elements
- Clear labels for each component: “Data Acquisition”, “Data Preprocessing”, “Price Prediction”, “Trend Prediction”, “Trading Signal Generator”, and “Test Suite”.
- From “Yahoo Finance” (External Data Source) → “Data Acquisition Module”
- From “Data Acquisition” → “Data Preprocessing & Feature Engineering”
- Visual Differentiators:

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Yahoo Finance (External)"]:::external
    B["Data Acquisition"]:::processing
    C["Data Preprocessing"]:::processing

    D["Price Prediction Engine"]:::model
    E["Trend Forecast Component"]:::model
    F["Trading Signal Generator"]:::model

    G["Trading Decision Dashboard"]:::decision
    H["Test Suite"]:::test
    I["Documentation"]:::doc

    %% Data flow arrows
    A -->|"live_price_data"| B
    B -->|"raw_data"| C
    C -->|"features"| D
    C -->|"features"| E
    C -->|"features"| F
    D -->|"price_predictions"| G
    E -->|"trend_predictions"| G
    F -->|"signal_output"| G

    %% Testing validations (dashed lines)
    B ---|"tests"| H
    C ---|"tests"| H
    D ---|"tests"| H
    E ---|"tests"| H
    F ---|"tests"| H

    %% Click Events for Component Mapping
    click B "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/dataset.py"
    click C "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/data_transfering.py"
    click D "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/bitcoin_price_predict.py"
    click D "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/bitcoin_price_prediction_model.h5"
    click E "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/trending_predict.py"
    click E "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/hybrid_trend_prediction.h5"
    click F "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/trading_signal_predict.py"
    click F "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/trading_signal_model_gbm.pkl"
    click H "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/test_all.py"
    click I "https://github.com/conthobansung/bitcoin-prediction-changes/blob/main/README.md"

    %% Styles
    classDef external fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef processing fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef model fill:#A9DFBF,stroke:#229954,stroke-width:2px;
    classDef test fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef doc fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef decision fill:#D2B4DE,stroke:#7D3C98,stroke-width:2px;
```
