get_underlying: European Call Option Price and the Inverse

Description Usage Arguments Value See Also Examples

View source: R/get_underlying.R

Description

Computes the European call option and the inverse. All vectors with length greater than one needs to have the same length.

Usage

1
2
3
BS_call(V, D, T., r, vol)

get_underlying(S, D, T., r, vol, tol = 1e-12)

Arguments

V

numeric vector or scalar with price of the underlying asset.

D

numeric vector or scalar with debt due in T..

T.

numeric vector or scalar with time to maturity.

r

numeric vector or scalar with risk free rates.

vol

numeric vector or scalar with volatilities, σs.

S

numeric vector with observed stock prices.

tol

numeric scalar with tolerance to get_underlying. The difference is scaled if the absolute of S is large than tol as in the tolerance argument to all.equal.numeric.

Value

Numeric vector or scalar with price of the underlying asset or equity price.

See Also

BS_fit

Examples

1
2
3
4
5
6
7
8
9
library(DtD)
set.seed(58661382)
sims <- BS_sim(
  vol = .2, mu = .03, dt = .1, V_0 = 100, T. = 1, D = rep(80, 20), r = .01)

stopifnot(with(
  sims, isTRUE(all.equal(V, get_underlying(S, D, T, r, vol)))))
stopifnot(with(
  sims, isTRUE(all.equal(S, BS_call(V, D, T, r, vol)))))

DtD documentation built on March 26, 2020, 7:45 p.m.