Article complete

Guide To CoinMarketCap Dataset For Time Series Analysis - Historical prices Of All Cryptocurrencies

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.

Line graphs depicting cryptocurrency price trends alongside the CoinMarketCap logo on a blue background.

Key takeaways

  • CoinMarketCap is the leading platform for cryptocurrency pricing and information since its establishment in 2013.
  • The platform provides unbiased and timely data crucial for users navigating the rapidly changing crypto market.
  • Cryptocurrencies are becoming increasingly accessible and are transforming traditional money market scenarios.
  • Blockchain technology underpins cryptocurrencies, offering secure and decentralised systems that address long-standing organisational challenges.

Takeaways drafted with AI from the article text.

Time Series 

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.

Conclusion

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.

Published

Spotted an error? Tell our editors. Read our editorial standards and corrections.