Skip to content

Commit

Permalink
Added asset-or-nothing digital options
Browse files Browse the repository at this point in the history
  • Loading branch information
hudde committed Jan 31, 2024
1 parent 2565c17 commit a12caaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 8 additions & 1 deletion R/Malliavin_European_Greeks.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
#' @param time_to_maturity - time to maturity in years
#' @param volatility - volatility of the underlying asset
#' @param payoff - the payoff function, either a string in ("call", "put",
#' "cash_or_nothing_call", "cash_or_nothing_call"), or a function
#' "cash_or_nothing_call", "cash_or_nothing_call", "asset_or_nothing_call",
#' "asset_or_nothing_put"), or a function
#' @param greek - the Greeks to be calculated in ("fair_value", "delta",
#' "vega", "theta", "rho", "gamma")
#' @param model - the model to be chosen
Expand Down Expand Up @@ -79,6 +80,12 @@ Malliavin_European_Greeks <-
} else if (payoff %in% c("digital_put", "cash_or_nothing_put")) {
payoff <- function(x) {ifelse(x <= exercise_price, 1, 0)
}
} else if (payoff %in% c("asset_or_nothing_call")) {
payoff <- function(x) {ifelse(x >= exercise_price, x, 0)
}
} else if (payoff %in% c("asset_or_nothing_put")) {
payoff <- function(x) {ifelse(x <= exercise_price, x, 0)
}
}

if (model == "Black Scholes") {
Expand Down
3 changes: 2 additions & 1 deletion man/Malliavin_European_Greeks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a12caaf

Please sign in to comment.