LoslegenKostenlos loslegen

Observe volatility clustering

Volatility clustering is frequently observed in financial market data, and it poses a challenge for time series modeling.

In this exercise, you will get familiar with the S&P 500 daily price dataset. You will calculate daily returns as the percentage price changes, plot the results and observe its behavior over time.

Historical S&P 500 daily price data has been preloaded in sp_price for you.

Diese Übung ist Teil des Kurses

GARCH Models in Python

Kurs anzeigen

Anleitung zur Übung

  • Calculate daily returns as percentage price changes and save it to the DataFrame sp_price in a new column called Return.
  • View the data by printing out the last 10 rows.
  • Plot the Return column and observe signs of volatility clustering.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Calculate daily returns as percentage price changes
sp_price['____'] = 100 * (sp_price['Close'].____())

# View the data
print(sp_price.____(____))

# plot the data
plt.plot(sp_price['____'], color = 'tomato', label = 'Daily Returns')
plt.legend(loc='upper right')
plt.show()
Code bearbeiten und ausführen