AI-powered cryptocurrency price forecasting with an active learning feedback loop.
| Feature | Description |
|---|---|
| ๐ง LSTM Model | Multi-layer LSTM trained on historical price data with RSI, Bollinger Bands, and MA indicators |
| ๐ 7/14-day Forecast | Autoregressive multi-step price prediction with confidence scoring |
| ๐ฌ Active Learning | User feedback loop that tracks model accuracy and triggers retraining |
| ๐ Live Metrics | MAE, RMSE, and accuracy dashboard updated in real time |
| ๐ Auto-Retrain | Background retraining triggered after every 50 feedback entries |
| ๐ CoinGecko API | Free-tier market data โ no API key required |
| ๐ณ Docker | Single-command full-stack deployment |
Add screenshots here after running the app locally.
cryptopredict/
โโโ backend/
โ โโโ main.py # FastAPI application & REST endpoints
โ โโโ train_model.py # LSTM training pipeline (run once before API)
โ โโโ requirements.txt
โ โโโ Dockerfile
โ โโโ tests/
โ โโโ test_api.py
โโโ frontend/
โ โโโ src/
โ โ โโโ App.jsx # Main React application
โ โ โโโ utils/api.js # Typed API client
โ โ โโโ hooks/ # Custom React hooks
โ โ โโโ index.css # Global styles
โ โโโ Dockerfile
โ โโโ nginx.conf
โ โโโ vite.config.js
โโโ docker-compose.yml
โโโ .github/workflows/ci.yml
- Python 3.11+
- Node.js 20+
- (Optional) Docker & Docker Compose
git clone https://github.com/Sm3th/cryptopredict.git
cd cryptopredict
# 1. Train the model first (runs outside Docker to save the .keras file)
cd backend
pip install -r requirements.txt
python train_model.py --coin bitcoin --days 730
# 2. Spin up everything
cd ..
docker-compose up --buildOpen http://localhost for the app, http://localhost:8000/docs for Swagger UI.
cd backend
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# Train the model (required before starting the API)
python train_model.py --coin bitcoin --days 730
# Start API
uvicorn main:app --reload --port 8000cd frontend
npm install
npm run dev
# โ http://localhost:5173Input (60 ร 1)
โ
LSTM(128) โ Dropout(0.2)
โ
LSTM(64) โ Dropout(0.2)
โ
LSTM(32) โ Dropout(0.2)
โ
Dense(16, relu)
โ
Dense(1) โ price prediction
| Feature | Description |
|---|---|
price |
Daily closing price (normalized 0โ1) |
MA_7 / MA_21 / MA_50 |
Moving averages |
RSI |
Relative Strength Index (14-period) |
BB_upper / BB_lower |
Bollinger Bands (20-period, ยฑ2ฯ) |
volatility |
7-day rolling std |
momentum |
price โ price[โ10] |
| Parameter | Value |
|---|---|
| Lookback window | 60 days |
| Train / Test split | 80 / 20 |
| Epochs | 50 (early stopping, patience=10) |
| Batch size | 32 |
| Optimiser | Adam |
| Loss | MSE |
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Health check |
GET |
/api/health |
Detailed system status |
POST |
/api/predict |
Run price forecast |
POST |
/api/feedback |
Submit prediction feedback |
POST |
/api/retrain |
Trigger background retraining |
GET |
/api/metrics |
Model performance metrics |
GET |
/api/feedback/history |
All feedback records |
GET |
/api/coins |
Supported cryptocurrencies |
Full interactive documentation: http://localhost:8000/docs
curl -X POST http://localhost:8000/api/predict \
-H "Content-Type: application/json" \
-d '{"coin_id": "bitcoin", "days": 7}'{
"coin_id": "bitcoin",
"current_price": 67450.00,
"predictions": [
{ "day": 1, "date": "2026-05-28", "price": 68120.50, "change_percentage": 0.99 },
...
],
"confidence": 0.70,
"sentiment": "Bullish",
"sentiment_score": 72.4,
"model_accuracy": 68.0
}curl -X POST http://localhost:8000/api/feedback \
-H "Content-Type: application/json" \
-d '{
"prediction_id": "bitcoin_1234567890",
"actual_price": 68000.00,
"predicted_price": 68120.50,
"date": "2026-05-28",
"is_accurate": true
}'cd backend
pip install pytest httpx anyio
pytest tests/ -v| Variable | Default | Description |
|---|---|---|
ALLOWED_ORIGINS |
http://localhost:5173,... |
CORS allowed origins |
MODEL_PATH |
crypto_lstm_model.keras |
Path to trained model |
SCALER_PATH |
scaler.pkl |
Path to fitted scaler |
VITE_API_URL |
/api |
API base URL (frontend) |
- Multi-coin comparison view
- Sentiment analysis from Twitter/Reddit
- Email alerts for large predicted swings
- Model versioning & rollback
- PostgreSQL for persistent feedback storage
This project is built for educational purposes only. Cryptocurrency markets are highly volatile. Do not make financial decisions based on these predictions.
MIT ยฉ 2026 โ ฤฐsmet Organ