implyVolatility: imply the volatility of the certificate with Newton/Raphson

Description Usage Arguments Value Author(s) Examples

Description

The function implies the volatility of the certificate with one-dimensional Newton/Raphson method

Usage

1
implyVolatility(price, f, interval = c(0, 1), sigma = NULL, doPlot=FALSE, ...)

Arguments

price

current price of the certificate

f

The pricing function of the certificate, e.g. BonusCertificate

interval

interval to search for implied volatility

sigma

start value for the volatility

doPlot

flag whether to plot price function for convergence diagnostics. Defaults to FALSE

...

additional parameters passed to the pricing function, e.g. S=100, X=100 etc.

Value

returns the implied volatility if it can be implied. Otherwise NA.

Author(s)

Stefan Wilhelm wilhelm@financial.com

Examples

1
2
3
4
5
p <- DiscountCertificate(S=100, X=110, Time=1, r=0.01, r_d=0, sigma=0.5)
implyVolatility(price=p, DiscountCertificate, S=100, X=110, Time=1, r=0.01, r_d=0)
  
p <- DiscountCertificate(S=100, X=110, Time=1, r=0.01, r_d=0, sigma=0.5)
implyVolatility(price=p, DiscountCertificate, doPlot=TRUE, S=100, X=110, Time=1, r=0.01, r_d=0)

Example output

Loading required package: fBasics
Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fOptions
Loading required package: fExoticOptions
$root
[1] 0.5

$f.root
[1] 8.01893e-09

$iter
[1] 4

$root
[1] 0.5

$f.root
[1] 8.01893e-09

$iter
[1] 4

fCertificates documentation built on May 2, 2019, 5:50 p.m.