# mithleshy885/crypto-trade-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/mithleshy885/crypto-trade-analysis
- Repository: https://github.com/mithleshy885/crypto-trade-analysis

## Overview

This repository analyzes crypto trades alongside Fear-Greed sentiment, then offers three distinct outputs: exploratory and trader analyses, next-day sentiment classification, and KMeans trade-pattern clusters. The user-facing prediction path is feature entry in Streamlit → a loaded classifier → a sentiment result. The graph reflects explicit calls in the sampled sources and capabilities listed in the README; unsampled analysis internals are represented at the enclosing module path, without asserting their internal wiring.

Main entry points: [`trading_sentiment_analysis.py`](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py) (Data Preparation), [`app.py`](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/app.py) (Model Training), [`trade_pattern_recognition.py`](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trade_pattern_recognition.py) (Pattern Clustering), [`gui.py`](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/gui.py) (Prediction Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Sentiment Analysis"]
  node_analyzer["Data Preparation"]
  node_eda["Exploratory Analysis"]
  node_performance["Sentiment Performance"]
  node_segmentation["Trader Segmentation"]
  node_temporal["Temporal Analysis"]
  node_recommendations["Trading Insights"]
end

subgraph group_model["Sentiment Prediction"]
  node_trainer["Model Training<br/>[app.py]"]
  node_classifier["Sentiment Classifier"]
  node_gui["Prediction Interface<br/>[gui.py]"]
  node_prediction["Next-Day Sentiment<br/>[gui.py]"]
end

subgraph group_patterns["Trade Patterns"]
  node_cluster_job["Pattern Clustering"]
  node_cluster_output["Cluster Assignments"]
end

subgraph group_inputs["Input Data"]
  node_trades["Historical Trades"]
  node_sentiment_data["Fear-Greed Data"]
end

node_analyst(("Analyst"))
node_user(("Prediction User"))

node_trades -->|"loads trades"| node_analyzer
node_sentiment_data -->|"loads sentiment"| node_analyzer
node_analyst -->|"runs analysis"| node_analyzer
node_analyzer -->|"prepares data"| node_eda
node_analyzer -->|"prepares data"| node_performance
node_analyzer -->|"prepares data"| node_segmentation
node_analyzer -->|"prepares data"| node_temporal
node_analyzer -->|"prepares data"| node_recommendations
node_trades -->|"loads trades"| node_trainer
node_sentiment_data -->|"loads sentiment"| node_trainer
node_trainer -->|"calls preparation"| node_analyzer
node_analyzer -->|"returns merged data"| node_trainer
node_trainer -->|"trains classifier"| node_classifier
node_user -->|"enters features"| node_gui
node_gui -->|"loads model"| node_classifier
node_gui -->|"requests prediction"| node_classifier
node_classifier -->|"returns class"| node_prediction
node_analyst -->|"runs clustering"| node_cluster_job
node_cluster_job -->|"calls preparation"| node_analyzer
node_analyzer -->|"returns merged data"| node_cluster_job
node_cluster_job -->|"writes assignments"| node_cluster_output

click node_analyzer "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py"
click node_eda "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py"
click node_performance "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py"
click node_segmentation "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py"
click node_temporal "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py"
click node_recommendations "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py"
click node_trainer "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/app.py"
click node_gui "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/gui.py"
click node_prediction "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/gui.py"
click node_cluster_job "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trade_pattern_recognition.py"
click node_cluster_output "https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trade_pattern_recognition.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_analyzer,node_eda,node_performance,node_segmentation,node_temporal,node_recommendations,node_user toneBlue
class node_trainer,node_classifier,node_gui,node_prediction toneAmber
class node_cluster_job,node_cluster_output toneMint
class node_trades,node_sentiment_data toneRose
class node_analyst toneIndigo
```

## Components

### Sentiment Analysis

- [Data Preparation](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py): `trading_sentiment_analysis.py`
- [Exploratory Analysis](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py): `trading_sentiment_analysis.py`
- [Sentiment Performance](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py): `trading_sentiment_analysis.py`
- [Trader Segmentation](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py): `trading_sentiment_analysis.py`
- [Temporal Analysis](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py): `trading_sentiment_analysis.py`
- [Trading Insights](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trading_sentiment_analysis.py): `trading_sentiment_analysis.py`

### Sentiment Prediction

- [Model Training](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/app.py): `app.py`
- **Sentiment Classifier**
- [Prediction Interface](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/gui.py): `gui.py`
- [Next-Day Sentiment](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/gui.py): `gui.py`

### Trade Patterns

- [Pattern Clustering](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trade_pattern_recognition.py): `trade_pattern_recognition.py`
- [Cluster Assignments](https://github.com/mithleshy885/crypto-trade-analysis/blob/main/trade_pattern_recognition.py): `trade_pattern_recognition.py`

### Input Data

- **Historical Trades**
- **Fear-Greed Data**

### Other components

- **Analyst**
- **Prediction User**

## Connections

- Historical Trades → Data Preparation: loads trades
- Fear-Greed Data → Data Preparation: loads sentiment
- Analyst → Data Preparation: runs analysis
- Data Preparation → Exploratory Analysis: prepares data
- Data Preparation → Sentiment Performance: prepares data
- Data Preparation → Trader Segmentation: prepares data
- Data Preparation → Temporal Analysis: prepares data
- Data Preparation → Trading Insights: prepares data
- Historical Trades → Model Training: loads trades
- Fear-Greed Data → Model Training: loads sentiment
- Model Training → Data Preparation: calls preparation
- Data Preparation → Model Training: returns merged data
- Model Training → Sentiment Classifier: trains classifier
- Prediction User → Prediction Interface: enters features
- Prediction Interface → Sentiment Classifier: loads model
- Prediction Interface → Sentiment Classifier: requests prediction
- Sentiment Classifier → Next-Day Sentiment: returns class
- Analyst → Pattern Clustering: runs clustering
- Pattern Clustering → Data Preparation: calls preparation
- Data Preparation → Pattern Clustering: returns merged data
- Pattern Clustering → Cluster Assignments: writes assignments
