cryptocurrency Predict cryptocurrency prices with Deep Learning (1)
23-02-27
본문
Actually, this post wasn't planned, but the blog has been getting a little too theoretical, so I thought it would be a good refresher to show you how to use deep learning to predict cryptocurrency prices.
Many factors affect the price of a stock or cryptocurrency.
These include economic indicators (GDP, inflation, unemployment), the performance of a company or project team, infrastructure and security issues, political factors, and market supply and demand.
However, in this blog, we're going to take a more technical approach and use data analytics to make predictions.
I've opened up all of my code below for your reference : )
I recommend that you try to understand the code before reading it verbatim.
There are many deep learning models for predicting prices, such as stocks and cryptocurrencies, but the most popular model currently in use is Long Short-Term Memory (LSTM).
LSTMs are well suited for dealing with time series data and are part of the recurrent neural network (RNN) family of models.
The advantage of LSTM models is that they are trained with a mechanism for remembering information from previous points in time, which makes them well-suited to handling time series data for predicting the price of stocks, cryptocurrencies, etc.
For the sake of simplicity, we'll use a deep learning LSTM model to predict cryptocurrency prices.
I'm Korean and will use data from Bithumb, one of the most popular cryptocurrency exchanges in Korea.
The LSTM model needs to find the optimal model by adjusting various hyperparameters, and we used Adam optimizer as the optimization algorithm.
In the code below, we define the create_dataset function to convert the closing price data into a time series after normalizing it to 0 and 1 using MinMaxScaler.
Since the input data to the LSTM model must be organized as a three-dimensional tensor, we use reshape to reorganize the data. The model is constructed by stacking two LSTM layers and outputting as a dense layer. For the optimization algorithm, we used Adam optimizer.
1. The first thing we need to do is install the following packages so that we can perform the code below.
2. Then import the following libraries.
3. We've added input functionality to make this code more user-friendly.
You can enter the symbol of the desired cryptocurrency and enter the time period you want to look up.
Note that this is based on the Bithumb exchange, so you need to check the symbols registered on Bithumb.
Example: https://www.bithumb.com/trade/order/BTC_KRW