Home > other >  Financial Data Analysis with Python
Financial Data Analysis with Python

Time:01-02

I would like to perform data analysis. Indeed I would like to analyze the potential correlations between the price of CAC40 and Bitcoin. For that I did data scrapping and I was able to import the values of CAC40 and Bitcoin over the last two years. Here is the script below using the yahoo finance package.

import yfinance as yf

cac='^FCHI'
data=yf.Ticker(cac)
dataDF= data.history(periode='1d', start='2020-1-1', end='2022-1-1')
dataDF

btc='BTC-USD'
data2=yf.Ticker(btc)
dataDF2= data2.history(periode='1d', start='2020-1-1', end='2022-1-1')
dataDF2

I get 6 columns (date, open price, higher price, lower price, close price, volume) for CAC40 and for Bitcoin. Now I would like to analyze thoses results. Could you give me the histogram and correlation graph scripts to highlight my results?

I have already done that :

import matplotlib.pyplot as plt
dataDF['Close'].plot()
plt.show()

Thank you in advance for your answers !!

CodePudding user response:

you can load both into the plot and then show it:

import matplotlib.pyplot as plt
dataDF['Close'].plot()
dataDF2['Close'].plot()
plt.show()

and/or

import matplotlib.pyplot as plt
dataDF['Close'].plot.hist()
dataDF2['Close'].plot.hist()
plt.show()

CodePudding user response:

Thanks ! Do you think it is possible to have the script for a Correlation points cloud ?

  • Related