callHestoncf: Price of a European Call under the Heston Model

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Computes the price of a European Call under the Heston model (and the equivalent Black–Scholes–Merton volatility)

Usage

1
callHestoncf(S, X, tau, r, q, v0, vT, rho, k, sigma, implVol = FALSE)

Arguments

S

current stock price

X

strike price

tau

time to maturity

r

risk-free rate

q

dividend rate

v0

current variance

vT

long-run variance

rho

correlation between spot and variance

k

speed of mean-reversion

sigma

volatility of variance. A value smaller than 0.01 is replaced with 0.01.

implVol

compute equivalent Black–Scholes–Merton volatility? Default is FALSE.

Details

The function computes the value of a plain vanilla European call under the Heston model. Put values can be computed through put–call-parity. If implVol is TRUE, the function will compute the implied volatility necessary to obtain the same price under Black–Scholes–Merton. The implied volatility is computed with uniroot from the stats package.

Note that the function takes variances as inputs (not volatilities).

Value

Returns the value of the call (numeric) under the Heston model or, if implVol is TRUE, a list of the value and the implied volatility.

Note

If implVol is TRUE, the function will return a list with elements named value and impliedVol. Prior to version 0.26-3, the first element was named callPrice.

Author(s)

Enrico Schumann

References

Gilli, M., Maringer, D. and Schumann, E. (2011) Numerical Methods and Optimization in Finance. Elsevier. http://www.elsevierdirect.com/product.jsp?isbn=9780123756626

Heston, S.L. (1993) A Closed-Form Solution for Options with Stochastic Volatility with Applications to Bonds and Currency options. Review of Financial Studies 6(2), 327–343.

See Also

callCFEuropeanCall

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
S <- 100; X <- 100; tau <- 1; r <- 0.02; q <- 0.01
v0  <- 0.2^2  ## variance, not volatility
vT  <- 0.2^2  ## variance, not volatility
rho <- -0.7; k <- 0.2; sigma <- 0.5

## get Heston price and BSM implied volatility
result <- callHestoncf(S = S, X = X, tau = tau, r = r, q = q,
                       v0 = v0, vT = vT, rho = rho, k = k,
                       sigma = sigma, implVol = TRUE)

## Heston price
result[[1L]]

## price BSM with implied volatility
vol <- result[[2L]]
d1 <- (log(S/X) + (r - q + vol^2 / 2)*tau) / (vol*sqrt(tau))
d2 <- d1 - vol*sqrt(tau)
callBSM <- S * exp(-q * tau) * pnorm(d1) -
           X * exp(-r * tau) * pnorm(d2)
callBSM  ## should be (about) the same as result[[1L]]

Example output

[1] 6.758368
[1] 6.758372

NMOF documentation built on May 2, 2019, 6:39 p.m.