ecop.bs_implied_volatility: Implied volatility of Black-Sholes model

ecop.bs_implied_volatilityR Documentation

Implied volatility of Black-Sholes model

Description

This is the standard library to calculate implied volatility σ_{BS} in Black-Sholes model. There is no external dependency on elliptic distribution.

Usage

ecop.bs_implied_volatility(
  V,
  K,
  S,
  ttm,
  int_rate = 0,
  div_yield = 0,
  otype = "c",
  stop.on.na = FALSE,
  use.mc = TRUE
)

Arguments

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: c or p.

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.

Value

The implied volatity σ_{BS}.

Examples

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%

ecd documentation built on May 10, 2022, 1:07 a.m.