Cryptocurrencies are a fast adapting medium of digital currency over the globe. These digital currencies are easily available to purchase with authenticity on many different websites, making it accessible to everyone, and with retailers accepting and trading various cryptocurrencies, money market scenarios are changing and going through a major change. Cryptocurrency is based on blockchain technology, which is a revolutionarily distributed digital backbone. Blockchain implements secure, decentralized systems that can aid in conquering organizational issues of trust, privacy, and security that have been around the work culture throughout the ages.
CoinMarketCap is the world’s largest crypto market capitalization’s most trusted and accurate source for pricing and information. CoinMarketCap is a U.S. based company. Since its launch in 2013, CoinMarketCap has been the go-to place for the price-tracking website for cryptocurrencies. Every trading market references CoinMarketCap for comparing crypto entities on every minute, rapidly changing cryptocurrency space. CoinMarketCap is best known for its unbiased, timely, accurate information that enables each user to conclude the data.
For these continuous changes of values over a while, time series analysis and forecasting are used. Recurrent Neural Networks and Long Short Term Memory are an important part of machine learning algorithms being used for time-series predictions.
For demonstration, we will be using complete cryptocurrency market history data from Kaggle, which has data scrapped from CoinMarketCap 2014 to 2018 containing 887 cryptos token information. Now let’s do some time series analysis on this data to infer insights out of it.
# importing libraries import pandas as pd import numpy as np import matplotlib.pyplot as plt
# data exploration # making date as index df = pd.read_csv("cryptocurrency-market-history-coinmarketcap/all_currencies.csv",parse_dates=["Date"], index_col="Date") df.head(5)
The dataset consists of 8 attributes:
- Date: The date of observation.
- Symbol: The symbol of a particular crypto token.
- Open: The opening price of the stock of each day.
- High: The highest value over the period.
- Low: The lowest value over the period.
- Close: The closing price each day of the stock.
- Volume: The total amount of security changes over a given period.
- Market Cap: It is the total amount in the dollar market value of a company’s outstanding shares.
# Statistical analysis df.describe()
# Bar graph showing each year closing price df['Close'].resample('Y').mean().plot(kind='bar')
# A lag plot compares data points from each observation in the dataset against data points from a previous observation from pandas.plotting import lag_plot lag_plot(df['Volume'].tail(250))
# Top 10 cryptocurrencies in 2018 Market Cap wise ax = df.groupby(['Symbol'])['Market Cap'].last().sort_values(ascending=False).head(10).sort_values().plot(kind='barh') ax.set_xlabel("Market cap (in billion USD)") plt.title("Top 10 Currencies by Market Cap")
# Top 10 cryptocurrencies in 2018 Volume-wise ax = df.groupby(['Symbol'])['Volume'].last().sort_values(ascending=False).head(10).sort_values().plot(kind='barh') ax.set_xlabel("Transaction Volume (in million)") plt.title("Top 10 Currencies by Transaction Volume")
# Defining The top 5 cryptocurrencies top_5_currency_names = df.groupby(['Symbol'])['Market Cap'].last().sort_values(ascending=False).head(5).index data_top_5_currencies = df[df['Symbol'].isin(top_5_currency_names)] data_top_5_currencies.head(5)
# Yearly Trend Charts # Closing Price ax = data_top_5_currencies.groupby(['Date', 'Symbol'])['Close'].mean().unstack().plot(); ax.set_ylabel("Price per 1 unit (in USD)"); plt.title("Price per unit of currency");
# Market Capitalization ax = data_top_5_currencies.groupby(['Date', 'Symbol'])['Market Cap'].mean().unstack().plot(); ax.set_ylabel("Market Cap (in billion USD)"); plt.title("Market cap per Currency");
# Volume ax = data_top_5_currencies.groupby(['Date', 'Symbol'])['Volume'].mean().unstack().plot(); ax.set_ylabel("Transaction Volume (in million)"); plt.title("Transaction Volume per Currency");
The complete notebook is available here.
In this article, we’ve successfully implemented time series analysis over the CoinMarketCap dataset for all cryptocurrency prices and had a clear understanding of the trends with respect to volume, closing price, and market capitalization.