Stock & Crypto Analysis Dashboard Real-Time Market Data • SQL Analytics • Machine Learning (Prophet Forecasts)
This project is an end-to-end financial analytics system that collects, stores, analyzes, and visualizes stock & cryptocurrency price data using:
PostgreSQL + SQL window functions Python ETL pipelines Interactive Streamlit dashboard Machine Learning forecasting (Prophet) Plotly visualizations Secure environment variable handling (.env)
Features
-
Real-Time Stock & Crypto Data Fetches stock data using Yahoo Finance (yfinance) Fetches crypto data via Binance API Saves data into PostgreSQL tables
-
SQL-Based Analytics Using PostgreSQL window functions: Moving averages (SMA10, SMA30) Rolling volatility Returns Price changes
-
Interactive Streamlit Dashboard Includes: Candlestick charts Moving average overlays Live price charts Data tables Prophet forecasts
-
Machine Learning Forecasting (Prophet) Predicts short-term future prices Includes confidence intervals Automatically retrains on fresh data
-
Secure Environment Variables No credentials are stored in code. Uses .env + python-dotenv. Project Structure stock-crypto-dashboard/ │── README.md │── requirements.txt │── .gitignore │── .env
│── src/ │ ├── dashboard.py │ ├── db_utils.py │ ├── prophet_forecast.py │ ├── fetch_stocks.py │ ├── fetch_crypto.py │ ├── insert_stock_data.py │ ├── insert_crypto_data.py │── data/
│── notebooks/
│── venv/
🔧 Setup Instructions
-
Clone the repo git clone https://github.com//stock-crypto-dashboard.git cd stock-crypto-dashboard
-
Create a virtual environment python3 -m venv venv source venv/bin/activate
-
Install dependencies pip install -r requirements.txt
-
Create a .env file DB_NAME=myproject DB_USER=YOUR_USER DB_PASSWORD=YOUR_PASSWORD DB_HOST=localhost DB_PORT=5432
-
Start PostgreSQL
Make sure your database is running and includes a stock_prices table.
-
Run the ETL scripts python -m src.insert_stock_data python -m src.insert_crypto_data
-
Run the dashboard streamlit run src/dashboard.py
Machine Learning Forecasts
The project uses Facebook Prophet: Autoregressive model Trend + seasonality Prediction intervals Suitable for financial time-series Example output: Predicted price curve Upper/lower confidence bands Next 2 hours of forecasts (default)
Technologies Used :
Python, PostgreSQL, Streamlit, Plotly, Yahoo Finance API, Binance API, Prophet (Forecasting), pandas, numpy, psycopg2, python-dotenv, virtualenv