🧠 Bitcoin Price Forecasting using LSTM Neural Network
A deep learning model based on Long Short-Term Memory (LSTM) networks to predict the next-day closing price of Bitcoin (BTC-USD) using historical data from Yahoo Finance.
🔍 Model Overview
Feature | Description |
---|---|
📦 Model Type | LSTM (Long Short-Term Memory), a variant of Recurrent Neural Networks (RNN) |
🧠 Frameworks Used | TensorFlow (Keras API), Scikit-learn, NumPy, Pandas, yfinance |
📈 Input | Past 60 days of Bitcoin closing prices |
🎯 Output | Predicted closing price for the next day |
📊 Evaluation | Root Mean Squared Error (RMSE) |
🧪 Goal | Short-term (1-day ahead) BTC price forecasting |
🔧 What the Model Does
- Downloads historical BTC-USD data from Yahoo Finance
- Normalizes the data between 0 and 1 using MinMaxScaler
- Splits into 80% training and 20% test sets
- Creates time-sequenced inputs with a 60-day sliding window
- Trains a 2-layer LSTM model with dropout to prevent overfitting
- Evaluates the model using RMSE
- Plots predicted vs actual prices
- Makes a next-day prediction using the last 60 days of data
💡 Use Cases
- Educational: Learning time series forecasting and LSTM models
- Research: Benchmarking for financial forecasting models
- Visualization: Analyze model performance on real BTC data
- Academic Support: Useful for papers or prototypes on AI-based financial systems
⚠️ Limitations
- Uses only the closing price (no volume, indicators, or sentiment data)
- Performs only single-step (1-day ahead) forecasting
- Does not account for sudden market news or shocks
- Not designed for high-frequency or live trading systems
🚀 Potential Improvements
- Include additional features: volume, RSI, MACD, etc.
- Integrate external signals: news, social media sentiment, macro data
- Add attention or transformer-based layers
- Extend to multi-step forecasting (3-day, 5-day, etc.)
- Deploy as REST API or interactive dashboard
- Connect to Binance or other exchanges for live predictions
📁 Files
lstm_bitcoin_predictor.py
: Full code to train, evaluate, and predict using LSTMdata.csv
: (optional) Cached historical BTC-USD datamodel.h5
: Saved trained model
📜 License
This project is licensed under the MIT License.
⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️ Disclaimer⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️
This model is intended for educational and research purposes only.
It is not designed for financial or investment decision-making.
No guarantees are made about the accuracy of the forecasts.
The authors accept no responsibility for any financial losses incurred from the use of this model.
Use at your own risk.
- Downloads last month
- 0
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support