0% found this document useful (0 votes)
13 views6 pages

Bitcoin_Price_Prediction_Using_LSTM

This paper presents a method for predicting Bitcoin prices using a Long Short-Term Memory (LSTM) model, aiming to forecast the next five days' price trends. The authors discuss the importance of selecting relevant features from the dataset and highlight the challenges of achieving high prediction accuracy due to market volatility and external factors. The study concludes that while the LSTM model shows promise, incorporating additional features could enhance its predictive capabilities.

Uploaded by

Trần Vân Anh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views6 pages

Bitcoin_Price_Prediction_Using_LSTM

This paper presents a method for predicting Bitcoin prices using a Long Short-Term Memory (LSTM) model, aiming to forecast the next five days' price trends. The authors discuss the importance of selecting relevant features from the dataset and highlight the challenges of achieving high prediction accuracy due to market volatility and external factors. The study concludes that while the LSTM model shows promise, incorporating additional features could enhance its predictive capabilities.

Uploaded by

Trần Vân Anh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

International Research Journal of Engineering and Technology e-ISSN: 2395-0056

(IRJET)
Volume: 09 Issue: 04 | Apr 2022 www.irjet.net p-ISSN: 2395-0072

Bitcoin Price Prediction Using LSTM

Rcik Dey1, Saurabh Shukla2, Sarthak Jasani3, Hezal Lopes4

1,2,3Undergraduate Student, Dept. Of Computer Engineering, Universal College of Engineering, Mumbai, India
4Assistant Professor, Dept. Of Computer Engineering, Universal College of Engineering, Mumbai, India
---------------------------------------------------------------------***---------------------------------------------------------------------
Abstract - Bitcoin is one of the most popular and valuable paper, we are predicting the Bitcoin price trend using a
cryptocurrency in the current financial market, attracting Long Short-Term Memory (LSTM) model. Our model is
traders for investment and thereby opening new research aimed to predict the next five day’s price of Bitcoin.
opportunities for researchers. Countless research works
have been performed on Bitcoin price prediction with 2. REVIEW OF LITERATURE
different machine learning prediction algorithms. For the
research: relevant features are taken from the dataset A literature survey was carried out to find various papers
having strong correlation with Bitcoin prices and random published in international journals related to various
data chunks are then selected to train and test the model. Bitcoin price prediction algorithms, and associate the best
The random data which has been selected for model algorithm for the same.
training, may cause unfitting outcomes thus reducing the
price prediction accuracy. Here, a proper method to train a 2.1 Existing Systems
prediction model is being scrutinised. The proposed
methodology is then applied to train a simple Long Short Numnoda et al. [1] have obtained highly accurate results
Term Memory (LSTM) model to predict the bitcoin price for on implementing their prediction Gated Recurrent Unit
the upcoming 5 days. When the LSTM model is trained with (GRU) model. However, their prototype has a large time
a suitable data chunk, thus identified, sustainable results complexity. Thus, complicating the expected results in this
are found for the prediction. In the end of this paper, the ever-changing environment. Additionally, the selected
work culminates with future improvements. features aren’t enough to predict the Bitcoin prices; as
various factors like social media, policies, and laws that
Key Words: Bitcoin, Cryptocurrency, Machine each country announces to deal with digital currency, can
Learning, Price Prediction, LSTM all play a major effect on the fluctuation of the Bitcoin
prices.
1. INTRODUCTION
Mangla et al. [2] have compared four different price
Instead of any direct human investments, generating profit prediction models: Recurrent Neural Networks (RNN),
with the help of algorithms is a common practice in the Logistic Regression, Support Vector Machine, and Auto
stock market. Many case studies have been performed to Regressive Integrated Moving Average (ARIMA). Their
reach the conclusion that mathematical models warrant major findings are that- ARIMA performs poorly for
better results than humans. Bitcoins are an eye catching predictions extending beyond the next day. Their RNN
initiative in the fields of cryptography, economics, and model can accurately predict price fluctuations for up to
computer sciences, as such currencies have a special six days. And the logistic regression model can give
character which is gained when integrating currency units accurate results only if a separable hyperplane exists.
with cryptographic technology. Due to the fact that
cryptocurrency has a minute history, when compared to Guo et al. [3] have used a hybrid method consisting of
the stock market, new and unexplored territories are thus multi-scale residual blocks and an LSTM network to
being scouted. Structurally, both the stock market and the predict Bitcoin price. Although, their work does not
cryptocurrency price data are having characteristics such include comprehensive metrics which measure the
as time series data, but high volatility is routinely present investor’s attention to more timely detection of bitcoin
in the latter, with heavy wavering in the prices. A market volatility, therefore resulting in a less accurate
cryptocurrency market differs from a traditional stock prediction.
market in the respect that the former has a lot of new
features. It is required to apply new techniques for Awoke et al. [4] have considered basic deep learning
prediction suitable for the cryptocurrency market. Fewer models like GRU and LSTM. However, their research lacks
studies have been conducted on cryptocurrency price further investigation to enhance the model accuracy by
prediction when compared to the stock market. In this considering different parameters.

© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 123
International Research Journal of Engineering and Technology e-ISSN: 2395-0056
(IRJET)
Volume: 09 Issue: 04 | Apr 2022 www.irjet.net p-ISSN: 2395-0072

Rana et al. [5], while implementing a highly accurate LSTM


model, have conducted their research on a large scale, thus
making their methodology a bit complex.

3. PROBLEM STATEMENT AND PROJECT SCOPE

3.1 Problem Statement

To develop a model which can help us to predict the price of


the crypto currency used (in this case: Bitcoin), with low error
rate and a high precision of accuracy. The model will not tell
the future, but it might forecast the general trend and the
direction to expect the prices to move.

3.2 Project Scope

While using this model, first, the dataset of the crypto Fig -1: Bitcoin Dataset
currency used needs to be uploaded. This, usually, contains
the various features that the prediction model has to depend The second step involves filtering and cleaning the data
on. For e.g. average block size, total number of Bitcoins set. This involves removing all the incomplete data from
mined, day high & day low (highest and lowest values of the rows. It also involves filtering out unnecessary
different days), number of transactions, trade volume, etc. features present in the data collected. For our model, we
Then, secondly, the dataset will be applied on the regression will only use the columns labelled: Date, Price, Open, High,
model to obtain the predicted price. and Low, as shown in Table 1 below.

What the model proposes to do is that, first the data on Bitcoin Table -1: Features Used In the Dataset
Price fluctuations is gathered, of the past couple of years,
from the internet. Then, after the process of data acquisition, Features Used In The Dataset
the database should be organised. The database is divided into Sr. No. Variable Variable Description Data
various spreadsheet files, which are then uploaded to the Name Type
software mainly used for data processing. The necessary
calculations, like classification and regression, are then done. 1 Time Date and time of Date
And finally the results are evaluated in terms of accuracy, observation
error rates involved. 2 Volume Sum total of trades Numbe
taking place. r
4. DESIGN DETAILS
3 Open Opening price on the Numbe
given day. r
4.1 System Architecture
4. High Highest price on the Numbe
Firstly, we collect the data set from the online source: given day. r
Kaggle. The data set represents the Bitcoin price in United
5. Low Lowest price on the Number
States Dollars (USD). The dataset includes all the
given day.
information about bitcoin prices from 27th October, 2015
to 30th October, 2021.
6. Close Closing price on a given Number
day.

The next step is training, followed by testing the dataset.


We train our model, using the algorithm and the features
taken into account to assist our model, to predict the
future price of the crypto currency. Moving on to the
testing part, we test the data to measure the accuracy of
the algorithm that our model is using to predict the price
of the Bitcoin.

© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 124
International Research Journal of Engineering and Technology e-ISSN: 2395-0056
(IRJET)
Volume: 09 Issue: 04 | Apr 2022 www.irjet.net p-ISSN: 2395-0072

Finally after the processes of training with the help of the


data set features and testing, we evaluate the accuracy of
our model. We compare the predicted price of the crypto
currency, at a given time period with the real world
Bitcoin price at that particular period of time, and evaluate
the accuracy and efficiency of our model.

Fig -3: Lag Plots

We can see that there is a positive correlation for minute,


hour, and daily lag plots. Correlation decreases greatly
with weekly lag, with almost no correlation for monthly
lag plots. Thus, it makes sense to re-sample the data at
most at daily level, thereby preserving the autocorrelation
as well.

5.2 Train-Test Split

Now, the next step that is needed to be performed is train-


