What is the FTSE 100 index?
FTSE is Financial Times Stock Exchange. This is a share index of the 100 companies listed on the London stock exchange.
How to get data in python?
There are many ways to collect data, I am taking historical data from yahoo finance.
What is code in python to get data?
df = yf.download('^FTSE',
start='1985-01-01',
end='2021-07-28',
progress=False)
How to convert ftse100 data adj column in python?
df = df.loc[:, ['Adj Close']]
df.rename(columns={'Adj Close':'adj_close'}, inplace=True)
How to get simple and log return FTSE100 in python?
df['simple_rtn'] = df.adj_close.pct_change()
df['log_rtn'] = np.log(df.adj_close/df.adj_close.shift(1))
How to see simple and log return ftse100 in python?
df[['simple_rtn','log_rtn']].tail(20)
How to plot ftse100 log return in python?
simple and log return ftse100
How to plot time series ftse100 in python?
fig, ax = plt.subplots(3, 1, figsize=(24, 20), sharex=True)
df.adj_close.plot(ax=ax[0])
ax[0].set(title = 'FTSE time series',
ylabel = 'Stock price ($)')
df.simple_rtn.plot(ax=ax[1])
ax[1].set(ylabel = 'Simple returns (%)')
df.log_rtn.plot(ax=ax[2])
ax[2].set(xlabel = 'Date',
ylabel = 'Log returns (%)')
ftse100 time series
How to plot 3 volatility ftse100 in python?
fig, ax = plt.subplots()
ax.plot(df_outliers.index, df_outliers.simple_rtn,
color='blue', label='Normal')
ax.scatter(outliers.index, outliers.simple_rtn,
color='red', label='Anomaly')
ax.set_title("FTSE100 returns")
ax.legend(loc='lower right')
How to draw ftse100 daily return?
df.log_rtn.plot(title='Daily FTSE returns')
0 Comments