BaşlayınÜcretsiz Başlayın

Calculate volatility

In this exercise, you will practice how to compute and convert volatility of price returns in Python.

Firstly, you will compute the daily volatility as the standard deviation of price returns. Then convert the daily volatility to monthly and annual volatility.

S&P 500 time series has been preloaded in sp_data, and the percentage price return is stored in the ’Return’ column.

Bu egzersiz

GARCH Models in Python

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Plot the price returns
plt.plot(sp_data['____'], color = 'orange')
plt.show()

# Calculate daily std of returns
std_daily = sp_data['____'].____()
print('Daily volatility: ', '{:.2f}%'.format(std_daily))
Kodu Düzenle ve Çalıştır