European options and Greeks

library(greeks)

European options can be exercised only at maturity. In the Black-Scholes model, the package computes their prices and sensitivities with closed formulas through BS_European_Greeks(). The generic Greeks() wrapper dispatches to the same implementation when option_type = "European" and model = "Black_Scholes".

The examples below are compact versions of the checks used in the test suite: they compute a few Greeks directly, check one Greek with a finite difference, and compare exact Black-Scholes values with the Malliavin Monte Carlo estimator.

Exact Black-Scholes values

The greek argument can contain more than one quantity. The result is a named numeric vector.

european_put <- BS_European_Greeks(
  initial_price = 120,
  exercise_price = 100,
  r = 0.02,
  time_to_maturity = 4.5,
  dividend_yield = 0.015,
  volatility = 0.22,
  payoff = "put",
  greek = c("fair_value", "delta", "gamma", "vega", "theta", "rho")
)

round(european_put, 4)
#> fair_value      delta      gamma       vega      theta        rho 
#>    10.1325    -0.2344     0.0053    75.7280    -1.5079  -172.1477

The same calculation can be written with the wrapper:

round(
  Greeks(
    initial_price = 120,
    exercise_price = 100,
    r = 0.02,
    time_to_maturity = 4.5,
    dividend_yield = 0.015,
    volatility = 0.22,
    payoff = "put",
    greek = c("fair_value", "delta", "gamma")
  ),
  4
)
#> fair_value      delta      gamma 
#>    10.1325    -0.2344     0.0053

Digital payoffs are supported by the European Black-Scholes implementation. A cash-or-nothing call pays one unit of cash at maturity if the option finishes in the money.

digital_call <- BS_European_Greeks(
  initial_price = 100,
  exercise_price = 105,
  r = 0.03,
  time_to_maturity = 1,
  volatility = 0.25,
  payoff = "cash_or_nothing_call",
  greek = c("fair_value", "delta", "vega")
)

round(digital_call, 4)
#> fair_value      delta       vega 
#>     0.4082     0.0152    -0.0757

A finite-difference check

Delta is the derivative of the option value with respect to the initial price of the underlying asset. The tests verify this over many random inputs. For a single option, the same idea can be seen with a central finite difference.

base_args <- list(
  exercise_price = 100,
  r = 0.02,
  time_to_maturity = 1.5,
  dividend_yield = 0,
  volatility = 0.3,
  payoff = "call"
)

fair_value_at <- function(initial_price) {
  do.call(
    BS_European_Greeks,
    c(base_args, list(initial_price = initial_price, greek = "fair_value"))
  )
}

step_size <- 1e-4
finite_difference_delta <-
  (fair_value_at(100 + step_size) - fair_value_at(100 - step_size)) /
  (2 * step_size)

exact_delta <- do.call(
  BS_European_Greeks,
  c(base_args, list(initial_price = 100, greek = "delta"))
)

round(
  c(
    exact_delta = exact_delta,
    finite_difference_delta = finite_difference_delta,
    absolute_error = abs(exact_delta - finite_difference_delta)
  ),
  8
)
#>                  exact_delta.delta finite_difference_delta.fair_value 
#>                          0.6046345                          0.6046345 
#>               absolute_error.delta 
#>                          0.0000000

Malliavin Monte Carlo comparison

Malliavin_European_Greeks() estimates the same Greeks by simulation. This is less efficient than closed formulas for plain European options, but it is useful as a bridge to the Malliavin methods used for path-dependent options.

greeks_to_compare <- c("fair_value", "delta", "vega", "theta", "rho", "gamma")

exact <- BS_European_Greeks(
  initial_price = 110,
  exercise_price = 100,
  r = 0.02,
  time_to_maturity = 1,
  volatility = 0.25,
  payoff = "call",
  greek = greeks_to_compare
)

monte_carlo <- Malliavin_European_Greeks(
  initial_price = 110,
  exercise_price = 100,
  r = 0.02,
  time_to_maturity = 1,
  volatility = 0.25,
  payoff = "call",
  greek = greeks_to_compare,
  paths = 50000,
  seed = 42,
  antithetic = TRUE
)

round(rbind(exact = exact, malliavin_monte_carlo = monte_carlo), 4)
#>                       fair_value  delta    vega   theta     rho  gamma
#> exact                    17.4110 0.7211 36.9551 -5.8577 61.9148 0.0122
#> malliavin_monte_carlo    17.4359 0.7247 38.0153 -5.9976 62.2852 0.0126

References

The closed-form European formulas are standard Black-Scholes results; see Hull (2022). The Malliavin estimators are described in Hudde and Rueschendorf (2023).