Bitcoin Price Prediction with LSTM

Thelist Framer Website
Thelist Framer Website
Thelist Framer Website

Category:

Machine Learning

Client:

-

Duration:

2 Months

Bitcoin Price Prediction with LSTM

This project focuses on predicting Bitcoin closing prices using a Long Short-Term Memory (LSTM) neural network. The model incorporates daily price fluctuations and market sentiments to provide accurate predictions. By analyzing historical price data and sentiment from platforms like Twitter and Reddit, this project demonstrates the potential of deep learning in financial forecasting.

Project Overview

Objectives

  • Develop a predictive model for Bitcoin closing prices.

  • Incorporate market sentiment analysis to improve prediction accuracy.

  • Compare the performance of LSTM with traditional models like ARIMA.

  • Explore potential improvements for real-time data streaming and multi-platform sentiment analysis.

Methodology

  1. Data Collection:

    • Historical Bitcoin price data from CryptoCompare API.

    • Market sentiment data from social media platforms (Twitter and Reddit).

  2. Data Preprocessing:

    • Converted timestamps to datetime format.

    • Dropped unnecessary columns (e.g., conversionType, conversionSymbol).

    • Split data into training and testing sets.

    • Normalized data using zero-based normalization.

  3. Model Architecture:

    • LSTM with:

      • 100 neurons.

      • Dropout rate of 0.2.

      • MSE loss function.

      • Adam optimizer.

    • Sequential structure with dense output layer.

  4. Evaluation Metrics:

    • Mean Absolute Error (MAE)

    • Mean Squared Error (MSE)

    • R-squared (R2) score

  5. Visualization:

    • Line plots comparing actual vs. predicted prices.

Results

  • The LSTM model outperformed ARIMA in recognizing long-term dependencies in Bitcoin price data.

  • Incorporating social media sentiment improved prediction accuracy but highlighted biases in the data source.

Limitations

  • Current predictions are based on historical data and do not include real-time streaming.

  • Sentiment analysis is limited to Twitter and Reddit, which may not represent the broader trading community.

  • Other platforms like Facebook and LinkedIn could provide more comprehensive sentiment data.

Future Work

  • Expand sentiment analysis to include more platforms for diverse perspectives.

  • Implement real-time data streaming for up-to-the-minute predictions.

  • Compare LSTM with other machine learning models to validate findings.

  • Integrate sentiment-driven decision-making into autonomous trading systems.

Prerequisites

  • Python 3.x

  • Libraries:

    • TensorFlow/Keras

    • Pandas

    • NumPy

    • Matplotlib

    • Seaborn

    • Scikit-learn

    • Requests

How to Run the Project

  1. Clone the repository.

  2. Install the required dependencies.

  3. Replace your-api-key in the script with your CryptoCompare API key.

  4. Run the script to train the model and visualize predictions.

Key Files

  • bitcoin_price_prediction.py: Main script for data preprocessing, training, and prediction.

  • README.md: Project documentation.

Acknowledgements

This project leverages the CryptoCompare API for historical data and social media platforms for sentiment analysis. Special thanks to the creators of TensorFlow and Keras for making deep learning accessible.

Create a free website with Framer, the website builder loved by startups, designers and agencies.