Historical Volatility

# How To Calculate Volatililty

### Introduction

In the field of financial engineering, volatility is one of the many variables describing behaviour or price movements. Monte carlo models are option pricing models are two examples in which volatilities are taken as part of the main input. Where do we obtain this volatility numbers and how are they calculated?

A historical volatility number is calculated from observed/historical prices. An implied volatility (in option pricing models), on the other hand, is the volatility implied from the value option model, solved via a formula or through iterations. Implied volatility calculation was implemented in 'Measuring Volatility Smile/Frown with Black Model'. This article, on the other hand, will dive into calculating the historical volatility.

### Historical Volatility

#### Returns: Normal vs Natural Log

For the most part of financial engineering, volaitity is measured on the return of price movement, instead of prices themselves. The returns are assumed to be log normally distributed. Why log normal and not just normal, and whats the difference?

Consider a stock's previous closing price of 100 and today's closing at 150. Our normal calculation of return is the last closing divide by the previous closing minus 1 i.e.

\begin{align} \textrm{return} &= \dfrac{150}{100} -1\\ &=50\textrm{%} \end{align}

If the next day closing price is back to 100 from 150:

\begin{align} \textrm{return} &= \dfrac{100}{150} -1\\ &=-33.33\textrm{%} \end{align}

Calculation of return using log is using the natural log, $$ln$$, or the log with natural numbers, $$e$$, as its base. For the first day, the return will be:

\begin{align} \textrm{return} &= ln\left(\dfrac{150}{100} \right)\\ &=40.55\textrm{%} \end{align}

And when the price falls back from 150 to 100, the return is:

\begin{align} \textrm{return} &= ln\left(\dfrac{100}{150} \right)\\ &=-40.55\textrm{%} \end{align}

Natural log return illustrates the advantage that given a quantum of price change, 50 in this case, the return is the same regardless of whether the movement is up or down. The sum of daily returns will also makes more sense, as it gives 0.00% return, where as the return over the two-day period will need to be recalculated for the normal way of calculating returns.

#### Sample Data

For illustration, we use USD/MYR historical data from June 17, 2019 to June 17, 2020 and presented in Table 1. The log returns were calculated and in column 'Return (%)'

User may download their own data via csv file. The only field name required is 'close'. Other fields in the following table - 'date', 'open', 'high' and 'low' are only for visual. 'return' column is calculated by the system.

Table 1: USD\MYR historical data

So whats the volatility of the USD\MYR rate? The volatility is nothing more than standard deviation of the returns. Applying the standard deviation formula on the returns we obtained 0.317% (we used numpy.std() for the purpose). The number is the daily volatility of USD/MYR for the period. The volatility is often annualized but it is not simply daily volatility x number of days in a year as we would have done for interest rate.

Firstly, prices are only available on working days and as a standard it has been accepted that there are 252 working days in a year. Secondly, in statistics, annualising standard deviation from a daily number follows the following simple formula:

\begin{align} \sigma_A &= \sigma_d\sqrt{T} \\ \textrm{where }\sigma_A &= \textrm{annualized volatility}\\ \sigma_d &= \textrm{daily volatility}\\ T &= \textrm{number of days in a year} \end{align}

Our annualised volatility using the above formula is 5.0322%.

#### Some Applications of Volatility Numbers

##### Option Pricing Models

All option pricing models need volatility numbers to estimate the behaviour of price movement and estimate the expected value of the option. These models however, do not use historical volatilities directly. Instead, volatility is estimated or implied from options traded in the market. Volatilities in this case are not constant, but may have a shape across tenor (term structure), skewness and/or kurtosis across different strikes. In advance option course, volatility surface and local volatilities are also thought but these topics are out of our current scope.

##### Risk Management

VaR or value at risk uses historical volatilities in its calculation together with correations numbers. We will illustrate how to calculate VaR in detail in another article.

#### Summary

Volatility for financial engineering mostly uses the log return of daily prices. Daily volatilities can be annualized using a simple formula and its applications are numerous. One application that make buzz in the mid 90s and used until today is value at risk, VaR which JP Morgan documented their application in the RiskMetrics. Click here to download the document.