Bitcoin Historical Data Analysis

Victoria Akintomide
6 min readMar 29, 2021
Photo by André François McKenzie on Unsplash

Bitcoin is the longest running and most well known cryptocurrency, first released as open source in 2009 by the anonymous Satoshi Nakamoto. Bitcoin serves as a decentralized medium of digital exchange, with transactions verified and recorded in a public distributed ledger (the blockchain) without the need for a trusted record keeping authority or central intermediary. Transaction blocks contain a SHA-256 cryptographic hash of previous transaction blocks, and are thus “chained” together, serving as an immutable record of all transactions that have ever occurred. As with any currency/commodity on the market, bitcoin trading and financial instruments soon followed public adoption of bitcoin and continue to grow.

Some interesting facts about Bitcoin:

  • There are only 21 million bitcoins that can be mined in total.
  • Once bitcoin miners have unlocked all the bitcoins, the planet’s supply will essentially be tapped out.
  • As of February 24, 2021, 18.638 million bitcoins have been mined, which leaves 2.362 million yet to be introduced into circulation.
  • Once all Bitcoin has been mined the miners will still be incentivized to process transactions with fees.

In this piece, I have analyzed historical data on Bitcoin which is gotten from Kaggle. The data contains historical bitcoin market data at 1-min intervals for select bitcoin exchanges where trading takes place with minute to minute updates of OHLC (Open, High, Low, Close), Volume in BTC and indicated currency, and weighted bitcoin price. I used Python libraries, Pandas, Numpy, Seaborn and Matplotlib for data cleaning, manipulation and visualization. I used Google Colab, an online platform with an interactive programming environment just like Jupyter Notebooks and access to free computing resources (GPUs and TPUs) which allows for faster computation. The steps I followed are listed as follows:

  1. Importing relevant libraries and dataset
#importing required librariesimport pandas as pdimport numpy as npimport seaborn as snsimport matplotlib.pyplot as pltimport warningswarnings.filterwarnings('ignore')#importing datasetbitcoin_data = pd.read_csv('/content/drive/MyDrive/bitstampUSD_1-min_data_2012-01-01_to_2020-12-31.csv')

2. I performed basic exploration of my dataset using pandas methods: head(), info(), describe() and tail().

The dataset contains 4727777 entries with 8 columns. The columns are in integer and float numeric format. I also checked for null values and discovered that about 27% of the data contain NaN values corresponding to times without any trades or activity for that 1 -minute time interval. I decided to drop these values for the rest of my analysis.

3. The Timestamp column is in Unix Time, will be converted to datetime format. I used the datetime library to do this and then set the Timestamp column to the index.

#converting the Timestamp column to datetime formatimport datetimebitcoin_data['Timestamp'] = bitcoin_data['Timestamp'].apply(lambda x: datetime.datetime.fromtimestamp(int(x)).strftime('%Y-%m-%d %H:%M:%S'))bitcoin_data['Timestamp'] = pd.to_datetime(bitcoin_data['Timestamp'])bitcoin_data = bitcoin_data.set_index('Timestamp')

4. I then performed Univariate Analysis of each of the columns.

The Opening Price of Bitcoin has steadily been increasing over the years with the opening price at 31st December, 2020 being 28893.21(USD). In June of 2019, the cryptocurrency hit a high of $14,000, but dipped after that period. It hit another peak at November 4th and continued gaining steadily every day with a opening price of 55,949.09(USD) as at today 29th March, 2021. The Kernel Density Estimate + Histogram plot is used for visualizing the probability density of a continuous variable. It depicts the probability density at different values in the opening price values.

The Closing Price per day of Bitcoin has steadily been increasing over the years with the price at 31st December, 2020 being 28928.49(USD). There was a notable fall in price in the year 2019, but the cryptocurrency is steadily gaining every day with a closing price of 57,196.16(USD) as at today 29th March, 2021. Despite the peaks and troughs in the price of BTC, investors have insisted that the cryptocurrency will be able to push past and continue to rise as it has push past several dips and highs in its history. This speculation has lead to an increase in Bitcoin’s value.

The volume of BTC traded per min-interval timeseries is shown above, with the highest volume of BTC was traded on 2014–10–05 15:46:00 with a volume of 5853.852166 BTC with 1761470 USD and at a price of 306.86 BTC-USD. Over the years since then, the BTC volume traded has been steadily very little as the more than 18 million has already been mined.

bitcoin_data[bitcoin_data['Volume_(BTC)'] == bitcoin_data['Volume_(BTC)'].max() ]

As the price of Bitcoin increases over the years, more money is spent to purchase this cryptocurrency as can be seen from the plot above. The highest volume of currency traded per min-interval was at 2020–05–20 15:15:00 with 10445987.794 USD at a BTC-USD price of 9724.89 and the volume of 1098.349384 BTC.

bitcoin_data[bitcoin_data['Volume_(Currency)'] == bitcoin_data['Volume_(Currency)'].max()]

5. The correlation between the variables in the dataset is seen below.

The opening, closing, highest, lowest and weighted prices were strongly correlated as they contain the prices of BTC. The volume of BTC , the volume of currency traded and the price were weakly correlated. Another reason for Bitcoin’s rise is the growing inflation of the U.S. dollar. The recent stimulus spending is poised to greatly increase the level of inflation and decrease the dollar’s purchasing power.

6. I was interested in the day with the highest difference in price between the Highest and Lowest Prices of BTC. I created a new column ‘Diff’ in my dataset.

#create new column Diff_Pricebitcoin_data["Diff_Price"] = bitcoin_data["High"] - bitcoin_data["Low"]

The difference in daily prices is plotted above with highest difference occurring on 2020–11–05 17:33:00. The price difference at this time interval was 850.00(BTC-USD). The difference between the price is also on a steady rise with frequent occurrences of this kind of increase especially since 2018.

There are two major reasons why Bitcoin’s value keeps appreciating over the years. Firstly, there is only 21 million Bitcoin that will ever exist. There will be no more and no less and this number will always stay static. This makes bitcoin more scarce than anything that has come before it. Other scarce assets are not 100% finite and in some cases, they can be synthetically manufactured.

Secondly, there is a process coded into Bitcoin called the halving. Essentially, Bitcoin has its own built-in escrow mechanism where Bitcoin is released and given to miners as a reward for processing transactions. This reward is cut in half every four years.

By doing so, Bitcoin’s rate of inflation is reduced by half each halving and its stock-to-flow ratio is doubled each halving. This process continues every four years until all Bitcoin in this escrow mechanism is released and in circulation. From that point on Bitcoin in circulation will be capped at 21 million.

References

  1. Conway, L. (2020, December 09). Why is bitcoin’s price rising? Retrieved March 29, 2021, from https://www.investopedia.com/tech/cryptocurrency-this-week/
  2. Bitcoin USD (btc-usd) STOCK historical prices & data. (2021, March 28). Retrieved March 29, 2021, from https://finance.yahoo.com/quote/BTC-USD/history/

You can connect with me on LinkedIn and Twitter in case of any questions or interesting ideas to share with me. Happy Reading!!!.

--

--