A production-ready data engineering and machine learning pipeline that predicts cryptocurrency price movements based on news sentiment, price history, and explainable AI (XAI).
- Multi-Coin Support: Tracks 5 major cryptocurrencies (Bitcoin, Ethereum, Binance Coin, Solana, Cardano).
- Automated Data Pipeline: Scrapes recent crypto news articles, and 90-day historical prices from CoinGecko.
- Deep Learning Sentiment Analysis: Uses HuggingFace's FinBERT to classify news sentiment (Bullish/Bearish/Neutral) specific to each coin.
- Ensemble Forecasting: Combines a time-series LSTM neural network with Facebook's Prophet model to predict whether a coin will go UP or DOWN, along with a dynamic confidence score.
- AI Explainability (SHAP): Doesn't just give you a prediction — it uses SHAP (SHapley Additive exPlanations) to tell you exactly which words in the news triggered the Bullish or Bearish sentiment (e.g., "declining", "accumulation").
- Premium Glassmorphism Dashboard: A beautiful, real-time Streamlit dashboard built with custom CSS, Plotly charts, and responsive UI.
- It is NOT a trading bot: This project provides analysis and forecasting, it does not execute trades, manage a portfolio, or connect to an exchange API for buying/selling.
- It is NOT financial advice: The predictions are based purely on NLP sentiment and historical trends for educational/portfolio purposes.
- It does NOT require Paid API Keys: The entire pipeline uses free, public APIs (CoinGecko public endpoints, standard RSS/News feeds) and local HuggingFace models.
crypto-sentiment/
├── scrapers/ # Data ingestion
│ ├── news_scraper.py # Fetches crypto news via RSS/feedparser
│ ├── price_scraper.py # CoinGecko API (90-day history)
│ └── reddit_scraper.py # Public Reddit JSON (No Auth needed)
├── preprocessing/ # Data cleaning & NLP features
│ ├── cleaner.py # Text sanitization
│ └── feature_engineer.py# Merges text sentiment with price history
├── models/ # ML models
│ ├── sentiment_model.py # FinBERT (Local HuggingFace model)
│ └── forecasting_model.py # LSTM + Prophet ensemble
├── explainability/ # XAI
│ └── shap_explainer.py # Computes word-level impact on predictions
├── dashboard/ # Streamlit UI
│ └── app.py # Glassmorphism frontend
├── prefect_pipeline.py # Prefect orchestration
└── config.py # Central configuration
Tech Stack:
- Data/ML Pipeline: Python, Pandas, PyTorch (LSTM), Prophet, Transformers (FinBERT)
- Explainable AI: SHAP
- Orchestration: Prefect
- Frontend: Streamlit, Plotly, Custom Vanilla CSS
# Clone the repository and setup virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txtcp .env.example .envNote: The pipeline uses public endpoints. You do not need to configure Reddit or CoinGecko API keys unless you want to bypass standard public rate limits.
This will fetch the latest news, download price history, run FinBERT, train the LSTM/Prophet models, and generate SHAP explanations for all 5 coins.
python prefect_pipeline.py(First run will download the FinBERT weights from HuggingFace).
streamlit run dashboard/app.pyOpen http://localhost:8501 in your browser to view the live dashboard!
- Scraping:
scrape_prices_taskpulls the last 90 days of prices from CoinGecko.scrape_news_taskpulls recent crypto news articles. - Preprocessing: The pipeline filters news articles by coin-specific keywords (e.g., articles mentioning "vitalik" go to Ethereum).
- Sentiment: Every relevant article is passed through FinBERT to get a bullish/bearish/neutral score.
- Forecasting:
- The LSTM model is dynamically trained on the 90-day history + daily sentiment scores to predict the next price movement.
- Prophet is trained on the raw time-series data to provide a baseline forecast.
- The Ensemble combines both. If Prophet and LSTM agree on the direction (UP/DOWN), the confidence score is boosted.
- Explainability: SHAP breaks down the FinBERT model to figure out exactly which words in the text pushed the model towards its conclusion.
- Delivery: Results are saved atomically to a JSON file which the Streamlit dashboard polls in real-time.