Learn R Programming

NMOF (version 0.22-0)

callHestoncf: Price of a European Call under the Heston Model

Description

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

Usage

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.

Value

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

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).

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

EuropeanCall

Examples

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

Run the code above in your browser using DataLab