1 |
o |
|
t1 |
|
t2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ##---- 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 (o = OptPx(Opt(Style = "Chooser")), t1 = 9/12, t2 = 3/12)
{
stopifnot(is.OptPx(o), o$Style$Chooser)
d2 = (log(o$S0/o$K) + ((o$r - o$q) - o$vol^2/2) * (t1))/(o$vol *
sqrt(t1))
d1 = d2 + o$vol * sqrt(t1)
d2n = ((log(o$S0/o$K) + (o$r - o$q) * t1 - o$vol^2 * t2/2)/(o$vol *
sqrt(t2)))
d1n = d2n + o$vol * sqrt(t2)
o$PxBS = (o$S0 * exp(-o$q * t1) * pnorm(d1) - o$K * exp(-o$r *
t1) * pnorm(d2) + o$K * exp(-o$r * t1) * pnorm(-d2n) -
o$S0 * exp(-o$q * t1) * pnorm(-d1n))
return(o)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.