Title: | Utilizes the Black-Scholes Option Pricing Model to Perform Strategic Option Analysis and Plot Option Strategies |
---|---|
Description: | Utilizes the Black-Scholes-Merton option pricing model to calculate key option analytics and perform graphical analysis of various option strategies. Provides functions to calculate the option premium and option greeks of European-style options. |
Authors: | John T. Buynak [aut, cre] |
Maintainer: | John T. Buynak <[email protected]> |
License: | GPL-3 |
Version: | 1.4.1 |
Built: | 2024-10-31 21:09:14 UTC |
Source: | CRAN |
Calculates the delta of the European- style call option
calldelta(s, x, sigma, t, r, d = 0)
calldelta(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
The delta of an option can be defined as the rate of change of the option value given a $1 change in the underlying asset price.
Returns the call delta
calldelta(100, 100, 0.20, (45/365), 0.02, 0.02)
calldelta(100, 100, 0.20, (45/365), 0.02, 0.02)
Creates a data.frame containing call option greeks; delta, gamma, vega, theta, rho and the call premium
calleval(s, x, sigma, t, r, d = 0)
calleval(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Returns a data.frame containing the option premium and greeks:
Premium
Delta
Gamma
Vega
Theta
Rho
John T. Buynak
calleval(100, 100, 0.20, (45/365), 0.02, 0.02)
calleval(100, 100, 0.20, (45/365), 0.02, 0.02)
Computes the selected option greek, including premium
callgreek(greek = c("delta", "gamma", "theta", "vega", "rho", "premium"), s, x, sigma, t, r, d = 0)
callgreek(greek = c("delta", "gamma", "theta", "vega", "rho", "premium"), s, x, sigma, t, r, d = 0)
greek |
String value, desired option greek to return |
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Returns the desired option greek, including premium
callgreek("delta", 100, 100, 0.20, (45/365), 0.02, 0.02) callgreek("gamma", 100, 100, 0.20, (45/365), 0.02, 0.02)
callgreek("delta", 100, 100, 0.20, (45/365), 0.02, 0.02) callgreek("gamma", 100, 100, 0.20, (45/365), 0.02, 0.02)
Calculates the rho of the European- style call option
callrho(s, x, sigma, t, r, d = 0)
callrho(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Rho measures the change in the option's value given a 1
Returns the call rho
callrho(100, 100, 0.20, (45/365), 0.02, 0.02)
callrho(100, 100, 0.20, (45/365), 0.02, 0.02)
Calculates the theta of the European- style call option
calltheta(s, x, sigma, t, r, d = 0)
calltheta(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Theta is the "time-decay" of the option value measured as a daily value
Returns the call theta
calltheta(100, 100, 0.20, (45/365), 0.02, 0.02)
calltheta(100, 100, 0.20, (45/365), 0.02, 0.02)
Calculates the key analytics of a Double Vertical Credit Spread
dv(s, x1, x2, x3, x4, t, r, sigma, sigma2 = sigma, sigma3 = sigma, sigma4 = sigma, vol = sigma, d = 0)
dv(s, x1, x2, x3, x4, t, r, sigma, sigma2 = sigma, sigma3 = sigma, sigma4 = sigma, vol = sigma, d = 0)
s |
Spot price of the underlying asset |
x1 |
Strike price of the lower strike (long) put option |
x2 |
Strike price of the higher strike (short) put option |
x3 |
Strike price of the lower strike (short) call option |
x4 |
Strike price of the higher strike (long) call option |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
sigma |
Implied volatility of the lower strike (long) put option (annualized) |
sigma2 |
Implied volatility of the higher strike (short) put option (annualized) |
sigma3 |
Implied volatility of the lower strike (short) call option (annualized) |
sigma4 |
Implied volatility of the higher strike (long) call option (annualized) |
vol |
Manual over-ride for the volatility of the underlying asset (annualized) |
d |
Annual continuously compounded dividend yield |
Returns a data.frame
dv(s = 100, x1 = 90, x2 = 95, x3 = 105, x4 = 110, t = 0.08, r = 0.02, sigma = 0.2, vol = 0.3)
dv(s = 100, x1 = 90, x2 = 95, x3 = 105, x4 = 110, t = 0.08, r = 0.02, sigma = 0.2, vol = 0.3)
Computes the implied volatility of an option, either a call or put, given the option premium and key parameters
iv.calc(type, price, s, x, t, r, d = 0)
iv.calc(type, price, s, x, t, r, d = 0)
type |
String argument, either "call" or "put" |
price |
Current price of the option |
s |
Spot price of the underlying asset |
x |
Strike Price of the underlying asset |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
d |
Annual continuously compounded dividend yield |
Returns a single option's implied volatility
iv.calc(type = "call", price = 2.93, s = 100, x = 100, t = (45/365), r = 0.02, d = 0)
iv.calc(type = "call", price = 2.93, s = 100, x = 100, t = (45/365), r = 0.02, d = 0)
Calculates the Lambda of the call or put option
lambda(type = "call", s, x, sigma, t, r, d = 0)
lambda(type = "call", s, x, sigma, t, r, d = 0)
type |
Character string, either "call" or "put" |
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Lambda, or elasticity is the percentage change in the option valueper percentage change in the underlying price. It is a measure of leverage.
Calculates the Lambda of the option contract
lambda(type = "put", s = 100, x = 100, sigma = 0.15, t = 45/365, r = 0.02)
lambda(type = "put", s = 100, x = 100, sigma = 0.15, t = 45/365, r = 0.02)
Creates a data.frame containing both call and put option greeks; delta, gamma, vega, theta, rho and the option premium
opteval(s, x, sigma, t, r, d = 0)
opteval(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Returns a data.frame containing the call and put option premium and greeks:
Premium
Delta
Gamma
Vega
Theta
Rho
opteval(100, 100, 0.20, (45/365), 0.02, 0.02)
opteval(100, 100, 0.20, (45/365), 0.02, 0.02)
Calculates the gamma of a European- style call and put option
optiongamma(s, x, sigma, t, r, d = 0)
optiongamma(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Gamma is the rate of change of the option's delta given a $1 change in the underlying asset.
Returns the option gamma
optiongamma(100, 100, 0.20, (45/365), 0.02, 0.02)
optiongamma(100, 100, 0.20, (45/365), 0.02, 0.02)
Calculates the vega of a European- style call and put option
optionvega(s, x, sigma, t, r, d = 0)
optionvega(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use r.cont |
d |
Annual continuously-compounded dividend yield, use r.cont |
Vega measures the change in the option's value given a 1
Returns the option vega
optionvega(100, 100, 0.20, (45/365), 0.02, 0.02)
optionvega(100, 100, 0.20, (45/365), 0.02, 0.02)
Plot a bear call spread (credit spread)
plotbearcall(s, x1, x2, t, r, sigma, sigma2 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "Profit/Loss", main = "Bear Call Spread", ...)
plotbearcall(s, x1, x2, t, r, sigma, sigma2 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "Profit/Loss", main = "Bear Call Spread", ...)
s |
Spot price of the underlying asset |
x1 |
Lower-strike option price (short option) |
x2 |
Higher-strike option price (long option) |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
sigma |
Annualized implied volatility of the lower-strike option |
sigma2 |
Annualized implied volatility of the higher-strike option |
d |
Annual continuously compounded risk-free rate |
ll |
Lower-limit of the plot, set as (desired price/spot) |
ul |
Upper-limit of the plot, set as (desired price/spot) |
xlab |
X-Axis Label |
ylab |
Y-Axis Label |
main |
Title of the plot |
... |
Additional plot parameters |
Returns a plot of a vertical call spread (credit spread). Black line: The profit(loss) at expiration. Red line: The profit(loss) at (1/2) time "t" ~ half-way to expiration. Blue line: The profit(loss) at inception.
John T. Buynak
plotbearcall(s= 100, x1 = 95, x2 = 105, t = (45/365), r = 0.02, sigma = 0.20, sigma2 = 0.20, d = 0, ll = 0.75, ul = 1.25)
plotbearcall(s= 100, x1 = 95, x2 = 105, t = (45/365), r = 0.02, sigma = 0.20, sigma2 = 0.20, d = 0, ll = 0.75, ul = 1.25)
Plot a bear put spread (debit spread)
plotbearput(s, x1, x2, t, r, sigma, sigma2 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "Profit/Loss", main = "Bear Put Spread", ...)
plotbearput(s, x1, x2, t, r, sigma, sigma2 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "Profit/Loss", main = "Bear Put Spread", ...)
s |
Spot price of the underlying asset |
x1 |
Lower-strike option price (short option) |
x2 |
Higher-strike option price (long option) |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
sigma |
Annualized implied volatility of the lower-strike option |
sigma2 |
Annualized implied volatility of the higher-strike option |
d |
Annual continuously compounded risk-free rate |
ll |
Lower-limit of the plot, set as (desired price/spot) |
ul |
Upper-limit of the plot, set as (desired price/spot) |
xlab |
X-Axis Label |
ylab |
Y-Axis Label |
main |
Title of the plot |
... |
Additional plot parameters |
Returns a plot of a vertical put spread (debit spread). Black line: The profit(loss) at expiration. Red line: The profit(loss) at (1/2) time "t" ~ half-way to expiration. Blue line: The profit(loss) at inception.
John T. Buynak
plotbearput(s= 100, x1 = 95, x2 = 105, t = (45/365), r = 0.02, sigma = 0.20, sigma2 = 0.20, d = 0, ll = 0.75, ul = 1.25)
plotbearput(s= 100, x1 = 95, x2 = 105, t = (45/365), r = 0.02, sigma = 0.20, sigma2 = 0.20, d = 0, ll = 0.75, ul = 1.25)
Plot a bull call spread (debit spread)
plotbullcall(s, x1, x2, t, r, sigma, sigma2 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "profit/loss", main = "Bull Call Spread", ...)
plotbullcall(s, x1, x2, t, r, sigma, sigma2 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "profit/loss", main = "Bull Call Spread", ...)
s |
Spot price of the underlying asset |
x1 |
Lower-strike option price (long option) |
x2 |
Higher-strike option price (short option) |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
sigma |
Annualized implied volatility of the lower-strike option |
sigma2 |
Annualized implied volatility of the higher-strike option |
d |
Annual continuously compounded risk-free rate |
ll |
Lower-limit of the plot, set as (desired price/spot) |
ul |
Upper-limit of the plot, set as (desired price/spot) |
xlab |
X-Axis Label |
ylab |
Y-Axis Label |
main |
Title of the plot |
... |
Additional plot parameters |
Returns a plot of a vertical call spread (debit spread). Black line: The profit(loss) at expiration. Red line: The profit(loss) at (1/2) time "t" ~ half-way to expiration. Blue line: The profit(loss) at inception.
John T. Buynak
plotbullcall(s= 100, x1 = 95, x2 = 105, t = (45/365), r = 0.02, sigma = 0.20, sigma2 = 0.20, d = 0, ll = 0.75, ul = 1.25)
plotbullcall(s= 100, x1 = 95, x2 = 105, t = (45/365), r = 0.02, sigma = 0.20, sigma2 = 0.20, d = 0, ll = 0.75, ul = 1.25)
Plot a bull put spread (credit spread)
plotbullput(s, x1, x2, t, r, d = 0, sigma, sigma2 = sigma, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "Profit/Loss", main = "Bull Put Spread", ...)
plotbullput(s, x1, x2, t, r, d = 0, sigma, sigma2 = sigma, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "Profit/Loss", main = "Bull Put Spread", ...)
s |
Spot price of the underlying asset |
x1 |
Lower-strike option price (long option) |
x2 |
Higher-strike option price (short option) |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
d |
Annual continuously compounded risk-free rate |
sigma |
Annualized implied volatility of the lower-strike option |
sigma2 |
Annualized implied volatility of the higher-strike option |
ll |
Lower-limit of the plot, set as (desired price/spot) |
ul |
Upper-limit of the plot, set as (desired price/spot) |
xlab |
X-Axis Label |
ylab |
Y-Axis Label |
main |
Title of the plot |
... |
Additional plot parameters |
Returns a plot of a vertical put spread (credit spread). Black line: The profit(loss) at expiration. Red line: The profit(loss) at (1/2) time "t" ~ half-way to expiration. Blue line: The profit(loss) at inception.
John T. Buynak
plotbullput(s= 100, x1 = 95, x2 = 105, t = (45/365), r = 0.02, sigma = 0.20, sigma2 = 0.20, d = 0, ll = 0.75, ul = 1.25)
plotbullput(s= 100, x1 = 95, x2 = 105, t = (45/365), r = 0.02, sigma = 0.20, sigma2 = 0.20, d = 0, ll = 0.75, ul = 1.25)
Plot a double vertical spread (credit spread)
plotdv(s, x1, x2, x3, x4, t, r, sigma, sigma2 = sigma, sigma3 = sigma, sigma4 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "Profit/Loss", main = "Double Vertical Spread", ...)
plotdv(s, x1, x2, x3, x4, t, r, sigma, sigma2 = sigma, sigma3 = sigma, sigma4 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "Profit/Loss", main = "Double Vertical Spread", ...)
s |
Spot price of the underlying asset |
x1 |
Lower-strike put option price (long option) |
x2 |
Higher-strike put option price (short option) |
x3 |
Lower-strike call option price (short option) |
x4 |
Higher-strike call option price (long option) |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
sigma |
Annualized implied volatility of the lower-strike put option |
sigma2 |
Annualized implied volatility of the higher-strike put option |
sigma3 |
Annualized implied volatility of the lower-strike call option |
sigma4 |
Annualized implied volatility of the higher-strike call option |
d |
Annual continuously compounded risk-free rate |
ll |
Lower-limit of the plot, set as (desired price/spot) |
ul |
Upper-limit of the plot, set as (desired price/spot) |
xlab |
X-Axis Label |
ylab |
Y-Axis Label |
main |
Title of the plot |
... |
Additional plot parameters |
The double vertical spread consists of a credit put spread and a credit debit spread.
Returns a plot of a double vertical spread (credit spread). Black line: The profit(loss) at expiration. Red line: The profit(loss) at (1/2) time "t" ~ half-way to expiration. Blue line: The profit(loss) at inception.
John T. Buynak
plotdv(s= 100, x1 = 90, x2 = 95, x3 = 105, x4 = 110, t = (45/365), r = 0.02, sigma = 0.20)
plotdv(s= 100, x1 = 90, x2 = 95, x3 = 105, x4 = 110, t = (45/365), r = 0.02, sigma = 0.20)
Plot Custom Vertical Spread
plotvertical(options = c("call", "put"), s, x1, x2, t, r, sigma, sigma2 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "profit/loss", main = "Vertical Spread", ...)
plotvertical(options = c("call", "put"), s, x1, x2, t, r, sigma, sigma2 = sigma, d = 0, ll = 0.75, ul = 1.25, xlab = "spot", ylab = "profit/loss", main = "Vertical Spread", ...)
options |
String argument, either "call" or "put" |
s |
Spot price of the underlying asset |
x1 |
Short strike (either higher or lower) |
x2 |
Long strike (either higher or lower) |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
sigma |
Annualized implied volatility of the short option |
sigma2 |
Annualized implied volatility of the long option |
d |
Annual continuously compounded dividend yield |
ll |
Lower-limit of the plot, set as (desired price/spot) |
ul |
Upper-limit of the plot, set as (desired price/spot) |
xlab |
X-Axis Label |
ylab |
Y-Axis Label |
main |
Title of the plot |
... |
Additional plot parameters |
Returns a plot of a custom vertical spread. Black line: The profit(loss) at expiration. Red line: The profit(loss) at (1/2) time "t" ~ half-way to expiration. Blue line: The profit(loss) at inception.
John T. Buynak
plotvertical("call", 100, 90, 110, (45/365), 0.02, 0.20)
plotvertical("call", 100, 90, 110, (45/365), 0.02, 0.20)
Calculates the probability of the underlying asset value remaining above a price level in a designated time frame, given the daily standard devaiation of the underlying returns.
prob.above(spot, lower, mean = 0, asd = 0, dsd = 0, dte = 0, p, quantile = FALSE, tradedays = 262)
prob.above(spot, lower, mean = 0, asd = 0, dsd = 0, dte = 0, p, quantile = FALSE, tradedays = 262)
spot |
Current price of the underlying asset |
lower |
Lower price of the range |
mean |
The average daily price movement, default = 0 |
asd |
Annualized standard deviation of the underlying returns |
dsd |
Daily standard deviation of the underlying returns (Annual vol/sqrt(256)), used as an alternative to the asd parameter in conjuction with the dte parameter |
dte |
Days until expiration, designated time frame |
p |
Designated probability |
quantile |
Logical. If True, calculates the price the asset will remain above, given the designated probability |
tradedays |
Number of trade days in a year, default = 262 |
This function has two separate possible operations: 1. Calculates the probability of the underlying asset value remaining above a price level in a designated time frame, given the daily standard devaiation of the underlying returns. 2. Calculates the price the asset will remain above, given the designated probability
Returns a probability (if quantile = FALSE), Returns a data.frame (if quantile = TRUE)
prob.above(spot = 100, lower = 110, mean = 0, dsd = 0.01, dte = 45) prob.above(spot = 100, mean = 0, dsd = 0.01, dte = 45, p = 0.75, quantile = TRUE)
prob.above(spot = 100, lower = 110, mean = 0, dsd = 0.01, dte = 45) prob.above(spot = 100, mean = 0, dsd = 0.01, dte = 45, p = 0.75, quantile = TRUE)
Calculates the probability of the underlying asset value remaining below a price level in a designated time frame, given the daily standard devaiation of the underlying returns.
prob.below(spot, upper, mean = 0, asd = 0, dsd = 0, dte = 0, p, quantile = FALSE, tradedays = 262)
prob.below(spot, upper, mean = 0, asd = 0, dsd = 0, dte = 0, p, quantile = FALSE, tradedays = 262)
spot |
Current price of the underlying asset |
upper |
Upper price of the range |
mean |
The average daily price movement, default = 0 |
asd |
Annualized standard deviation of the underlying returns |
dsd |
Daily standard deviation of the underlying returns (Annual vol/sqrt(256)), used as an alternative to the asd parameter in conjuction with the dte parameter |
dte |
Days until expiration, designated time frame |
p |
Designated probability |
quantile |
Logical. If True, calculates the price the asset will remain below, given the designated probability |
tradedays |
Number of trade days in a year, default = 262 |
This function has two separate possible operations: 1. Calculates the probability of the underlying asset value remaining below a price level in a designated time frame, given the daily standard devaiation of the underlying returns. 2. Calculates the price the asset will remain below, given the designated probability
Returns a probability (if quantile = FALSE), Returns a data.frame (if quantile = TRUE)
prob.below(spot = 100, upper = 110, mean = 0, dsd = 0.01, dte = 45) prob.below(spot = 100, mean = 0, dsd = 0.01, dte = 45, p = 0.75, quantile = TRUE)
prob.below(spot = 100, upper = 110, mean = 0, dsd = 0.01, dte = 45) prob.below(spot = 100, mean = 0, dsd = 0.01, dte = 45, p = 0.75, quantile = TRUE)
Calculates the probability of the underlying asset value falling between two prices in a designated time frame, given the daily standard devaiation of the underlying returns.
prob.btwn(spot, lower, upper, asd = 0, dsd = 0, dte = 0, mean = 0, p, quantile = FALSE, tradedays = 262)
prob.btwn(spot, lower, upper, asd = 0, dsd = 0, dte = 0, mean = 0, p, quantile = FALSE, tradedays = 262)
spot |
Current price of the underlying asset |
lower |
Lower price of the range |
upper |
Upper price of the range |
asd |
Annualized standard deviation of the underlying returns |
dsd |
Daily standard deviation of the underlying returns (Annual vol/sqrt(256)), used as an alternative to the asd parameter in conjuction with the dte parameter |
dte |
Days until expiration, designated time frame |
mean |
The average daily price movement, default = 0 |
p |
Designated probability |
quantile |
Logical. If True, calculates the probable price range |
tradedays |
Number of trade days in a year, default = 262 |
This function has two separate possible operations: 1. Calculates the probability of the underlying asset value falling between two prices in a designated time frame, given the daily standard devaiation of the underlying returns. 2. Calculates the probable price range, given a set probability
Returns a probability (if quantile = FALSE), Returns a data.frame (if quantile = TRUE)
prob.btwn(spot = 100, lower = 90, upper = 110, mean = 0, dsd = 0.01, dte = 45) prob.btwn(spot = 100, mean = 0, dsd = 0.01, dte = 45, p = 0.75, quantile = TRUE)
prob.btwn(spot = 100, lower = 90, upper = 110, mean = 0, dsd = 0.01, dte = 45) prob.btwn(spot = 100, mean = 0, dsd = 0.01, dte = 45, p = 0.75, quantile = TRUE)
Calculates the delta of the European- style put option
putdelta(s, x, sigma, t, r, d = 0)
putdelta(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
The delta of an option can be defined as the rate of change of the option value given a $1 change in the underlying asset price.
Returns the put delta
putdelta(100, 0.20, (45/365), 0.02, 0.02)
putdelta(100, 0.20, (45/365), 0.02, 0.02)
Creates a data.frame containing put option greeks; delta, gamma, vega, theta, rho and the putpremium
puteval(s, x, sigma, t, r, d = 0)
puteval(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Returns a data.frame containing the option premium and greeks:
Premium
Delta
Gamma
Vega
Theta
Rho
John T. Buynak
puteval(100, 100, 0.20, (45/365), 0.02, 0.02)
puteval(100, 100, 0.20, (45/365), 0.02, 0.02)
Computes the selected option greek, including premium
putgreek(greek = c("delta", "gamma", "theta", "vega", "rho", "premium"), s, x, sigma, t, r, d = 0)
putgreek(greek = c("delta", "gamma", "theta", "vega", "rho", "premium"), s, x, sigma, t, r, d = 0)
greek |
String value, desired option greek to return |
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Returns the dired option greek, including premium
putgreek("vega", 100, 100, 0.20, (45/365), 0.02, 0.02)
putgreek("vega", 100, 100, 0.20, (45/365), 0.02, 0.02)
Calculates the rho of the European- style put option
putrho(s, x, sigma, t, r, d = 0)
putrho(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Rho measures the change in the option's value given a 1
Returns the put rho
putrho(100, 100, 0.20, (45/365), 0.02, 0.02)
putrho(100, 100, 0.20, (45/365), 0.02, 0.02)
Calculates the theta of the European- style put option
puttheta(s, x, sigma, t, r, d = 0)
puttheta(s, x, sigma, t, r, d = 0)
s |
Spot price of the underlying asset |
x |
Strike price of the option |
sigma |
Implied volatility of the underlying asset price, defined as the annualized standard deviation of the asset returns |
t |
Time to maturity in years |
r |
Annual continuously-compounded risk-free rate, use the function r.cont |
d |
Annual continuously-compounded dividend yield, use the function r.cont |
Theta is the "time-decay" of the option value measured as a daily value.
Returns the put theta
puttheta(100, 100, 0.20, (45/365), 0.02, 0.02)
puttheta(100, 100, 0.20, (45/365), 0.02, 0.02)
Convert a given nominal rate to a continuously compounded rate
r.cont(r, n)
r.cont(r, n)
r |
nominal rate |
n |
number of times compounded each year |
Returns a continuously compounded rate
r.cont(0.12, 2)
r.cont(0.12, 2)
Computes the difference in time between two dates
tdiff(date1, date2, period = c("days, years"))
tdiff(date1, date2, period = c("days, years"))
date1 |
Earlier date |
date2 |
Later date |
period |
String value, either "days", or "years" |
Returns a numeric value
tdiff("2018-01-01", "2018-06-30", "days")
tdiff("2018-01-01", "2018-06-30", "days")
Calculates the key analytics of a vertical spread
vertical(options = c("call", "put"), s, x1, x2, t, r, sigma, sigma2 = sigma, vol = sigma, d = 0)
vertical(options = c("call", "put"), s, x1, x2, t, r, sigma, sigma2 = sigma, vol = sigma, d = 0)
options |
Character string. Either "call", or "put" |
s |
Spot price of the underlying asset |
x1 |
Strike price of the short option |
x2 |
Strike price of the long option |
t |
Time to expiration in years |
r |
Annual continuously compounded risk-free rate |
sigma |
Implied volatility of the short option (annualized) |
sigma2 |
Implied volatility of the long option (annualized) |
vol |
Manual over-ride for the volatility of the underlying asset (annualized) |
d |
Annual continuously compounded dividend yield |
Returns a data.frame
vertical("call", s = 100, x1 = 90, x2 = 110, t = (45/365), r = 0.025, sigma = 0.20, vol = 0.25)
vertical("call", s = 100, x1 = 90, x2 = 110, t = (45/365), r = 0.025, sigma = 0.20, vol = 0.25)