hestonSLVBarrierPricer: Barrier Option Pricer for the Heston SLV Model

Description Usage Arguments Value Examples

View source: R/utils.R

Description

The hestonSLVBarrierPricer function evaluates a barrier option with European 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
  hestonSLVBarrierPricer(referenceDate, barrier, rebate, barrierType, strike, optionType,
                         maturityDate, hestonProcess, leverageFunction, tGrid=51, xGrid=401,
                         vGrid=51, dampingSteps=0, fdmScheme = "ModifiedCraigSneyd")

Arguments

referenceDate

a date setting the reference date for the calculation

barrier

the barrier level

rebate

rebate if barrier is knocked out

barrierType

a string with one of the values “downin”, “downout”, “upin” or “upout”

strike

the strike price of the option

optionType

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

maturityDate

the maturity date of the barrier option

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 hestonSLVBarrierPricer 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 }

b <- seq(50, 100, 5)
plot(b, sapply(b, function(barrier) {
  hestonSLVBarrierPricer(Sys.Date(), barrier, 0.0, "downout", 100, "put",
                        Sys.Date()+365, process, leverageFct)$gamma
  }), type="b",lty=2, ylab="NPV",xlab="Strike"
)

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