HestonNandiOptions | R Documentation |
A collection and description of functions to valuate
Heston-Nandi options. Included are functions to compute
the option price and the delta and gamma sensitivities
for call and put options.
The functions are:
HNGOption | Heston-Nandi GARCH(1,1) option price, |
HNGGreeks | Heston-Nandi GARCH(1,1) option sensitivities, |
HNGCharacteristics | option prices and sensitivities. |
HNGOption(TypeFlag, model, S, X, Time.inDays, r.daily) HNGGreeks(Selection, TypeFlag, model, S, X, Time.inDays, r.daily) HNGCharacteristics(TypeFlag, model, S, X, Time.inDays, r.daily)
model |
a list of model parameters with the following entries:
|
r.daily |
the daily rate of interest, a numeric value; e.g. 0.25/252 means about 0.001% per day. |
S |
the asset price, a numeric value. |
Selection |
sensitivity to be computed, one of |
Time.inDays |
the time to maturity measured in days, a numerical value; e.g. 5/252 means 1 business week. |
TypeFlag |
a character string either |
X |
the exercise price, a numeric value. |
Option Values:
HNGOption
calculates the option price, HNGGreeks
allows to compute the option sensitivity Delta or Gamma, and
HNGcharacterisitics
summarizes both in one function call.
HNGOption
returns a list object of class "option"
with $price
denoting the option price, a numeric value, and $call
a
character string which matches the function call.
HNGOGreeks
returns the option sensitivity for the selected Greek, either
"delta"
or "gamma"
; a numeric value.
HNGCharacteristics
returns a list with the following entries:
premium |
the option price, a numeric value. |
delta |
the delta sensitivity, a numeric value. |
gamma |
the gamma sensitivity, a numeric value. |
Diethelm Wuertz for the Rmetrics R-port.
Heston S.L., Nandi S. (1997); A Closed-Form GARCH Option Pricing Model, Federal Reserve Bank of Atlanta.
## model - # Define the Model Parameters for a Heston-Nandi Option: model = list(lambda = -0.5, omega = 2.3e-6, alpha = 2.9e-6, beta = 0.85, gamma = 184.25) S = X = 100 Time.inDays = 252 r.daily = 0.05/Time.inDays sigma.daily = sqrt((model$omega + model$alpha) / (1 - model$beta - model$alpha * model$gamma^2)) data.frame(S, X, r.daily, sigma.daily) ## HNGOption - # Compute HNG Call-Put and compare with GBS Call-Put: HNG = GBS = Diff = NULL for (TypeFlag in c("c", "p")) { HNG = c(HNG, HNGOption(TypeFlag, model = model, S = S, X = X, Time.inDays = Time.inDays, r.daily = r.daily)$price ) GBS = c(GBS, GBSOption(TypeFlag, S = S, X = X, Time = Time.inDays, r = r.daily, b = r.daily, sigma = sigma.daily)@price) } Options = cbind(HNG, GBS, Diff = round(100*(HNG-GBS)/GBS, digits=2)) row.names(Options) <- c("Call", "Put") data.frame(Options) ## HNGGreeks - # Compute HNG Greeks and compare with GBS Greeks: Selection = c("Delta", "Gamma") HNG = GBS = NULL for (i in 1:2){ HNG = c(HNG, HNGGreeks(Selection[i], TypeFlag = "c", model = model, S = 100, X = 100, Time = Time.inDays, r = r.daily) ) GBS = c(GBS, GBSGreeks(Selection[i], TypeFlag = "c", S = 100, X = 100, Time = Time.inDays, r = r.daily, b = r.daily, sigma = sigma.daily) ) } Greeks = cbind(HNG, GBS, Diff = round(100*(HNG-GBS)/GBS, digits = 2)) row.names(Greeks) <- Selection data.frame(Greeks)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.