Description Usage Arguments Author(s) Examples
Compute the greeks of an option using the Black-Scholes-Merton framework
1 2 3 4 5 6 7 8 9 10 11 12 | computeGreeks(option, greek = c("delta", "theta", "gamma", "rho", "vega"),
prices = NULL, maturities = NULL, plot = FALSE, ...)
deltaBS(S0, K, r, q, vol, ttm, type)
thetaBS(S0, K, r, q, vol, ttm, type)
gammaBS(S0, K, r, q, vol, ttm, type)
vegaBS(S0, K, r, q, vol, ttm, type)
rhoBS(S0, K, r, q, vol, ttm, type)
|
option |
an |
greek |
one of "delta", "theta", "gamma", "rho", or "vega" |
prices |
vector of values to compute the greeks as time to maturity varies |
maturities |
vector of values to compute the greeks as time to maturity varies |
plot |
TRUE/FALSE to plot the greek value as the underlying price and/ time to maturity vary |
S0 |
underlying asset price |
K |
strike price |
r |
risk free rate |
q |
continuous dividend yield rate for options on stocks or stock indices paying a dividend. Also the foreign risk free rate for options on currencies |
vol |
volatility of the underlying asset price |
ttm |
tmie to maturity, the life of the option, measured in years |
type |
type of the option; "call" or "put" |
... |
passthrough parameters to |
Ross Bennett
1 2 3 4 5 6 7 8 9 10 11 | euro.call <- optionSpec(style="european", type="call", S0=30, K=30, maturity=1, r=0.05, volatility=0.25, q=0)
# European call greeks
computeGreeks(euro.call, greek = "delta")
computeGreeks(euro.call, greek = "gamma")
computeGreeks(euro.call, greek = "theta")
computeGreeks(euro.call, greek = "vega")
computeGreeks(euro.call, greek = "rho")
# Plotting
computeGreeks(euro.call, "delta", prices = seq(20, 40, 1), plot = TRUE)
computeGreeks(euro.call, "delta", maturities = seq(0.5, 0.01, -0.01), plot = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.