In finance, the volatility smile is the pattern in which in-the-money and out-of-the-money options are observed to have higher implied volatilities than at-the-money options. In the following, I will simulate a series of implied volatility using excel macros.
Implied volatility
Implied volatility of an option contract is the value of volatility of the underlying which is calculated from the pricing model after taking the observed market price as the input. Here the famous Black-Scholes formula will be used, and for simplicity vanilla Eur Call option is considered.
$$C(S,t) = N(d_1)S - N(d_2)Ke^{-r(T-t)}$$ with
$$d_1 = \frac{ln(\frac{S}{K})+(r+\frac{\sigma^2}{2})(T-t)}{\sigma\sqrt{T-t}}$$ $$d_2 = \frac{ln(\frac{S}{K})+(r-\frac{\sigma^2}{2})(T-t)}{\sigma\sqrt{T-t}}$$ then the problem becomes how to work out sigma from the above equation by taking the option's market price as input and Newton's method is used as follows:
$$x_{n+1} = x_n - \frac{f(x_n)}{f'(x_n)}$$ which indicates that we need to calculate:
$$vega = \frac{\partial C}{\partial \sigma} = S\sqrt{T- t}N'(d1)$$ the iteration formula will be:
$$\sigma_{n+1} = \sigma_n - \frac{C(\sigma_n)}{vega(\sigma_n)}$$
a simple implementation in Excel macros:
Function impvol(MarketPrice As Double, StockPrice As Double, Strike As Double,
Interest As Double, Expiry As Double) As Double Dim error As Double Dim volatility As Double Dim d1 As Double, d2 As Double Dim vega As Double Dim PI As Double Dim dv As Double Dim priceerror As Double PI = 3.1415926 error = 0.001 volatility = 0.6 dv = 1 Do While Abs(dv) > error d1 = Log(StockPrice / Strike) + (Interest + 0.5 * volatility ^ 2) * Expiry d1 = d1 / (volatility * Sqr(Expiry)) d2 = d1 - volatility * Sqr(Expiry) vega = StockPrice * Sqr(Expiry / 2 / PI) * Exp(-0.5 * d1 * d1) priceerror = StockPrice * cdf(d1) - Strike * Exp(-Interest * Expiry) * cdf(d2)
- MarketPrice dv = priceerror / vega volatility = volatility - dv Loop impvol = volatility End Function
Function cdf(x As Double) As Double Dim a1, a2, a3, a4, a5 As Double Dim d As Double Dim dd As Double Dim result As Double a1 = 0.31938153 a2 = -0.356563782 a3 = 1.781477937 a4 = -1.821255978 a5 = 1.330274429 If x >= 0 Then d = 1 / (1 + 0.2316419 * x) dd = a1 * d + a2 * d ^ 2 + a3 * d ^ 3 + a4 * d ^ 4 + a5 * d ^ 5 result = 1 - 1 / Sqr(2 * 3.1415926) * Exp(-0.5 * x ^ 2) * dd cdf = result Else d = 1 / (1 + 0.2316419 * (-x)) dd = a1 * d + a2 * d ^ 2 + a3 * d ^ 3 + a4 * d ^ 4 + a5 * d ^ 5 result = 1 - 1 / Sqr(2 * 3.1415926) * Exp(-0.5 * x ^ 2) * dd cdf = 1 - result End If End Function
outcome:
No comments:
Post a Comment