crypto-forecast / README.md
nancysakhiya
fix HF space config
659b913
|
Raw History Blame Contribute Delete
4.76 kB
metadata
title: CryptoSight
emoji: ๐Ÿ”ฎ
colorFrom: green
colorTo: blue
sdk: docker
pinned: false

๐Ÿ”ฎ CryptoSight โ€” ML-Powered Crypto Forecasting Dashboard

End-to-end ML project combining LSTM time-series forecasting, Facebook Prophet, and FinBERT sentiment analysis in a production-quality Streamlit dashboard.

Python TensorFlow Streamlit License


Project Overview

CryptoSight is a full-stack ML application that forecasts cryptocurrency prices using two models (LSTM neural network + Facebook Prophet) and enriches predictions with real-time news sentiment scored by FinBERT โ€” a BERT model fine-tuned on financial text.

Live Demo: your-app.streamlit.app


Features

Feature Technology
Real-time OHLCV data Yahoo Finance API via yfinance
Candlestick + technical indicators Plotly, Pandas
Price forecasting (LSTM) TensorFlow/Keras โ€” stacked LSTM
Price forecasting (Prophet) Facebook Prophet
Forecast confidence intervals Walk-forward uncertainty estimation
News sentiment scoring FinBERT (ProsusAI/finbert)
Sentiment dashboard Gauge + per-headline scoring
Model performance metrics MAE, RMSE, MAPE on validation set
Training loss curves Epoch-level train vs val loss
Feature correlation matrix Seaborn-style Plotly heatmap
Dark professional UI Custom CSS, DM Mono font

Architecture

crypto-forecast/
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ main.py               # Streamlit entry point
โ”‚   โ”œโ”€โ”€ style.css             # Custom dark theme CSS
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ””โ”€โ”€ sidebar.py        # Config sidebar
โ”‚   โ””โ”€โ”€ pages/
โ”‚       โ”œโ”€โ”€ overview.py       # Price chart + metrics
โ”‚       โ”œโ”€โ”€ forecast.py       # LSTM + Prophet predictions
โ”‚       โ”œโ”€โ”€ sentiment.py      # FinBERT news sentiment
โ”‚       โ””โ”€โ”€ model_performance.py  # Metrics + architecture
โ”‚
โ”œโ”€โ”€ models/
โ”‚   โ”œโ”€โ”€ lstm_model.py         # Stacked LSTM (TF/Keras)
โ”‚   โ”œโ”€โ”€ prophet_model.py      # Facebook Prophet
โ”‚   โ””โ”€โ”€ sentiment_model.py   # FinBERT / VADER pipeline
โ”‚
โ”œโ”€โ”€ utils/
โ”‚   โ”œโ”€โ”€ data_fetcher.py       # Yahoo Finance + news API
โ”‚   โ””โ”€โ”€ charts.py             # Plotly figure builders
โ”‚
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_models.py        # Unit tests
โ”‚
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ README.md

ML Models

LSTM Neural Network

  • Architecture: 3 stacked LSTM layers (128โ†’64โ†’32) with Dropout + BatchNorm
  • Features: Close price, Volume, RSI(14), MA7, MA25, Annualised Volatility
  • Lookback: 60 trading days
  • Loss function: Huber loss (robust to outliers)
  • Training: EarlyStopping with patience=8

Facebook Prophet

  • Seasonality: Weekly + Yearly + custom Monthly (Fourier order 5)
  • Changepoint prior: 0.05 (conservative)
  • Interval width: 80%

FinBERT Sentiment

  • Model: ProsusAI/finbert โ€” BERT fine-tuned on 10k financial news items
  • Labels: Positive / Neutral / Negative โ†’ mapped to [-1, +1]
  • Fallback: VADER lexicon-based sentiment if GPU/memory unavailable

Quick Start

1. Clone the repo

git clone https://github.com/yourusername/crypto-forecast.git
cd crypto-forecast

2. Create virtual environment

python -m venv venv
source venv/bin/activate      # Windows: venv\Scripts\activate

3. Install dependencies

pip install -r requirements.txt

4. Run the app

streamlit run app/main.py

Open http://localhost:8501 in your browser.


Deployment (Hugging Face Spaces)

  1. Create a new Space on huggingface.co/spaces โ€” choose Streamlit SDK
  2. Push this repo to the Space's git remote
  3. Add a README.md with YAML front matter specifying sdk: streamlit and app_file: app/main.py
  4. The Space builds automatically โ€” free hosting with GPU support

Results

Model MAE ($) RMSE ($) MAPE (%)
LSTM ~1,200 ~1,900 ~4.2%
Prophet ~1,800 ~2,500 ~6.1%

Results vary by coin and date range.


Tech Stack

  • Python 3.10+
  • TensorFlow 2.16 โ€” LSTM model
  • Prophet 1.1 โ€” Bayesian time-series
  • HuggingFace Transformers โ€” FinBERT
  • Streamlit โ€” web dashboard
  • Plotly โ€” interactive charts
  • yfinance โ€” market data
  • scikit-learn โ€” preprocessing & metrics