Skip to contents

Uses bisection method to calculate implied volatility, given other parameters for Black-Scholes-Merton formula for pricing options on stocks.

Usage

bsmimpvol(
  option_prices,
  type,
  spot,
  strike,
  time,
  rate,
  yield,
  tolerance = .Machine$double.eps,
  maxiter = 100,
  check = any
)

Arguments

option_prices

stock option price.

type

'call' for call option, any other value for put.

spot

current stock price.

strike

the strike price.

time

time to option expiration in years.

rate

the risk-free interest rate.

yield

the dividends that are expected to be paid.

tolerance

the tolerance for the approximation.

maxiter

maximum number of iterations for bisection method.

check

function for checking the convergence of all bisections.

Value

An approximation for the implied volatility. If the algorithm converges before maxiter is reached, Black-Scholes-Merton formula calculated with this volatility should not differ from option_prices by more than tolerance.

Recycle rule

These arguments handle the recycle rule so vectors can be provided and once those vectors differs in length the recycle rule is applied.

Examples

bsmimpvol(6, "call", 50, 52, 1, 0.1, 0)
#> [1] 0.2262009
bsmimpvol(c(3, 4, 5, 6), "call", 50, 52, 1, 0.1, 0)
#> [1] 0.03952998 0.11484774 0.17173560 0.22620092
bsmimpvol(1.5, "put", 40, 38, 0.5, 0.15, 0, tolerance = 1e-8)
#> [1] 0.3168743