test split. For our model, we will be considering sixty
numbers of data samples for implementing the testing,
and the rest of the re-sampled data as the training sample.
We will follow this by plotting a graph of the train-test
split. Figure 4 represents a simple train-test plot of the
Fig -2: System Architecture closing prices.

5. MODEL IMPLEMENTATION

5.1 Lag Plots

After the dataset has been filtered and cleaned, we need to


generate a lag plot of the time series data. A lag in a time
series data defines how much a data point is falling behind
in time from another data point. Lag plots are put into use
to analyse and find out whether the time series data
follows any pattern. They are essential for searching Fig -4: Graph of Train-Test Split
patterns like trends, randomness, and seasonality. The
plot can be brought about by the representation of time 5.3 Scaling
series data in x-axis, and the lag of the time series data
points in the y-axis. We are plotting lag plots for a minute Following this, we are going to scale the data, as we need
lag, an hourly lag, daily lag, weekly lag, and a monthly lag. the training and the test set to be scaled. One important
The lag plots are represented in Figure 3. point that needs to be mentioned is that the scaling should
be performed after the train-test split has been performed,
because scaling before the train-test split would introduce
data leakage from the test set to the training set. Scaling
before train-test split would result in the training process
getting influenced by the test set, thus resulting in a bad
prediction from the model.

© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 125
International Research Journal of Engineering and Technology e-ISSN: 2395-0056
(IRJET)
Volume: 09 Issue: 04 | Apr 2022 www.irjet.net p-ISSN: 2395-0072

5.4 Data Generator 5.7 LSTM Prediction using testX and plotting line
graph against actual testY
Post scaling, we will proceed with making the data
generator function, which will make the data ready for the Due to scaling done earlier with the help of MinMaxScaler,
LSTM model feed. We frame our model, using a “lookback” the predicted scale will be between zero and one. We have
period to take a window of the last five days of data to to transfer this scale to the original data scale. Thus, we
predict the data of the current day. A new function is are going to use inverse transformation to scale back the
defined, which will split the input sequence into windows data to the original presentation, as shown in Figure 6.
of data appropriate for fitting a LSTM model. We need to
define a lookback period which tells us how many
previous timesteps are used to predict the subsequent
timestep.

5.5 Restructuring Input into a shape of 3D Tensor


Fig -6: Inverse transformation on test data
For LSTM, we have to reshape the input data into the
shape of a three dimensional Tensor of samples, timesteps, After that, we are generating a graph plot of the actual test
and features. Samples are the amount of data points that data (in blue) along with the predicted test data (in red),
we are having. A sample consists of multiple timesteps, in Figure 7. Here, we can see that the predicted test data
which define the width of the sliding window. It should be and actual test data are moving in tandem.
noted that timesteps are different from the sliding step of
the sliding window. Thus, timesteps is equivalent to the
number of time steps we are to be running our RNN.
Finally, features include the amount of features in every
timestep.

5.6 Generating the epochs

From the callback module of the keras library we are Fig -7: Plot of predicted test and actual test data
importing the callbacks: ModelCheckpoint, and
EarlyStopping. These callbacks are used as a best practice 5.8 LSTM Prediction using trainX and plotting
to save the model at various checkpoints or after each line graph against actual trainY
epoch. Also, EarlyStopping is used to stop the training
when the best loss is reached, that is, when a monitored This step is similar to the previous step, except the fact
metric has stopped improving. that we are performing inverse transformations on the
train data.

Fig -8: Inverse transformation on train data

Following that, we will generate the plot for predicted


train data (in red) and the actual train data (in blue). In
Figure 9 we can see that the graph for predicted train and
actual train are quite synced as they are trained data
points.

Fig -5: Code for the generation of epoch

© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 126
International Research Journal of Engineering and Technology e-ISSN: 2395-0056
(IRJET)
Volume: 09 Issue: 04 | Apr 2022 www.irjet.net p-ISSN: 2395-0072

samples, timesteps, and features, since the LSTM needs the


input to be fed into its model. We are using the last five
elements in the three dimensional tensor.

Thus, we are looping this process five times, with each


iteration generating the predicted price for the upcoming
five days consecutively.

