""" A FAIRE: 1/ download quotations of CAC40 components (or DJIA, or ...) in daily prices (at least the "close") if possible at lest 5 years Idea: use yahoo e.g., yfinance package "pip install yfinance" Otherwise take the file https://turinici.com/wp-content/uploads/cours/common/close_cac40_historical.csv 1'/ order by increasing date 2/ plot price histogram and returns (with "log" and/or "actuarial") 3/ test normality of : prices, log returns, actuarial returns for instance can use scipy.stats.normaltest ATTENTION: replace "None" by your code !! """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy.stats import normaltest,kstest from scipy.special import softmax # take csv from www cours data = pd.read_csv('close_cac40_historical.csv',sep=';', index_col = 'Date') data.head() # order by increasing date, keep variable 'data' data.sort_index(ascending=True,inplace=True) #data.sort(by='Date',inplace=True) data.head() data.tail() # plot histogram of prices _=data.hist(bins=30, figsize = (15,15)) def normality_test(data,kolmogorov_smirnov=False,level=0.01,print_results=True): """ Tests normality of each column of dataframe "data". Inputs: kolmogorov_smirnov= false: use "normaltest", otherswise use kstest, both from scipy.stats level = p-value threshold level for the conclusions Outputs: the number of yes/no in the results """ pvalues=[] for cols in data.keys(): # normality test if(kolmogorov_smirnov): # put in pv the p-value of the Kolmogorov-Smirnov test pv=kstest(data[cols].dropna(),'norm').pvalue else: # put in pv the p-value of the default scipy.stats normality test pv=normaltest(data[cols].dropna()).pvalue pvalues.append(pv) if(pv