hestonSLVOptionPricer: Vanilla Option Pricer for the Heston SLV Model

Description Usage Arguments Value Examples

View source: R/utils.R

Description

The hestonSLVOptionPricer function evaluates a vanilla option with European or American exercise under the Heston Stochastic Volatility model using Finite Difference methods. The option value and the common first derivatives ("Greeks") are returned.

Usage

1
2
3
  hestonSLVOptionPricer(referenceDate, strike, optionType, exerciseType,
                        maturityDate, hestonProcess, leverageFunction, tGrid=51, xGrid=401,
                        vGrid=51, dampingSteps=0, fdmScheme = "ModifiedCraigSneyd")

Arguments

referenceDate

a date setting the reference date for the calculation

strike

the strike price of the option

optionType

a string with one of the values “call” or “put”

exerciseType

a string with one of the values “european” or “american”

maturityDate

the maturity date

hestonProcess

the Heston model part of the HestonSLV specification

leverageFunction

the leverage function of the HestonSLV model

tGrid

number of time steps for the Finite Difference scheme

xGrid

number of grid points in spot direction

vGrid

number of grid points in variance direction

dampingSteps

number of damping steps to avoid spurious oscillations

fdmScheme

the Finite Difference scheme, a string with one of the values “Hundsdorfer”, “ModifiedHundsdorfer”, “Douglas”, “CraigSneyd”, “ModifiedCraigSneyd”, “ImplicitEuler” or “ExplicitEuler”

Value

The hestonSLVOptionPricer function returns a list with the following components:

value

npv of option

delta

change in option value for a change in the underlying

gamma

change in option delta for a change in the underlying

theta

change in option value for a change in t

impliedVol

implied Black-Scholes-Merton volatility of the option

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
process <- HestonProcess(function(t,s) {0.05}, function(t,s) {0.02},
                         100, 0.09, 1.0, 0.06, 0.4, -0.75)

leverageFct <- function(t, s) { exp(-t)*(s+70)/100.0 }

s <- seq(50, 200, 10)
plot(s, sapply(s, function(strike) {
  hestonSLVOptionPricer(Sys.Date(), strike, "call", "european",
                        Sys.Date()+182, process, leverageFct)$impliedVol
                }), type="b",lty=2, ylab="Implied Volatility",xlab="Strike"
)

klausspanderen/RHestonSLV documentation built on Oct. 4, 2021, 11:10 a.m.