Price of a European Call under the Heston Model
Computes the price of a European Call under the Heston model (and the equivalent Black–Scholes–Merton volatility)
callHestoncf(S, X, tau, r, q, v0, vT, rho, k, sigma, implVol = FALSE, ...)
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. |
... |
named arguments, passed to |
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).
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.
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
.
Enrico Schumann
Gilli, M., Maringer, D. and Schumann, E. (2019) Numerical Methods and Optimization in Finance. 2nd edition. Elsevier. https://www.elsevier.com/books/numerical-methods-and-optimization-in-finance/gilli/978-0-12-815065-8
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.
Schumann, E. (2019) Financial Optimisation with R (NMOF Manual). http://enricoschumann.net/NMOF.htm#NMOFmanual
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]]
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.