Learn R Programming

RND (version 1.2)

compute.implied.volatility: Compute Impied Volatility

Description

compute.implied.volatility extracts the implied volatility for a call option.

Usage

compute.implied.volatility(r, te, s0, k, y, call.price, lower, upper)

Arguments

r
risk free rate
te
time to expiration
s0
current asset value
k
strike of the call option
y
dividend yield
call.price
call price
lower
lower bound of the implied volatility to look for
upper
upper bound of the implied volatility to look for

Value

Details

The simple R uniroot function is used to extract the implied volatility.

References

J. Hull (2011) Options, Futures, and Other Derivatives and DerivaGem Package Prentice Hall, Englewood Cliffs, New Jersey, 8th Edition

R. L. McDonald (2013) Derivatives Markets Pearson, Upper Saddle River, New Jersey, 3rd Edition

Examples

Run this code
#
# Create prices from BSM with various sigma's
#

r     =  0.05
y     =  0.02
te    =  60/365
s0    =  400

sigma.range = seq(from = 0.1, to = 0.8, by = 0.05)
k.range     = floor(seq(from = 300, to = 500, length.out = length(sigma.range)))
bsm.calls   = numeric(length(sigma.range))

for (i in 1:length(sigma.range))
{
  bsm.calls[i] = price.bsm.option(r = r, te = te, s0 = s0, k = k.range[i], 
                                  sigma = sigma.range[i], y = y)$call
}
bsm.calls
k.range

#
# Computed implied sigma's should be very close to sigma.range.
#

compute.implied.volatility(r = r, te = te, s0 = s0, k = k.range, y = y, 
                          call.price = bsm.calls, lower = 0.001, upper = 0.999)
sigma.range

Run the code above in your browser using DataLab