knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This package utilizes functionality from the package "optionstrat" and "plotly" to produce a 3D graph plotting a selected option parameter over time for a double vertical option spread. The available parameters are the option premium or an option greek such as delta, gamma, vega, theta or rho. A double vertical option spread is an option strategy composed of 4 options of the same type (calls or puts) with different strike prices, the highest and lowest strike option are typically long while the middle two are short. The double vertical spread is also known as an "Iron Condor", or an "Iron Butterfly" if the middle two options have the same strike.
visualize((type = "call", parameter = "premium", s = 100, si = 100, x1 = 90, x2 = 95, x3 = 105, x4 = 110, v1 = 0.20, v2 = v1, v3 = v1, v4 = v1, ti = 45/365, r = 0.02, d = 0, ls = 1, low = 75, high = 125, e1 =(45/365), e2 = (30/365), e3 = (15/365), e4 = (1/365), c1 = 1, c2 = 1, c3 = 1, c4 = 1))
type
Character String: "call" or "put"parameter
Character String: "premium", "delta", "gamma", "vega", "theta", "rho"s
Underlying Asset Pricesi
Initial Price of the underlying assetx1
Option 1 Strikex2
Option 2 Strikex3
Option 3 Strikex4
Option 4 Strikev1
Option 1 Volatilityv2
Option 2 Volatilityv3
Option 3 Volatilityv4
Option 4 Volatilityti
Initial time to maturity in yearsr
Annualized continuously compounded risk-free rated
Annualized continuously compounded dividend yieldls
Numerical either 1 or -1low
Lower Limit for the price rangehigh
Upper Limit for the price rangee1
Expiration, in years. Set to 45/365e2
Expiration, in years. Set to 30/365e3
Expiration, in years. Set to 15/365e4
Expiration, in years. Set to 1/365c1
Option 1, Number of Contractsc2
Option 2, Number of Contractsc3
Option 3, Number of Contractsc4
Option 4, Number of ContractsThis function produces a 3d Plot of the volatility skew any publicly traded corporation or index. It plots the implied volatility of option contracts of five expirations, the expirations used are the contracts closest to 5, 15, 25, 35 and 45 days to expiration. Only contracts with a strike between the current spot price multiplied by the lower limit and the upper limit will be used in the plot.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.