NEW+--
Min 75% OFF | Pay Day Sale Extended till 3rd June
Move Left Complete list

Realized Volatility

Introduction

Realized volatility refers to the measure of daily changes in the price of a security over a particular period of time. It assumes the daily mean price to be zero in order to provide movement regardless of direction.  It is different from Implied volatility in the sense that realized volatility is the actual change in historical prices, while implied volatility predicts future price volatility. Realized volatility can be calculated by firstly calculating continuously compounded daily returns using the following formula:

 

 

where, Ln = natural logarithm
 

Pt = Underlying Reference Price (“closing price”) at day t


Pt–1 = Underlying Reference Price at day immediately preceding day t


Then, by plugging the value of Rt in the formula below:

 

 

where, Vol = Realized volatility


252 = approximate number of trading days in a year


t = a counter representing each trading day


n = number of trading days in the specific time frame


Rt = continuously compounded daily returns
 


 

Advantages

  • The realized volatility is the measure of the historical performance of an asset which implies that one comes to know if the asset’s price has been fluctuating a lot or not. Hence, the asset’s volatility is predicted by the historical performance.

  • The realized volatility also concentrates on the time period and hence you can analyse a particular time period in this manner.
  • For measuring the implied volatility (future volatility), an analysis of historical performance is always helpful. Hence, realized volatility is the base of implied volatility.

 


 

Disadvantages

The only disadvantage of the realized volatility is that it does not take into account the current price and also does not look into the future volatility, unlike implied volatility. Hence, realized volatility is actually directionless and simply chases the upward and downward trends of the historical data.

 

Let us find out realized volatility with the help of Python. We begin with extracting the data from yahoo finance. We will take Amazon’s data here.
 

# For data manipulation

import pandas as pd

import numpy as np

# To fetch financial data

import yfinance as yf

# Download the price data of Apple from Jan 2019 to Dec 2019

# Set the ticker as 'AAPL' and specify the start and end dates

price_data_AMZN= yf.download('AMZN', start='2020-11-06', end='2023-1-3', auto_adjust = True)

price_data_AMZN


Output:


[*********************100%***********************]  1 of 1 completed

 

Output:

 

Open

High

Low

Close

Volume

Date

         

2020-11-05

165.998505

168.339996

164.444000

166.100006

115786000

2020-11-06

165.231995

166.100006

161.600006

165.568497

92946000

2020-11-09

161.551498

164.449997

155.605499

157.186996

143808000

2020-11-10

154.751007

155.699997

150.973999

151.751007

131820000

2020-11-11

153.089005

156.957504

152.500000

156.869507

87338000

...

...

...

...

...

...

2022-12-23

83.250000

85.779999

82.930000

85.250000

57433700

2022-12-27

84.970001

85.349998

83.000000

83.040001

57284000

2022-12-28

82.800003

83.480003

81.690002

81.820000

58228600

2022-12-29

82.870003

84.550003

82.550003

84.180000

54995900

2022-12-30

83.120003

84.050003

82.470001

84.000000

62401200

 

542 rows × 5 columns

 

Now, let us plot the data.
 

import matplotlib.pyplot as plt

%matplotlib inline

# Compute the logarithmic returns using the Closing price

price_data_AMZN['Log_Ret'] = np.log(price_data_AMZN['Close'] / price_data_AMZN['Close'].shift(1))

 
# Compute Volatility using the pandas rolling standard deviation function

price_data_AMZN['Realized Volatility'] = price_data_AMZN['Log_Ret'].rolling(window=252).std() * 
np.sqrt(252)

 
# Plot the AMZN Price series and the Volatility

price_data_AMZN[['Close']].plot(subplots=True, color='blue',figsize=(8, 6))

plt.title('Close price', color='purple', size=15)

 
# Setting axes labels for close prices plot

plt.xlabel('Dates', {'color': 'orange', 'fontsize':15})

plt.ylabel('Prices', {'color': 'orange', 'fontsize':15})

 
price_data_AMZN[['Realized Volatility']].plot(subplots=True, color='blue',figsize=(8, 6))

 
plt.title('Realized Volatility', color='purple', size=15)

 
# Setting axes labels for realized volatility plot

plt.xlabel('Dates', {'color': 'orange', 'fontsize':15})

plt.ylabel('Realized volatility', {'color': 'orange', 'fontsize':15})


# Rotating the values along x-axis to 45 degrees

plt.xticks(rotation=45)


Output:


The output above shows a steep rise in the realized volatility between November 2021 and January 2023.