Last chance! 50% off unlimited learning
Sale ends in
This is the standard library to calculate option price from
implied volatility
ecop.bs_option_price(ivol, K, S, ttm, int_rate = 0, div_yield = 0, otype = "c")ecop.bs_call_price(ivol, K, S, ttm, int_rate = 0, div_yield = 0)
ecop.bs_put_price(ivol, K, S, ttm, int_rate = 0, div_yield = 0)
numeric vector of implied volatility
numeric vector of strike prices
length-one numeric for underlying price
length-one numeric for time to maturity, in the unit of days/365.
length-one numeric for risk-free rate, default to 0.
length-one numeric for dividend yield, default to 0.
character, c
or p
. Default is c
.
The call/put prices
# NOT RUN {
ivol <- c(0.128886, 0.294296)
K <- c(2100, 2040)
S <- 2089.27
T <- 1/365
y <- 0.019
ecop.bs_option_price(ivol, K, S, ttm=T, div_yield=y, otype="c")
# expect output of c(1.8, 50)
# }
Run the code above in your browser using DataLab