Skip to content

πŸ“Š AI-Driven Market Sentiment Analysis for Crypto Trading | Random Forest Modeling | Streamlit Dashboard | Hyperliquid & Fear-Greed Index Insights

License

Notifications You must be signed in to change notification settings

yashdew3/market-sentiment-trading-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ˆ Market Sentiment Prediction from Trader Behavior

Predict and visualize market sentiment (Fear/Greed) using trader-level data from Hyperliquid and the Bitcoin Fear & Greed Index.

πŸš€ Built with Scikit-learn, Streamlit, Pandas, and real-world Web3 trading data.


πŸ“Œ Project Objective

Explore how trader performance and behavior correlates with market sentiment and build an end-to-end system that:

  • 🧼 Cleans and merges multi-source financial datasets
  • πŸ“Š Performs statistical testing & rolling window feature engineering
  • πŸ€– Trains a predictive model to forecast sentiment
  • 🌐 Hosts a live dashboard for predictions and insights

πŸ—‚οΈ Project Structure

market-sentiment-trading-analysis/
β”œβ”€β”€ data/                           # Raw and processed data files
β”‚   β”œβ”€β”€ fear_greed_index.csv           # Raw sentiment data
β”‚   β”œβ”€β”€ historical_data.csv            # Raw trader data
β”‚   β”œβ”€β”€ merged_trader_sentiment_data.csv # Preprocessed & merged data
β”‚   └── feature_engineered_data.csv    # Cleaned + feature-rich dataset
β”‚
β”œβ”€β”€ src/                            # Source code for data processing & modeling
β”‚   β”œβ”€β”€ clean_and_merge.py             # Data cleaning & joining script
β”‚   β”œβ”€β”€ statistical_tests.py           # T-tests & correlation analysis
β”‚   β”œβ”€β”€ feature_engineering.py         # Rolling stats + new features
β”‚   β”œβ”€β”€ predict_sentiment_model.py     # Model training & evaluation
β”‚   └── improve_model.py               # Optimized model
β”‚
β”œβ”€β”€ outputs/                        # Generated outputs
β”‚   β”œβ”€β”€ models/                         # Trained models and scalers
β”‚   β”‚   β”œβ”€β”€ sentiment_rf_model.pkl
β”‚   β”‚   β”œβ”€β”€ sentiment_rf_model_optimized.pkl
β”‚   β”‚   └── scaler.pkl
β”‚   β”‚
β”‚   β”œβ”€β”€ eda/                            # Visualizations from exploratory analysis
β”‚   β”‚   β”œβ”€β”€ pnl_over_time.png
β”‚   β”‚   β”œβ”€β”€ sentiment_distribution.png
β”‚   β”‚   β”œβ”€β”€ trade_count_over_time.png
β”‚   β”‚   └── volume_over_time.png
β”‚   β”‚
β”‚   └── statstics/                      # Statistical test results
β”‚       β”œβ”€β”€ statistical_tests.csv
β”‚       └── correlation_results.csv
β”‚
β”œβ”€β”€ app/                            # Dashboard app for visualization
β”‚   └── dashboard.py                   # Streamlit dashboard
β”‚
β”œβ”€β”€ requirements.txt               # Project dependencies
└── README.md                      # Project documentation


πŸš€ How to Run This Project

1. Clone the repository

git clone https://github.com/yashdew03/market-sentiment-trading-analysis.git
cd market-sentiment-trading-analysis

2. Set up your environment

python -m venv venv
source venv/bin/activate       # Windows: venv\Scripts\activate
pip install -r requirements.txt

3. Run the files

python src/clean_and_merge.py
python src/statistical_tests.py
python src/feature_engineering.py
python src/predict_sentiment_model.py
python src/improve_model.py

4. Launch the Dashboard

streamlit run app/dashboard.py

🧠 Key Features

πŸ“ˆ EDA Charts: Visualize how trader behavior changes with sentiment

πŸ§ͺ Statistical Testing: Validate if sentiment significantly affects trading metrics

πŸ› οΈ Feature Engineering: Rolling mean, std, trade volume patterns

πŸ€– Random Forest Model: Predict sentiment from trader metrics

🌐 Streamlit UI: Upload your own trade data and get sentiment predictions


🧩 Tech Stack

Purpose Tools Used
Data Analysis pandas, numpy
Statistical Tests scipy, statsmodels
Machine Learning scikit-learn, joblib
Visualization matplotlib, seaborn
Dashboard streamlit

πŸ”¬ Machine Learning Pipeline

  • Data Cleaning: Handled nulls, converted timestamps, merged datasets.
  • Feature Engineering: Rolling windows (3D mean/std), trade count aggregations.
  • Statistical Testing: T-tests, correlation significance.
  • Modeling: Random Forest with scaling + inference pipeline.
  • Evaluation: Confusion matrix, F1-score, recall/precision.

πŸ“Š Sample Output

Model Evaluation:

Accuracy = 81%

F1-score (Greed class) = 0.89

Random Forest was selected over others for interpretability and robustness.


πŸ“© Requirements

  • Python 3.8+
  • Libraries listed in requirements.txt

🀝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page (if you have one) or open a new issue to discuss changes. Pull requests are also appreciated.


πŸ“¬ Contact

Enjoy using the Predictive Model for the Market Sentiment in Indian Stock Market! πŸš€

About

πŸ“Š AI-Driven Market Sentiment Analysis for Crypto Trading | Random Forest Modeling | Streamlit Dashboard | Hyperliquid & Fear-Greed Index Insights

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages