update readme
Browse files
README.md
CHANGED
|
@@ -1,113 +1,125 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
---
|
| 19 |
-
|
| 20 |
-
##
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
-
|
| 41 |
-
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
###
|
| 48 |
-
-
|
| 49 |
-
-
|
| 50 |
-
|
| 51 |
-
###
|
| 52 |
-
-
|
| 53 |
-
-
|
| 54 |
-
|
| 55 |
-
###
|
| 56 |
-
-
|
| 57 |
-
-
|
| 58 |
-
|
| 59 |
-
###
|
| 60 |
-
-
|
| 61 |
-
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
-
|
| 69 |
-
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
- CoinGecko API: [https://www.coingecko.com/](https://www.coingecko.com/)
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
metrics:
|
| 6 |
+
- mse
|
| 7 |
+
tags:
|
| 8 |
+
- LSTM
|
| 9 |
+
- PyTorch
|
| 10 |
+
- RNN
|
| 11 |
+
- DeepLearning
|
| 12 |
+
---
|
| 13 |
+
# Bitcoin Price Prediction with LSTM
|
| 14 |
+
|
| 15 |
+
## Project Overview
|
| 16 |
+
This project aims to predict Bitcoin (BTC) prices for the next 60 days using a Long Short-Term Memory (LSTM) neural network. The dataset used contains historical BTC/USD prices from 2014 to early 2024. The project leverages PyTorch for deep learning and includes data preprocessing, feature engineering, and model evaluation.
|
| 17 |
+
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
## Table of Contents
|
| 21 |
+
1. [Introduction](#introduction)
|
| 22 |
+
2. [Dataset Description](#dataset-description)
|
| 23 |
+
3. [Project Workflow](#project-workflow)
|
| 24 |
+
4. [Model Architecture](#model-architecture)
|
| 25 |
+
5. [Results](#results)
|
| 26 |
+
6. [How to Run](#how-to-run)
|
| 27 |
+
7. [Future Work](#future-work)
|
| 28 |
+
8. [References](#references)
|
| 29 |
+
|
| 30 |
+
---
|
| 31 |
+
|
| 32 |
+
## Introduction
|
| 33 |
+
Bitcoin is a highly volatile cryptocurrency, making price prediction a challenging task. This project uses sequential data modeling with LSTM to capture patterns in historical BTC prices and provide reliable predictions.
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## Dataset Description
|
| 38 |
+
- **Source**: Kaggle
|
| 39 |
+
- **File**: `Dataset/BTC-USD.csv`
|
| 40 |
+
- **Columns**: `Date`, `Open`, `High`, `Low`, `Close`, `Adj Close`, `Volume`
|
| 41 |
+
- **Timeframe**: 2014 to early 2024
|
| 42 |
+
- **Frequency**: Minute-level data aggregated to daily prices.
|
| 43 |
+
|
| 44 |
+
---
|
| 45 |
+
|
| 46 |
+
## Project Workflow
|
| 47 |
+
### 1. Data Preparation
|
| 48 |
+
- Import libraries and load the dataset.
|
| 49 |
+
- Perform initial exploration to understand the data structure.
|
| 50 |
+
|
| 51 |
+
### 2. Data Cleaning
|
| 52 |
+
- Handle missing values and duplicates.
|
| 53 |
+
- Normalize and standardize the data for better model performance.
|
| 54 |
+
|
| 55 |
+
### 3. Exploratory Data Analysis (EDA)
|
| 56 |
+
- Visualize trends in BTC prices and trading volume.
|
| 57 |
+
- Analyze correlations between features.
|
| 58 |
+
|
| 59 |
+
### 4. Feature Engineering
|
| 60 |
+
- Create sequences of 30 days as input features.
|
| 61 |
+
- Scale features using `MinMaxScaler`.
|
| 62 |
+
|
| 63 |
+
### 5. Modeling
|
| 64 |
+
- Build LSTM and GRU models using PyTorch.
|
| 65 |
+
- Train the models with Mean Squared Error (MSE) loss and Adam optimizer.
|
| 66 |
+
|
| 67 |
+
### 6. Evaluation
|
| 68 |
+
- Evaluate the model using Root Mean Squared Error (RMSE).
|
| 69 |
+
- Visualize predictions against actual prices.
|
| 70 |
+
|
| 71 |
+
### 7. Prediction
|
| 72 |
+
- Predict BTC prices for the next 60 days.
|
| 73 |
+
- Compare predictions with actual future prices.
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## Model Architecture
|
| 78 |
+
The LSTM model consists of:
|
| 79 |
+
- **Input Layer**: Sequence of 30 days of closing prices.
|
| 80 |
+
- **Hidden Layers**: 2 LSTM layers with 64 hidden units.
|
| 81 |
+
- **Output Layer**: Single neuron for predicting the next day's price.
|
| 82 |
+
|
| 83 |
+
---
|
| 84 |
+
|
| 85 |
+
## Results
|
| 86 |
+
- **LSTM Test RMSE**: ~1,118 USD
|
| 87 |
+
- **GRU Test RMSE**: ~21,445 USD
|
| 88 |
+
- The LSTM model outperformed the GRU model, demonstrating its ability to capture sequential patterns in BTC prices.
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
|
| 92 |
+
---
|
| 93 |
+
|
| 94 |
+
## How to Run
|
| 95 |
+
1. Clone the repository:
|
| 96 |
+
```bash
|
| 97 |
+
git clone <repository-url>
|
| 98 |
+
cd Bitcoin-Prediction
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
2. Install dependencies:
|
| 102 |
+
```bash
|
| 103 |
+
pip install -r requirements.txt
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
3. Run the Jupyter Notebook:
|
| 107 |
+
```bash
|
| 108 |
+
jupyter notebook Notebook.ipynb
|
| 109 |
+
```
|
| 110 |
+
|
| 111 |
+
4. Follow the steps in the notebook to train the model and visualize predictions.
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## Future Work
|
| 116 |
+
- Add additional features such as macroeconomic indicators, Moving Average, RSI or sentiment analysis.
|
| 117 |
+
- Perform hyperparameter tuning to further improve model performance.
|
| 118 |
+
- Deploy the model as a web application for real-time predictions.
|
| 119 |
+
|
| 120 |
+
---
|
| 121 |
+
|
| 122 |
+
## References
|
| 123 |
+
- Kaggle Dataset: [BTC-USD Historical Data](https://www.kaggle.com/)
|
| 124 |
+
- PyTorch Documentation: [https://pytorch.org/](https://pytorch.org/)
|
| 125 |
- CoinGecko API: [https://www.coingecko.com/](https://www.coingecko.com/)
|