Title: | Sensitivities of Prices of Financial Options and Implied Volatilities |
---|---|
Description: | Methods to calculate sensitivities of financial option prices for European, geometric and arithmetic Asian, and American options, with various payoff functions in the Black Scholes model, and in more general jump diffusion models. A shiny app to interactively plot the results is included. Furthermore, methods to compute implied volatilities are provided for a wide range of option types and custom payoff functions. Classical formulas are implemented for European options in the Black Scholes Model, as is presented in Hull, J. C. (2017), Options, Futures, and Other Derivatives. In the case of Asian options, Malliavin Monte Carlo Greeks are implemented, see Hudde, A. & Rüschendorf, L. (2023). European and Asian Greeks for exponential Lévy processes. <doi:10.1007/s11009-023-10014-5>. For American options, the Binomial Tree Method is implemented, as is presented in Hull, J. C. (2017). |
Authors: | Anselm Hudde [aut, cre] |
Maintainer: | Anselm Hudde <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.4.3 |
Built: | 2024-10-17 06:03:24 UTC |
Source: | https://github.com/ahudde/greeks |
In contract to European Options, American options can be 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)).
Binomial_American_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "epsilon", "gamma"), steps = 1000, eps = 1/1e+05 )
Binomial_American_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "epsilon", "gamma"), steps = 1000, eps = 1/1e+05 )
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
volatility |
|
dividend_yield |
|
payoff |
|
greek |
|
steps |
|
eps |
|
Named vector containing the values of the Greeks specified in the
parameter greek
.
Hull, J. C. (2022). Options, futures, and other derivatives (11th Edition). Pearson
Greeks_UI for an interactive visualization
Binomial_American_Greeks(initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "epsilon", "gamma"), steps = 20)
Binomial_American_Greeks(initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "epsilon", "gamma"), steps = 20)
For details on the definition of Greeks see Greeks.
BS_European_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "epsilon", "lambda", "gamma", "vanna", "charm", "vomma", "veta", "speed") )
BS_European_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "epsilon", "lambda", "gamma", "vanna", "charm", "vomma", "veta", "speed") )
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
volatility |
|
dividend_yield |
|
payoff |
|
greek |
|
Named vector containing the values of the Greeks specified in the
parameter greek
.
Malliavin_European_Greeks for the Monte Carlo implementation
Greeks_UI for an interactive visualization
BS_European_Greeks(initial_price = 120, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "gamma"), payoff = "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, greek = c("fair_value", "delta", "gamma"), payoff = "put")
For the definition of geometric Asian options see Malliavin_Geometric_Asian_Greeks. BS_Geometric_Asian_Greeks offers a fast and exaction computation of Geometric Asian Greeks.
BS_Geometric_Asian_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "rho", "vega", "theta", "gamma") )
BS_Geometric_Asian_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "rho", "vega", "theta", "gamma") )
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
volatility |
|
dividend_yield |
|
payoff |
|
greek |
|
Named vector containing the values of the Greeks specified in the
parameter greek
.
Malliavin_Geometric_Asian_Greeks for the Monte Carlo implementation which provides digital and custom payoff functions and also works for the jump diffusion model
Greeks_UI for an interactive visualization
BS_Geometric_Asian_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "rho", "vega", "theta", "gamma"), payoff = "put")
BS_Geometric_Asian_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "rho", "vega", "theta", "gamma"), payoff = "put")
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).
BS_Implied_Volatility( option_price, initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, dividend_yield = 0, payoff = "call", start_volatility = 0.3, precision = 1e-09 )
BS_Implied_Volatility( option_price, initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, dividend_yield = 0, payoff = "call", start_volatility = 0.3, precision = 1e-09 )
option_price |
|
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
dividend_yield |
|
payoff |
|
start_volatility |
|
precision |
|
Named vector containing the values of the Greeks specified in the
parameter greek
.
Implied_Volatility for American and Asian options, and for digital payoff functions
BS_Implied_Volatility(option_price = 27, initial_price = 100, exercise_price = 100, r = 0.03, time_to_maturity = 5, dividend_yield = 0.015, payoff = "call")
BS_Implied_Volatility(option_price = 27, initial_price = 100, exercise_price = 100, r = 0.03, time_to_maturity = 5, dividend_yield = 0.015, payoff = "call")
For a description of Asian Greeks see Malliavin_Asian_Greeks. BS_Malliavin_Asian_Greeks offers a fast implementation in the Black Scholes model.
BS_Malliavin_Asian_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "vega", "rho"), steps = round(time_to_maturity * 252), paths = 1000, seed = 1 )
BS_Malliavin_Asian_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "vega", "rho"), steps = round(time_to_maturity * 252), paths = 1000, seed = 1 )
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
volatility |
|
dividend_yield |
|
payoff |
|
greek |
|
steps |
|
paths |
|
seed |
|
Named vector containing the values of the Greeks specified in the
parameter greek
.
Malliavin_Asian_Greeks for a greater set of Greeks and also in the jump diffusion model
Greeks_UI for an interactive visualization
BS_Malliavin_Asian_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "rho"), payoff = "put")
BS_Malliavin_Asian_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "rho"), payoff = "put")
Greeks are derivatives of the option value with respect to
underlying parameters.
For instance, the Greek
(Delta) measures how the price of an option changes with a minor change in
the underlying asset's price, while
(Gamma) measures how
itself changes as the price of the
underlying asset shifts.
Greeks can be computed for different types of options:
For
European Greeks see also BS_European_Greeks and Malliavin_European_Greeks
American Greeks see also Binomial_American_Greeks
Asian Greeks see also BS_Malliavin_Asian_Greeks and Malliavin_Asian_Greeks
Geometric Asian Greeks see also BS_Geometric_Asian_Greeks and Malliavin_Asian_Greeks
The Greeks are defined as the following partial derivatives of the option value:
Delta
= , the derivative with respect to the price of the
underlying asset
Vega
= ,
the derivative with respect to the volatility
Theta
= ,
the negative derivative with respect to the time until expiration of the
option
rho
= ,
the derivative with respect to the risk-free interest rate
Epsilon
= ,
the derivative with respect to the dividend yield of the underlying asset
Lambda
=
Gamma
= , the second derivative with respect to the price of
the underlying asset
Vanna
= , the derivative of
with respect to the volatility
Vomma
= , the second derivative with respect to the volatility
Veta
= ,
the derivative of
with respect to the time until expiration
of the option
Vera
= ,
the derivative of
with respect to the risk-free interest rate
Speed
= ,
the third derivative of the option value with respect to the price of the
underlying asset
Zomma
= ,
the derivative of Gamma with respect to the volatility
Color
= ,
the derivative of Gamma with respect to the risk-free interest rate
Ultima
= ,
the third derivative with respect to the volatility
Greeks computes Greeks for the following option types:
European put- and call options, which give to option holder the right
but not the obligation to sell (resp. buy) the underlying asset for a
specific price at a specific date.
If $K$ is the exercise price, and the value of the underlying asset
at time-to-maturity
, a European options pay off the following amount
at expiration:
for a put-option
for a call-option
American put- and call options are like European options, but allow the holder to exercise at any time until expiration
European cash-or-nothing put- and call options provide the holder with a fixed amount of cash, if the value of the underlying asset is below (resp. above) a certain strike price
European asset-or-nothing put- and call options are similar to cash-or-nothing options, but provide the holder with one share of the asset.
Asian put- and call options have a similar payoff to European put- and
call options but differ from European options in that they are path dependent.
Not the price of the underlying asset at time-to-maturity
is evaluated, but the arithmetic average
.
We get the payoffs
for an Asian
put-option
for an Asian
call-option
Geometric Asian options differ from Asian options in that the geometric
average
is evaluated.
For reference see Hull (2022) or
en.wikipedia.org/wiki/Greeks_(finance).
Greeks( initial_price, exercise_price, r, time_to_maturity, volatility, dividend_yield = 0, model = "Black_Scholes", option_type = "European", payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "gamma"), antithetic = TRUE, ... )
Greeks( initial_price, exercise_price, r, time_to_maturity, volatility, dividend_yield = 0, model = "Black_Scholes", option_type = "European", payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "gamma"), antithetic = TRUE, ... )
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
volatility |
|
dividend_yield |
|
model |
|
option_type |
in c("European", "American", "Asian", "Geometric Asian", "Digital", "Binomial) - the type of option to be considered |
payoff |
|
greek |
|
antithetic |
|
... |
|
Named vector containing the values of the Greeks specified in the
parameter greek
.
Hull, J. C. (2022). Options, futures, and other derivatives (11th Edition). Pearson
en.wikipedia.org/wiki/Greeks_(finance)
BS_European_Greeks for option_type = "European"
Binomial_American_Greeks for option_type = "American"
BS_Geometric_Asian_Greeks for option_type = = "Geometric Asian" and model = "black_scholes"
BS_Malliavin_Asian_Greeks for option_type = = "Asian" and model = "black_scholes" and greek in c("fair_value", "delta", "rho", "vega")
Malliavin_Asian_Greeks for more general cases of Asian Greeks
Greeks_UI for an interactive visualization
Greeks(initial_price = 100, exercise_price = 120, r = 0.01, time_to_maturity = 5, volatility = 0.30, payoff = "call") Greeks(initial_price = 100, exercise_price = 100, r = -0.005, time_to_maturity = 1, volatility = 0.30, payoff = "put", option_type = "American")
Greeks(initial_price = 100, exercise_price = 120, r = 0.01, time_to_maturity = 5, volatility = 0.30, payoff = "call") Greeks(initial_price = 100, exercise_price = 100, r = -0.005, time_to_maturity = 1, volatility = 0.30, payoff = "put", option_type = "American")
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.
Greeks_UI()
Greeks_UI()
If the value of an option, and other (model)parameters like the risk-free interest rate, the time-to-maturity, and the dividend yield are known, the assumed volatility of the underlying asset, the implied volatility can be inferred. See Hull (2022).
Implied_Volatility( option_price, initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, dividend_yield = 0, model = "Black_Scholes", option_type = "European", payoff = "call", start_volatility = 0.3, precision = 1e-06, max_iter = 30 )
Implied_Volatility( option_price, initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, dividend_yield = 0, model = "Black_Scholes", option_type = "European", payoff = "call", start_volatility = 0.3, precision = 1e-06, max_iter = 30 )
option_price |
|
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
dividend_yield |
|
model |
|
option_type |
in c("European", "American", "Geometric Asian", "Asian", "Digital") - the type of option to be considered |
payoff |
|
start_volatility |
initial guess |
precision |
precision of the computation |
max_iter |
maximal number of iterations of the approximation |
Named vector containing the values of the Greeks specified in the
parameter greek
.
Hull, J. C. (2022). Options, futures, and other derivatives (11th Edition). Pearson
BS_Implied_Volatility for the special case option_type = "European" and payoff in c("call", "put")
Implied_Volatility(15, r = 0.05, option_type = "Asian", payoff = "call")
Implied_Volatility(15, r = 0.05, option_type = "Asian", payoff = "call")
Asian options are path-dependent.
If is the price of the underlying asset at time
, the
execution of an Asian option depends on the average price of option,
, where
is the time-to-maturity of
the option.
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).
Malliavin_Asian_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "rho", "vega", "theta", "gamma"), model = "black_scholes", lambda = 0.2, alpha = 0.3, jump_distribution = function(n) stats::rt(n, df = 3), steps = round(time_to_maturity * 252), paths = 10000, seed = 1, antithetic = FALSE )
Malliavin_Asian_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "rho", "vega", "theta", "gamma"), model = "black_scholes", lambda = 0.2, alpha = 0.3, jump_distribution = function(n) stats::rt(n, df = 3), steps = round(time_to_maturity * 252), paths = 10000, seed = 1, antithetic = FALSE )
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
volatility |
|
dividend_yield |
|
payoff |
|
greek |
|
model |
|
lambda |
|
alpha |
|
jump_distribution |
|
steps |
|
paths |
|
seed |
|
antithetic |
|
Named vector containing the values of the Greeks specified in the
parameter greek
.
Hudde, A., & Rüschendorf, L. (2023). European and Asian Greeks for Exponential Lévy Processes. Methodol Comput Appl Probab, 25 (39). doi:10.1007/s11009-023-10014-5
BS_Malliavin_Asian_Greeks for a faster computation, but only in the Black Scholes model and with a smaller set of Greeks
Malliavin_Asian_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "rho"), payoff = "put")
Malliavin_Asian_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "rho"), payoff = "put")
For details on the definition of Greeks see Greeks. For a description of Malliavin Monte Carlo Methods for Greeks see for example (Hudde & Rüschendorf, 2023).
Malliavin_European_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "gamma"), model = "Black Scholes", paths = 10000, seed = 1, antithetic = FALSE )
Malliavin_European_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, payoff = "call", greek = c("fair_value", "delta", "vega", "theta", "rho", "gamma"), model = "Black Scholes", paths = 10000, seed = 1, antithetic = FALSE )
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
volatility |
|
payoff |
|
greek |
|
model |
|
paths |
|
seed |
|
antithetic |
|
Named vector containing the values of the Greeks specified in the
parameter greek
Hudde, A., & Rüschendorf, L. (2023). European and Asian Greeks for Exponential Lévy Processes. Methodol Comput Appl Probab, 25 (39). doi:10.1007/s11009-023-10014-5
BS_European_Greeks for the exact and fast implementation for call-, put- and digital payoff functions
Malliavin_European_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, volatility = 0.22, greek = c("fair_value", "delta", "rho"), payoff = "put")
Malliavin_European_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, volatility = 0.22, greek = c("fair_value", "delta", "rho"), payoff = "put")
In contrast to Asian options (see Malliavin_Asian_Greeks), geometric Asian
options evaluate the geometric average
, where
is the price of the underlying asset at time
and
is
the time-to-maturity of the option (see
en.wikipedia.org/wiki/Asian_option#European_Asian_call_and_put_options_with_geometric_averaging). For more details on the definition of Greeks see Greeks, and for a description of the Malliavin Monte Carlo Method for Greeks see for example (Hudde & Rüschendorf, 2023).
Malliavin_Geometric_Asian_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "rho", "vega", "theta", "gamma"), model = "black_scholes", lambda = 0.2, alpha = 0.3, jump_distribution = function(n) stats::rt(n, df = 3), steps = round(time_to_maturity * 252), paths = 10000, seed = 1, antithetic = FALSE )
Malliavin_Geometric_Asian_Greeks( initial_price = 100, exercise_price = 100, r = 0, time_to_maturity = 1, volatility = 0.3, dividend_yield = 0, payoff = "call", greek = c("fair_value", "delta", "rho", "vega", "theta", "gamma"), model = "black_scholes", lambda = 0.2, alpha = 0.3, jump_distribution = function(n) stats::rt(n, df = 3), steps = round(time_to_maturity * 252), paths = 10000, seed = 1, antithetic = FALSE )
initial_price |
|
exercise_price |
|
r |
|
time_to_maturity |
|
volatility |
|
dividend_yield |
|
payoff |
|
greek |
|
model |
|
lambda |
|
alpha |
|
jump_distribution |
|
steps |
|
paths |
|
seed |
|
antithetic |
|
Named vector containing the values of the Greeks specified in the
parameter greek
.
Hudde, A., & Rüschendorf, L. (2023). European and Asian Greeks for Exponential Lévy Processes. Methodol Comput Appl Probab, 25 (39). doi:10.1007/s11009-023-10014-5
BS_Geometric_Asian_Greeks for exact and fast computation in the Black Scholes model and for put- and call payoff functions
Malliavin_Asian_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "rho"), payoff = "put")
Malliavin_Asian_Greeks(initial_price = 110, exercise_price = 100, r = 0.02, time_to_maturity = 4.5, dividend_yield = 0.015, volatility = 0.22, greek = c("fair_value", "delta", "rho"), payoff = "put")