01/03/2023

Bitcoin price analysis by Python

Bitcoin price analysis

 In this topic, we will try to analyze Bitcoin data. There are many ways to view Bitcoin data; for example, it can be viewed on the Yahoo Finance website at https://finance.yahoo.com.

In this example, we use the Python programming language and Jupyter Notebook.

Here I will try to be brief and focus more on the sequence of the code without much explanation. The goal is to focus on the main idea.

Import libraries

from datetime import datetime
import os
import numpy as np
import pandas as pd
import seaborn as sns
import plotly.graph_objects as pob
import plotly.express as pex
import matplotlib.pyplot as plt   #to deal with graphic charts

 Data upload

 df = pd.read_csv('BTC-USD.csv')
 df.head(5)

Date Open High Low Close Adj Close Volume
0 2014-09-17 465.864014 468.174011 452.421997 457.334015 457.334015 21056800.0
1 2014-09-18 456.859985 456.859985 413.104004 424.440002 424.440002 34483200.0
2 2014-09-19 424.102997 427.834991 384.532013 394.795990 394.795990 37919700.0
3 2014-09-20 394.673004 423.295990 389.882996 408.903992 408.903992 36863600.0
4 2014-09-21 408.084991 412.425995 393.181000 398.821014 398.821014 26580100.0

df.tail(5)


Date Open High Low Close Adj Close Volume
3175 2023-05-28 26871.158203 28193.449219 26802.751953 28085.646484 28085.646484 1.454523e+10
3176 2023-05-29 28075.591797 28432.039063 27563.876953 27745.884766 27745.884766 1.518131e+10
3177 2023-05-30 27745.123047 28044.759766 27588.501953 27702.349609 27702.349609 1.325108e+10
3178 2023-05-31 NaN NaN NaN NaN NaN NaN
3179 2023-06-01 27236.576172 27326.533203 27235.039063 27301.021484 27301.021484 1.596423e+10

#Description of the data
df.describe() 


Open High Low Close Adj Close Volume
count 3179.000000 3179.000000 3179.000000 3179.000000 3179.000000 3.179000e+03
mean 13432.217640 13763.078443 13068.545810 13439.410714 13439.410714 1.659098e+10
std 16028.349128 16432.296940 15565.365494 16025.439960 16025.439960 1.962819e+10
min 176.897003 211.731003 171.509995 178.102997 178.102997 5.914570e+06
25% 741.108002 750.089508 733.108490 741.312989 741.312989 1.219535e+08
50% 7500.700195 7680.430176 7349.120117 7514.470215 7514.470215 9.744636e+09
75% 19510.696289 20034.084961 19129.965821 19545.489258 19545.489258 2.776349e+10
max 67549.734375 68789.625000 66382.062500 67566.828125 67566.828125 3.509679e+11

# to know more more information about the data
df.info()


 
 
 
 
 Correlation

 

 
 Close and Adj close
 
Volume traded by day