call.value: Calculate Call Value and Greeks

Usage Arguments Examples

View source: R/call.value.R

Usage

1
call.value(S, X, b, r, Time, v)

Arguments

S
X
b
r
Time
v

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(S, X, b, r, Time, v) {
  S <- as.numeric(S)
  X <- as.numeric(X)
  b <- as.numeric(b)
  r <- as.numeric(r)
  Time <- as.numeric(Time)
  v <- as.numeric(v)

  d1 <- (log(S/X) + (r - b + (v^2)/2) * Time)/(v * sqrt(Time))
  d2 <- d1 - v * (sqrt(Time))
  cp <- (S * exp(-b * Time) * pnorm(d1)) - (X * exp(-r * Time) *
        pnorm(d2))
  delta.c <- exp(-b * Time) * pnorm(d1)
  if(identical(cp, NaN)) {
    cp <- delta.c <- 0  
  }
  list(value=cp, delta=delta.c)
  }

joshuaulrich/greeks documentation built on May 19, 2019, 8:54 p.m.