ecop.bs_implied_volatility | R Documentation |
This is the standard library to calculate implied volatility σ_{BS} in Black-Sholes model. There is no external dependency on elliptic distribution.
ecop.bs_implied_volatility( V, K, S, ttm, int_rate = 0, div_yield = 0, otype = "c", stop.on.na = FALSE, use.mc = TRUE )
V |
numeric vector of option prices |
K |
numeric vector of strike prices |
S |
length-one numeric for underlying price |
ttm |
length-one numeric for time to maturity, in the unit of days/365. |
int_rate |
length-one numeric for risk-free rate, default to 0. |
div_yield |
length-one numeric for dividend yield, default to 0. |
otype |
character, specifying option type: |
stop.on.na |
logical, to stop if fails to find solution. Default is to use NaN and not stop. |
use.mc |
logical, to use mclapply (default), or else just use for loop. For loop option is typically for debugging. |
The implied volatity σ_{BS}.
V <- c(1.8, 50) K <- c(2100, 2040) S <- 2089.27 T <- 1/365 y <- 0.019 ecop.bs_implied_volatility(V, K, S, ttm=T, div_yield=y, otype="c") # expect output of 12.8886% and 29.4296%
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.