Optionstrat"

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Package Info

The optionstrat package provides full functionality for analyzing option greeks and option strategies. All option analytics are calculated using the Black-Scholes-Merton option pricing model.

1. Option Greek Calculations

The following functions may be used to calculate all of the option greeks as well as the option premium and provide the information in a data.frame format:

Alternatively, these functions will return a specific option greek:

Arguments:

Additionally:

Arguments:

2. Plot Option Strategies

The following functions may be used to plot specific option strategies:

Arguments:

Additional plotting function:

Arguments:

Additional plotting function:

Arguments:

3. Vertical Spread Analytics

Vertical Spread Analytics

This function calculates the key analytics of a vertical spread and returns the ouput as a data.frame:

Arguments:

Details:

Double Vertical Credit Spread Analytics

This function calculates the key analytics of a double vertical credit spread and returns the output as a data.frame:

Arguments:

4. Probability Functions

The "Probability Below" 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

  3. prob.below(spot, upper, mean = 0, asd = 0, dsd = 0, dte = 0, p, quantile = FALSE)

Arguments:

The "Probability Above" 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

  3. prob.above(spot, lower, mean = 0, asd = 0 ,dsd = 0, dte = 0, p, quantile = FALSE)

Arguments:

The "Probability Between"

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

  3. prob.btwn(spot, lower, upper, mean = 0, asd = 0, dsd = 0, dte = 0, p, quantile = FALSE)

Arguments:

5. Auxiliary Functions

The optionstrat package provides additional functions for calculating the implied volatility of either a call or put option, numerical time differences, and converting a nominal rate into a continuously compounded rate.

Implied Volatility:

iv.calc(type, price, s, x, t, r, d=0)

When applying this function over the rows of a dataframe, run it iteratively:

for(i in 1:nrow(dataframe)){ dataframe$iv[i] <- iv.calc(type = "put", price = dataframe$putprice[i], s = atm, x = dataframe$strike[i], t = ttm, r = rate) }

Arguments:

Numerical Time Difference:

Continuously Compounded Rate Conversion:

Arguments:

Disclaimer

The optionstrat package is provided free of charge to the general public. The indicators, strategies, calculations, functions and all other features are for educational purposes only and should not be construed as investment advice.



Try the optionstrat package in your browser

Any scripts or data that you put into this service are public.

optionstrat documentation built on Dec. 4, 2019, 1:08 a.m.