Fig -9: Plot of predicted train and actual train data Finally, we are generating a graph of the entire prediction
of the test data (including the future five days) against
5.9 Root Mean Square Error actual testY, as shown in Figure 12. Up to 30th October,
2021, we book the predicted test data (in red) and the
Finally, we will be generating the root mean square error actual test data (in blue) on the ground, because this is the
(RMSE) for both the test and the train data. RMSE is the time period for which we have the actual ground truth.
measure of how well a regression line will fit the data Beyond the aforementioned date we are having only the
points. forecasted price of Bitcoin.

Fig -10: RMSE of test data

Following this, we also generate the RMSE of train data.


The RMSE loss achieved for train data is much lesser
compared to the RMSE loss for test data, because the
whole training and fit function was run on the training Fig -12: Plot of the entire test data prediction (including
data set. the five future days) and actual testY

7. CONCLUSIONS AND FUTURE WORK

The LSTM model, implemented here, is a basic model that


takes into consideration only a few features that affect the
Fig -11: RMSE of train data Bitcoin price. Our model is fairly accurate when predicting
the future prices. However, to increase the efficiency of the
6. RESULTS model, more Bitcoin price features need to be taken into
consideration. We recommend using Kaggle as the source
Now that we have a trained LSTM model on historical of datasets, since information present in this website holds
data, we are generating predictions on Bitcoin prices for a high degree of authenticity. Our future work would
the future five days. From the dataset that we use for the include in-depth scrutinisation on the topic of LSTM, and
model, the Bitcoin price on 30th October, 2021 is the last deep learning at large. Such fact-findings would be
historical price that we are having. Thus now, we are going beneficial for forecasting the prices of cryptocurrencies
beyond that date to predict the Bitcoin prices on the next with the help of LSTMs, in the future.
five days. It should also be noted that we are again using
the lookback period to predict the future price of the next
ACKNOWLEDGEMENT
day. Here, the lookback period is set to five days, that is,
using the information on the Bitcoin prices of the
We take this opportunity to extend our deep and humble
immediately preceding five days, we are predicting the
gratitude to our project guide: Prof. Hezal Lopes, and
Bitcoin price for the next day.
project organiser: Prof. Vishakha Shelke, for their
Our model is implementing sixty numbers of data points continuous support & guidance to help us navigate
for testing. It should be noted that the testX has been through our Major Project work. It is on account of their
reshaped into a three dimensional array in the form of expertise and tremendous knowledge that we have

© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 127
International Research Journal of Engineering and Technology e-ISSN: 2395-0056
(IRJET)
Volume: 09 Issue: 04 | Apr 2022 www.irjet.net p-ISSN: 2395-0072

accomplished the Major Project in the prescribed time. We


would also like to extend our thanks to Dr. Jitendra
Saturwar, the Head of the Computer Engineering
Department, for his steadfast guidance and support.
Additionally, we would also like to extend our thanks to
our Principal: Dr. J. B. Patil, and the management faculty of
Universal College of Engineering, Vasai, for providing us
with all the necessary facilities and a work friendly
environment. We tend to acknowledge with humble
appreciation, the support provided by the division
employees, library and the research lab attendants.

REFERENCES

[1] T. Phaladisailoed, and T. Numnoda, “Machine Learning


Models Comparison for Bitcoin Price Prediction,” 10 th
International Conference on Information Technology and
Electrical Engineering, 2018.

[2] Neha Mangla, Akshay Bhat, Ganesh Avarbratha, and


Narayana Bhat, “Bitcoin Price Prediction Using Machine
Learning,” International Journal of Information and
Computer Science, Volume 6, Issue 5, May 2019.

[3] Q. Guo, S. Lei, Q. Ye, Z. Fang “MRC-LSTM: A Hybrid


Approach of Multi-scale Residual CNN and LSTM to Predict
Bitcoin Price,” MDPI, May 2021.

[4] T. Awoke, M. Rout, L. Mohanty, S. C. Satapathy, “Bitcoin


Price Prediction and Analysis Using Deep Learning
Models,” ResearchGate.

[5] A. Rana, R. Kachchhi, J. Baradia, V. Shelke “Stock


Market Prediction Using Deep Learning” International
Research Journal of Engineering and Technology, Volume
8, Issue 4, April 2021.

© 2022, IRJET | Impact Factor value: 7.529 | ISO 9001:2008 Certified Journal | Page 128

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy