Learn R Programming

fCertificates (version 0.5-4)

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

Description

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

Usage

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab