Guide To Implementing Time Series Analysis: Predicting Bitcoin Price With RNN

In our previous articles, we have talked about Time Series Forecasting and Recurrent Neural Network. We explored what it is and how it is important in the class of Machine Learning algorithms. We even implemented a simple LSTM Network to evaluate its performance on the MNIST dataset. In this tutorial, we will take it a little further by forecasting a real-world data.

The cryptocurrency market has seen its rise and fall in the past few years. With a variety of coins being exchanged for real money, it is important to know the trend in the coin price. In this article, we will build a fairly simple LSTM network to predict or forecast the prices of Bitcoin.

Obtaining Bitcoin Data

There are plenty of open sources available on the internet to extract historical data of Bitcoin prices. The one that I have used below is from Coinmarketcap.

AIM Daily XO

Join our editors every weekday evening as they steer you through the most significant news of the day, introduce you to fresh perspectives, and provide unexpected moments of joy
Your newsletter subscriptions are subject to AIM Privacy Policy and Terms and Conditions.

You can view and download the dataset here.

Loading And Understanding The Data

Importing Necessary Libraries

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd


Download our Mobile App



Importing The Dataset

complete_data = pd.read_excel('BitCoin_Prices.xlsx')
print(complete_data.head(20))

Output:

The dataset consists of 7 features. This is how most of the stock information datasets will look like. 

  1. Market Capitalisation/Market Cap: It is the total dollar market value of a company’s (in this case Bitcoin) outstanding shares.
  2. Volume: The total amount of security that changes hands over a given period of time (In this case the time period is one day)
  3. Close: The closing price of the stock(Bitcoin price at the end of the day).
  4. Low: Low denotes the lowest value or drop over the complete time period.
  5. High: The highest value or rise over the complete time period.
  6. Open: The opening price of the stock of a particular day.
  7. Date: The date of observation.

In this use case, we will predict the closing price of Bitcoin on a particular day, given the prices of Bitcoin over the past few days.

Let’s code!


Sign up for The Deep Learning Podcast

by Vijayalakshmi Anandan

The Deep Learning Curve is a technology-based podcast hosted by Vijayalakshmi Anandan - Video Presenter and Podcaster at Analytics India Magazine. This podcast is the narrator's journey of curiosity and discovery in the world of technology.

Amal Nair
A Computer Science Engineer turned Data Scientist who is passionate about AI and all related technologies. Contact: amal.nair@analyticsindiamag.com

Our Upcoming Events

24th Mar, 2023 | Webinar
Women-in-Tech: Are you ready for the Techade

27-28th Apr, 2023 I Bangalore
Data Engineering Summit (DES) 2023

23 Jun, 2023 | Bangalore
MachineCon India 2023 [AI100 Awards]

21 Jul, 2023 | New York
MachineCon USA 2023 [AI100 Awards]

3 Ways to Join our Community

Telegram group

Discover special offers, top stories, upcoming events, and more.

Discord Server

Stay Connected with a larger ecosystem of data science and ML Professionals

Subscribe to our Daily newsletter

Get our daily awesome stories & videos in your inbox
MOST POPULAR

Council Post: Evolution of Data Science: Skillset, Toolset, and Mindset

In my opinion, there will be considerable disorder and disarray in the near future concerning the emerging fields of data and analytics. The proliferation of platforms such as ChatGPT or Bard has generated a lot of buzz. While some users are enthusiastic about the potential benefits of generative AI and its extensive use in business and daily life, others have raised concerns regarding the accuracy, ethics, and related issues.