Skip to content

Commit

Permalink
#5
Browse files Browse the repository at this point in the history
  • Loading branch information
hudde committed Feb 25, 2024
1 parent 70fac00 commit 27cb949
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 17 deletions.
2 changes: 1 addition & 1 deletion R/BS_Geometric_Asian_Greeks.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' \eqn{\exp \left( \frac{1}{T} \int_0^T \ln S_t dt \right)}, where
#' \eqn{S_t} is the price of the underlying asset at time \eqn{t} and \eqn{T} is
#' the time-to-maturity of the option.
#' For more details on the definition of Greeks see the function [Greeks].
#' For more details on the definition of Greeks see [Greeks].
#'
#' @export
#'
Expand Down
10 changes: 5 additions & 5 deletions R/BS_Implied_Volatility.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
#' Computes the implied volatility for European put- and call options in the
#' Black Scholes model via Halley's method.
#'
#' @description For the definition of *implied volatility* see the function
#' [Implied_Volatility].
#' [BS_Implied_Volatility] offers a very fast implementation for European put-
#' and call options applying Halley's method (see
#' [en.wikipedia.org/wiki/Halley%27s_method](https://en.wikipedia.org/wiki/Halley%27s_method)).
#' @description For the definition of *implied volatility* see
#' [Implied_Volatility].
#' [BS_Implied_Volatility] offers a very fast implementation for European put-
#' and call options applying Halley's method (see
#' [en.wikipedia.org/wiki/Halley%27s_method](https://en.wikipedia.org/wiki/Halley%27s_method)).
#'
#' @export
#'
Expand Down
9 changes: 8 additions & 1 deletion R/Binomial_American_Greeks.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
#' options pricing model
#'
#' @description
#' For details see the function [Greeks]
#' In contract to European Options, American options can a executed at any time
#' until the expiration date.
#' For more details on the definition of Greeks in general see [Greeks].
#' This functions computes Greeks of American put- and call options in the
#' binomial option pricing model (see (Hull, 2022)).
#'
#' @export
#'
Expand Down Expand Up @@ -35,6 +39,9 @@
#' payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho",
#' "epsilon", "gamma"), steps = 20)
#'
#'@references
#' Hull, J. C. (2022). Options, futures, and other derivatives (11th Edition). Pearson
#'

Binomial_American_Greeks <-
function(initial_price = 100,
Expand Down
12 changes: 12 additions & 0 deletions R/Greeks_UI.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
#' @title
#' Opens a shiny app to interactively visualize option prices and Greeks.
#'
#' @description
#' Opens a shiny app to interactively visualize option prices and Greeks.
#' This works for European Options (see [BS_European_Greeks]), American
#' Options (see [Binomial_American_Greeks]), Geometric Asian Options (see
#' [BS_Geometric_Asian_Greeks]), as well as Asian options (see
#' [BS_Malliavin_Asian_Greeks]).
#' For performance reasons, just the Black-Scholes model is possible, and for
#' some cases, the set of Greeks is limited.
#' On the y-Axis, the option value resp. the value of the greeks are displayed,
#' for the x-axis, several parameters like `initial_price` or `time_to_maturity`
#' are possible
#'
#' @export
#'
#' @import "shiny"
Expand Down
5 changes: 2 additions & 3 deletions R/Malliavin_Asian_Greeks.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#' execution of an Asian option depends on the average price of option,
#' \eqn{\frac{1}{T} \int_0^T S_t dt}, where \eqn{T} is the time-to-maturity of
#' the option.
#' For more details on the definition of Greeks in general see the function
#' [Greeks].
#' For more details on the definition of Greeks in general see [Greeks].
#'
#' For a description of Malliavin Monte Carlo Methods for Greeks see for example
#' (Hudde & Rüschendorf, 2023)
Expand Down Expand Up @@ -113,7 +112,7 @@ Malliavin_Asian_Greeks <- function(
}
dpayoff <- function(x, exercise_price) {
return(-(x < exercise_price) + 0)
}
}
} else if (payoff == "digital_call") {
payoff <- function(x, exercise_price) {ifelse(x >= exercise_price, 1, 0)
}
Expand Down
2 changes: 1 addition & 1 deletion man/BS_Geometric_Asian_Greeks.Rd

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

2 changes: 1 addition & 1 deletion man/BS_Implied_Volatility.Rd

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

9 changes: 8 additions & 1 deletion man/Binomial_American_Greeks.Rd

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

13 changes: 11 additions & 2 deletions man/Greeks_UI.Rd

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

3 changes: 1 addition & 2 deletions man/Malliavin_Asian_Greeks.Rd

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

0 comments on commit 27cb949

Please sign in to comment.