Showing posts with label How to solve option price. Show all posts
Showing posts with label How to solve option price. Show all posts

## How to solve option price

vanilla <- GBSOption(TypeFlag = "c", S = 100, X = 90, Time = 1,
+                      r = 0.02, b = -0.02, sigma = 0.3)
> KO <- sapply(100:300, FUN = StandardBarrierOption, TypeFlag = "cuo",
+              S = 100, X = 90, K = 0, Time = 1, r = 0.02, b = -0.02, sigma = 0.30)

Warning messages:
1: In if (X >= H) { :
the condition has length > 1 and only the first element will be used
2: In if (X < H) { :
the condition has length > 1 and only the first element will be used
> plot(KO[[1]]@price, type = "l",
+      xlab = "barrier distance from spot",
+      ylab = "price of option",
+      main = "Price of KO converges to plain vanilla")
> abline(h = vanilla@price, col = "red")
> vanilla <- GBSOption(TypeFlag = "c", S = 100, X = 90, Time = 1,
+                      r = 0.02, b = -0.02, sigma = 0.3)
> library(plot3D)
Warning message:
package ‘plot3D’ was built under R version 3.5.2
> BS_surface <- function(S, Time, FUN, ...) {
+     require(plot3D)
+     n <- length(S)
+     k <- length(Time)
+     m <- matrix(0, n, k)
+     for (i in 1:n){
+         for (j in 1:k){
+             l <- list(S = S[i], Time = Time[j], ...)
+             m[i,j] <- max(do.call(FUN, l)@price, 0)
+         }
+     }
+     persp3D(z = m, xlab = "underlying", ylab = "Remaining time",
+             zlab = "option price", phi = 30, theta = 20, bty = "b2")
+ }
> BS_surface(seq(1, 200,length = 200), seq(0, 2, length = 200),
+            GBSOption, TypeFlag = "c", X = 90, r = 0.02, b = 0, sigma = 0.3)
> BS_surface(seq(1,200,length = 200), seq(0, 2, length = 200),
+            StandardBarrierOption, TypeFlag = "cuo", H = 130, X = 90, K = 0,
+            r = 0.02, b = -0.02, sigma = 0.30)
> example(persp3D)

prsp3D> # save plotting parameters
prsp3D>  pm <- par("mfrow")

prsp3D> ## =======================================================================
prsp3D> ## Ribbon, persp, color keys, facets
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(2, 2))

prsp3D> # simple, no scaling, use breaks to set colors
prsp3D>  persp3D(z = volcano, main = "volcano", clab = c("height", "m"),
prsp3D+    breaks = seq(80,200, by = 10))
Hit <Return> to see next plot:

prsp3D> # keep ratios between x- and y (scale = FALSE)
prsp3D> # change ratio between x- and z (expand)
prsp3D>  persp3D(z = volcano, x = 1: nrow(volcano), y = 1:ncol(volcano),
prsp3D+        expand = 0.3, main = "volcano", facets = FALSE, scale = FALSE,
prsp3D+        clab = "height, m", colkey = list(side = 1, length = 0.5))

prsp3D> # ribbon, in x--direction
prsp3D>  V <- volcano[, seq(1, ncol(volcano), by = 3)]  # lower resolution

prsp3D>  ribbon3D(z = V, colkey = list(width = 0.5, length = 0.5,
prsp3D+           cex.axis = 0.8, side = 2), clab = "m")

prsp3D> # ribbon, in y-direction
prsp3D>  Vy <- volcano[seq(1, nrow(volcano), by = 3), ]

prsp3D>  ribbon3D(z = Vy, expand = 0.3, space = 0.3, along = "y",
prsp3D+           colkey = list(width = 0.5, length = 0.5, cex.axis = 0.8))

prsp3D> ## =======================================================================
prsp3D> ## Several ways to visualise 3-D data
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  x <- seq(-pi, pi, by = 0.2)

prsp3D>  y <- seq(-pi, pi, by = 0.3)

prsp3D>  grid <- mesh(x, y)

prsp3D>  z    <- with(grid, cos(x) * sin(y))

prsp3D>  par(mfrow = c(2,2))

prsp3D>  persp3D(z = z, x = x, y = y)
Hit <Return> to see next plot:

prsp3D>  persp3D(z = z, x = x, y = y, facets = FALSE, curtain = TRUE)

prsp3D> # ribbons in two directions and larger spaces
prsp3D>  ribbon3D(z = z, x = x, y = y, along = "xy", space = 0.3)

prsp3D>  hist3D(z = z, x = x, y = y, border = "black")

prsp3D> ## =======================================================================
prsp3D> ## Contours and images added
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(2, 2))

prsp3D>  x <- seq(1, nrow(volcano), by = 3)

prsp3D>  y <- seq(1, ncol(volcano), by = 3)

prsp3D>  Volcano <- volcano [x, y]

prsp3D>  ribbon3D(z = Volcano, contour = TRUE, zlim= c(-100, 200),
prsp3D+           image = TRUE)
Hit <Return> to see next plot:

prsp3D>  persp3D(z = Volcano, contour = TRUE, zlim= c(-200, 200), image = FALSE)

prsp3D>  persp3D(z = Volcano, x = x, y = y, scale = FALSE,
prsp3D+        contour = list(nlevels = 20, col = "red"),
prsp3D+        zlim = c(-200, 200), expand = 0.2,
prsp3D+        image = list(col = grey (seq(0, 1, length.out = 100))))

prsp3D>  persp3D(z = Volcano, contour = list(side = c("zmin", "z", "350")),
prsp3D+        zlim = c(-100, 400), phi = 20, image = list(side = 350))

prsp3D> ## =======================================================================
prsp3D> ## Use of inttype
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(2, 2))

prsp3D>  persp3D(z = Volcano, shade = 0.5, colkey = FALSE)
Hit <Return> to see next plot:

prsp3D>  persp3D(z = Volcano, inttype = 2, shade = 0.5, colkey = FALSE)

prsp3D>  x <- y <- seq(0, 2*pi, length.out = 10)

prsp3D>  z <- with (mesh(x, y), cos(x) *sin(y)) + runif(100)

prsp3D>  cv <- matrix(nrow = 10, 0.5*runif(100))

prsp3D>  persp3D(x, y, z, colvar = cv)              # takes averages of z

prsp3D>  persp3D(x, y, z, colvar = cv, inttype = 2) # takes averages of colvar

prsp3D> ## =======================================================================
prsp3D> ## Use of inttype with NAs
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(2, 2))

prsp3D>  VV <- V2 <- volcano[10:15, 10:15]

prsp3D>  V2[3:4, 3:4] <- NA

prsp3D>  V2[4, 5] <- NA

prsp3D>  image2D(V2, border = "black")  # shows true NA region
Hit <Return> to see next plot:

prsp3D> # averages of V2, including NAs, NA region larger
prsp3D>  persp3D(z = VV, colvar = V2, inttype = 1, theta = 0,
prsp3D+        phi = 20, border = "black", main = "inttype = 1")

prsp3D> # extension of VV; NAs unaffected
prsp3D>  persp3D(z = VV, colvar = V2, inttype = 2, theta = 0,
prsp3D+        phi = 20, border = "black", main = "inttype = 2")

prsp3D> # average of V2, ignoring NA; NA region smaller
prsp3D>  persp3D(z = VV, colvar = V2, inttype = 3, theta = 0,
prsp3D+        phi = 20, border = "black", main = "inttype = 3")

prsp3D> ## =======================================================================
prsp3D> ## Use of panel.first
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(1, 1))

prsp3D> # A function that is called after the axes were drawn
prsp3D>  panelfirst <- function(trans) {
prsp3D+     zticks <- seq(100, 180, by = 20)
prsp3D+     len <- length(zticks)
prsp3D+     XY0 <- trans3D(x = rep(1, len), y = rep(1, len), z = zticks,
prsp3D+                    pmat = trans)
prsp3D+     XY1 <- trans3D(x = rep(1, len), y = rep(61, len), z = zticks,
prsp3D+                    pmat = trans)
prsp3D+     segments(XY0\$x, XY0\$y, XY1\$x, XY1\$y, lty = 2)
prsp3D+
prsp3D+     rm <- rowMeans(volcano)
prsp3D+     XY <- trans3D(x = 1:87, y = rep(ncol(volcano), 87),
prsp3D+                   z = rm, pmat = trans)
prsp3D+     lines(XY, col = "blue", lwd = 2)
prsp3D+  }

prsp3D>  persp3D(z = volcano, x = 1:87, y = 1: 61, scale = FALSE, theta = 10,
prsp3D+        expand = 0.2, panel.first = panelfirst, colkey = FALSE)
Hit <Return> to see next plot:

prsp3D> ## =======================================================================
prsp3D> ## with / without colvar / facets
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(2, 2))

prsp3D>  persp3D(z = volcano, shade = 0.3, col = gg.col(100))
Hit <Return> to see next plot:

prsp3D> # shiny colors - set lphi for more brightness
prsp3D>  persp3D(z = volcano, lighting = TRUE, lphi = 90)

prsp3D>  persp3D(z = volcano, col = "lightblue", colvar = NULL,
prsp3D+    shade = 0.3, bty = "b2")

prsp3D> # this also works:
prsp3D> #  persp3D(z = volcano, col = "grey", shade = 0.3)
prsp3D>
prsp3D> # tilted x- and y-coordinates of 'volcano'
prsp3D>  volcx <- matrix(nrow = 87, ncol = 61, data = 1:87)

prsp3D>  volcx <- volcx + matrix(nrow = 87, ncol = 61,
prsp3D+         byrow = TRUE, data = seq(0., 15, length.out = 61))

prsp3D>  volcy <- matrix(ncol = 87, nrow = 61, data = 1:61)

prsp3D>  volcy <- t(volcy + matrix(ncol = 87, nrow = 61,
prsp3D+         byrow = TRUE, data = seq(0., 15, length.out = 87)))

prsp3D>  persp3D(volcano, x = volcx, y = volcy, phi = 80)

prsp3D> ## =======================================================================
prsp3D> ## Several persps on one plot
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(1, 1))

prsp3D>  clim <- range(volcano)

prsp3D>  persp3D(z = volcano, zlim = c(100, 600), clim = clim,
prsp3D+    box = FALSE, plot = FALSE)
Hit <Return> to see next plot:

prsp3D>  persp3D(z = volcano + 200, clim = clim, colvar = volcano,
prsp3D+        add = TRUE, colkey = FALSE, plot = FALSE)

prsp3D>  persp3D(z = volcano + 400, clim = clim, colvar = volcano,
prsp3D+        add = TRUE, colkey = FALSE)    # plot = TRUE by default

prsp3D> ## =======================================================================
prsp3D> ## hist3D
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(2, 2))

prsp3D>  VV   <- volcano[seq(1, 87, 15), seq(1, 61, 15)]

prsp3D>  hist3D(z = VV, scale = FALSE, expand = 0.01, border = "black")
Hit <Return> to see next plot:

prsp3D> # transparent colors
prsp3D>  hist3D(z = VV, scale = FALSE, expand = 0.01,
prsp3D+    alpha = 0.5, opaque.top = TRUE, border = "black")

prsp3D>  hist3D(z = VV, scale = FALSE, expand = 0.01, facets = FALSE, lwd = 2)

prsp3D>  hist3D(z = VV, scale = FALSE, expand = 0.01, facets = NA)

prsp3D> ## =======================================================================
prsp3D> ## hist3D and ribbon3D with greyish background, rotated, rescaled,...
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(2, 2))

prsp3D>  hist3D(z = VV, scale = FALSE, expand = 0.01, bty = "g", phi = 20,
prsp3D+         col = "#0072B2", border = "black", shade = 0.2, ltheta = 90,
prsp3D+         space = 0.3, ticktype = "detailed", d = 2)
Hit <Return> to see next plot:

prsp3D> # extending the ranges
prsp3D>  plotdev(xlim = c(-0.2, 1.2), ylim = c(-0.2, 1.2), theta = 45)

prsp3D>  ribbon3D(z = VV, scale = FALSE, expand = 0.01, bty = "g", phi = 20,
prsp3D+         col = "lightblue", border = "black", shade = 0.2, ltheta = 90,
prsp3D+         space = 0.3, ticktype = "detailed", d = 2, curtain = TRUE)

prsp3D>  ribbon3D(z = VV, scale = FALSE, expand = 0.01, bty = "g", phi = 20, zlim = c(95,183),
prsp3D+         col = "lightblue", lighting = TRUE, ltheta = 50, along = "y",
prsp3D+         space = 0.7, ticktype = "detailed", d = 2, curtain = TRUE)

prsp3D> ## =======================================================================
prsp3D> ## hist3D for a 1-D data set
prsp3D> ## =======================================================================
prsp3D>
prsp3D>  par(mfrow = c(2, 1))

prsp3D>  x <- rchisq(1000, df = 4)

prsp3D>  hs <- hist(x, breaks = 15)
Hit <Return> to see next plot:

prsp3D>  hist3D(x = hs\$mids, y = 1, z = matrix(ncol = 1, data = hs\$density),
prsp3D+   bty = "g", ylim = c(0., 2.0), scale = FALSE, expand = 20,
prsp3D+   border = "black", col = "white", shade = 0.3, space = 0.1,
prsp3D+   theta = 20, phi = 20, main = "3-D perspective")

prsp3D> # reset plotting parameters
prsp3D>  par(mfrow = pm)
>
> SpreadApproxOption(TypeFlag = "c", S1 = 28, S2 = 20, X = 7,
+                    Time = 0.25, r = 0.05, sigma1 = 0.29, sigma2 = 0.36, rho = 0.42)

Title:

Call:
SpreadApproxOption(TypeFlag = "c", S1 = 28, S2 = 20, X = 7, Time = 0.25,
r = 0.05, sigma1 = 0.29, sigma2 = 0.36, rho = 0.42)

Parameters:
Value:
TypeFlag c
S1       28
S2       20
X        7
Time     0.25
r        0.05
sigma1   0.29
sigma2   0.36
rho      0.42

Option Price:
2.140127

Description:
Mon Mar 18 23:24:49 2019

> GeometricAverageRateOption(TypeFlag = "p", S = 80, X = 85,
+                            Time = 0.25, r = 0.05, b = 0.08, sigma = 0.20)

Title:
Geometric Average Rate Option

Call:
GeometricAverageRateOption(TypeFlag = "p", S = 80, X = 85, Time = 0.25,
r = 0.05, b = 0.08, sigma = 0.2)

Parameters:
Value:
TypeFlag p
S        80
X        85
Time     0.25
r        0.05
b        0.08
sigma    0.2

Option Price:
4.69222

Description:
Mon Mar 18 23:29:12 2019

> GapOption(TypeFlag = "c", S = 50, X1 = 50, X2 = 57, Time = 0.5,
+           r = 0.09, b = 0.09, sigma = 0.20)

Title:
Gap Option

Call:
GapOption(TypeFlag = "c", S = 50, X1 = 50, X2 = 57, Time = 0.5,
r = 0.09, b = 0.09, sigma = 0.2)

Parameters:
Value:
TypeFlag c
S        50
X1       50
X2       57
Time     0.5
r        0.09
b        0.09
sigma    0.2

Option Price:
-0.005252202

Description:
Mon Mar 18 23:38:49 2019

> CashOrNothingOption(TypeFlag = "p", S = 100, X = 80, K = 10,
+                     Time = 9/12, r = 0.06, b = 0, sigma = 0.35)

Title:
Cash Or Nothing Option

Call:
CashOrNothingOption(TypeFlag = "p", S = 100, X = 80, K = 10,
Time = 9/12, r = 0.06, b = 0, sigma = 0.35)

Parameters:
Value:
TypeFlag p
S        100
X        80
K        10
Time     0.75
r        0.06
b        0
sigma    0.35

Option Price:
2.215541

Description:
Mon Mar 18 23:39:22 2019

> TwoAssetCashOrNothingOption(TypeFlag = "c", S1 = 100, S2 = 100,
+                             X1 = 110, X2 = 90, K = 10, Time = 0.5, r = 0.10, b1 = 0.05,
+                             b2 = 0.06, sigma1 = 0.20, sigma2 = 0.25, rho = 0.5)

Title:
Two Asset Cash Or Nothing Option

Call:
TwoAssetCashOrNothingOption(TypeFlag = "c", S1 = 100, S2 = 100,
X1 = 110, X2 = 90, K = 10, Time = 0.5, r = 0.1, b1 = 0.05,
b2 = 0.06, sigma1 = 0.2, sigma2 = 0.25, rho = 0.5)

Parameters:
Value:
TypeFlag c
S1       100
S2       100
X1       110
X2       90
K        10
Time     0.5
r        0.1
b1       0.05
b2       0.06
sigma1   0.2
sigma2   0.25
rho      0.5

Option Price:
2.49875

Description:
Mon Mar 18 23:39:41 2019

> TwoAssetCashOrNothingOption(TypeFlag = "p", S1 = 100, S2 = 100,
+                             X1 = 110, X2 = 90, K = 10, Time = 0.5, r = 0.10, b1 = 0.05,
+                             b2 = 0.06, sigma1 = 0.20, sigma2 = 0.25, rho = -0.5)

Title:
Two Asset Cash Or Nothing Option

Call:
TwoAssetCashOrNothingOption(TypeFlag = "p", S1 = 100, S2 = 100,
X1 = 110, X2 = 90, K = 10, Time = 0.5, r = 0.1, b1 = 0.05,
b2 = 0.06, sigma1 = 0.2, sigma2 = 0.25, rho = -0.5)

Parameters:
Value:
TypeFlag p
S1       100
S2       100
X1       110
X2       90
K        10
Time     0.5
r        0.1
b1       0.05
b2       0.06
sigma1   0.2
sigma2   0.25
rho      -0.5

Option Price:
1.116392

Description:
Mon Mar 18 23:40:16 2019

> TwoAssetCashOrNothingOption(TypeFlag = "ud", S1 = 100, S2 = 100,
+                             X1 = 110, X2 = 90, K = 10, Time = 1, r = 0.10, b1 = 0.05,
+                             b2 = 0.06, sigma1 = 0.20, sigma2 = 0.25, rho = 0)

Title:
Two Asset Cash Or Nothing Option

Call:
TwoAssetCashOrNothingOption(TypeFlag = "ud", S1 = 100, S2 = 100,
X1 = 110, X2 = 90, K = 10, Time = 1, r = 0.1, b1 = 0.05,
b2 = 0.06, sigma1 = 0.2, sigma2 = 0.25, rho = 0)

Parameters:
Value:
TypeFlag ud
S1       100
S2       100
X1       110
X2       90
K        10
Time     1
r        0.1
b1       0.05
b2       0.06
sigma1   0.2
sigma2   0.25
rho      0

Option Price:
0.9957608

Description:
Mon Mar 18 23:40:38 2019

> TwoAssetCashOrNothingOption(TypeFlag = "du", S1 = 100, S2 = 100,
+                             X1 = 110, X2 = 90, K = 10, Time = 1, r = 0.10, b1 = 0.05,
+                             b2 = 0.06, sigma1 = 0.20, sigma2 = 0.25, rho = 0)

Title:
Two Asset Cash Or Nothing Option

Call:
TwoAssetCashOrNothingOption(TypeFlag = "du", S1 = 100, S2 = 100,
X1 = 110, X2 = 90, K = 10, Time = 1, r = 0.1, b1 = 0.05,
b2 = 0.06, sigma1 = 0.2, sigma2 = 0.25, rho = 0)

Parameters:
Value:
TypeFlag du
S1       100
S2       100
X1       110
X2       90
K        10
Time     1
r        0.1
b1       0.05
b2       0.06
sigma1   0.2
sigma2   0.25
rho      0

Option Price:
4.001356

Description:
Mon Mar 18 23:41:01 2019

> AssetOrNothingOption(TypeFlag = "p", S = 70, X = 65, Time = 0.5,
+                      r = 0.07, b = 0.07 - 0.05, sigma = 0.27)

Title:
Asset Or Nothing Option

Call:
AssetOrNothingOption(TypeFlag = "p", S = 70, X = 65, Time = 0.5,
r = 0.07, b = 0.07 - 0.05, sigma = 0.27)

Parameters:
Value:
TypeFlag p
S        70
X        65
Time     0.5
r        0.07
b        0.02
sigma    0.27

Option Price:
20.20695

Description:
Mon Mar 18 23:41:22 2019

> SuperShareOption(S = 100, XL = 90, XH = 110, Time = 0.25, r = 0.10,
+                  b = 0, sigma = 0.20)

Title:
Super Share Option

Call:
SuperShareOption(S = 100, XL = 90, XH = 110, Time = 0.25, r = 0.1,
b = 0, sigma = 0.2)

Parameters:
Value:
S     100
XL    90
XH    110
Time  0.25
r     0.1
b     0
sigma 0.2

Option Price:
0.7389401

Description:
Mon Mar 18 23:42:00 2019

> BinaryBarrierOption(TypeFlag = "6", S = 95, X=102, H = 100,
+                     K = 15, Time = 0.5, r = 0.1, b = 0.1, sigma = 0.20)

Title:
Binary Barrier Option

Call:
BinaryBarrierOption(TypeFlag = "6", S = 95, X = 102, H = 100,
K = 15, Time = 0.5, r = 0.1, b = 0.1, sigma = 0.2)

Parameters:
Value:
TypeFlag 6
S        95
X        102
H        100
K        15
Time     0.5
r        0.1
b        0.1
sigma    0.2
eta      -1
phi      1

Option Price:
11.22233

Description:
Mon Mar 18 23:42:21 2019

> BinaryBarrierOption(TypeFlag = "12", S = 95, X = 98, H = 100,
+                     K = 15, Time = 0.5, r = 0.1, b = 0.1, sigma = 0.20)

Title:
Binary Barrier Option

Call:
BinaryBarrierOption(TypeFlag = "12", S = 95, X = 98, H = 100,
K = 15, Time = 0.5, r = 0.1, b = 0.1, sigma = 0.2)

Parameters:
Value:
TypeFlag 12
S        95
X        98
H        100
K        15
Time     0.5
r        0.1
b        0.1
sigma    0.2
eta      -1
phi      -1

Option Price:
17.29827

Description:
Mon Mar 18 23:42:35 2019

> SoftBarrierOption(TypeFlag = "cdo", S = 100, X = 100, L = 70,
+                   U = 95, Time = 0.5, r = 0.1, b = 0.05, sigma = 0.20)

Title:
Soft Barrier Option

Call:
SoftBarrierOption(TypeFlag = "cdo", S = 100, X = 100, L = 70,
U = 95, Time = 0.5, r = 0.1, b = 0.05, sigma = 0.2)

Parameters:
Value:
TypeFlag cdo
S        100
X        100
L        70
U        95
Time     0.5
r        0.1
b        0.05
sigma    0.2

Option Price:
6.442895

Description:
Mon Mar 18 23:59:14 2019

> SoftBarrierOption(TypeFlag = "cdo", S = 100, X = 100, L = 70,
+                   U = 95, Time = 0.0005, r = 0.1, b = 0.05, sigma = 0.20)

Title:
Soft Barrier Option

Call:
SoftBarrierOption(TypeFlag = "cdo", S = 100, X = 100, L = 70,
U = 95, Time = 5e-04, r = 0.1, b = 0.05, sigma = 0.2)

Parameters:
Value:
TypeFlag cdo
S        100
X        100
L        70
U        95
Time     5e-04
r        0.1
b        0.05
sigma    0.2

Option Price:
0.1796593

Description:
Tue Mar 19 00:00:17 2019

> DiscreteBarrierOption(S = 100, H = 105, sigma = 0.25, dt = 0.1)

Title:
Discrete Barrier Option

Call:
DiscreteBarrierOption(S = 100, H = 105, sigma = 0.25, dt = 0.1)

Parameters:
Value:
S     100
H     105
sigma 0.25
dt    0.1

Option Price:
109.9493

Description:
Tue Mar 19 00:00:55 2019

> ExecutiveStockOption(TypeFlag = "c", S = 60, X = 64, Time = 2,
+                      r = 0.07, b = 0.07-0.03, sigma = 0.38, lambda = 0.15)

Title:
Executive Stock Option Valuation

Call:
ExecutiveStockOption(TypeFlag = "c", S = 60, X = 64, Time = 2,
r = 0.07, b = 0.07 - 0.03, sigma = 0.38, lambda = 0.15)

Parameters:
Value:
TypeFlag c
S        60
X        64
Time     2
r        0.07
b        0.04
sigma    0.38
lambda   0.15

Option Price:
9.124388

Description:
Tue Mar 19 00:06:34 2019

> ExecutiveStockOption(TypeFlag = "c", S = 60, X = 64, Time = 2,
+                      r = 0.07, b = 0.07-0.03, sigma = 0.38, lambda = 0.15)

Title:
Executive Stock Option Valuation

Call:
ExecutiveStockOption(TypeFlag = "c", S = 60, X = 64, Time = 2,
r = 0.07, b = 0.07 - 0.03, sigma = 0.38, lambda = 0.15)

Parameters:
Value:
TypeFlag c
S        60
X        64
Time     2
r        0.07
b        0.04
sigma    0.38
lambda   0.15

Option Price:
9.124388

Description:
Tue Mar 19 00:07:46 2019

> RatchetOption(TypeFlag = "c", S = 60, alpha = 1.1, time1 = c(1.00, 0.75),
+               Time2 = c(0.75, 0.50), r = 0.08, b = 0.04, sigma = 0.30)

Title:
Ratchet Option Valuation

Call:
RatchetOption(TypeFlag = "c", S = 60, alpha = 1.1, time1 = c(1,
0.75), Time2 = c(0.75, 0.5), r = 0.08, b = 0.04, sigma = 0.3)

Parameters:
Value:
TypeFlag c
S        60
alpha    1.1
time11   1
time12   0.75
Time21   0.75
Time22   0.5
r        0.08
b        0.04
sigma    0.3

Option Price:
3.2132

Description:
Tue Mar 19 00:08:00 2019

> TimeSwitchOption(TypeFlag = "c", S = 100, X = 110, Time = 1,
+                  r = 0.06, b = 0.06, sigma = 0.26, A = 5, m = 0, dt = 1/365)

Title:
Time Switch Option Valuation

Call:
TimeSwitchOption(TypeFlag = "c", S = 100, X = 110, Time = 1,
r = 0.06, b = 0.06, sigma = 0.26, A = 5, m = 0, dt = 1/365)

Parameters:
Value:
TypeFlag c
S        100
X        110
Time     1
r        0.06
b        0.06
sigma    0.26
A        5
m        0
d        0.00273972602739726

Option Price:
1.375037

Description:
Tue Mar 19 00:08:23 2019

> SimpleChooserOption(S = 50, X = 50, time1 = 1/4, Time2 = 1/2,
+                     r = 0.08, b = 0.08, sigma = 0.25)

Title:
Simple Chooser Option Valuation

Call:
SimpleChooserOption(S = 50, X = 50, time1 = 1/4, Time2 = 1/2,
r = 0.08, b = 0.08, sigma = 0.25)

Parameters:
Value:
S     50
X     50
time1 0.25
Time2 0.5
r     0.08
b     0.08
sigma 0.25

Option Price:
6.107073

Description:
Tue Mar 19 00:08:44 2019

> ComplexChooserOption(S = 50, Xc = 55, Xp = 48, Time = 0.25,
+                      Timec = 0.50, Timep = 0.5833, r = 0.10, b = 0.1-0.05,
+                      sigma = 0.35, doprint = TRUE)

Critical Value:
[1] 51.11561

Title:
Complex Chooser Option Valuation

Call:
ComplexChooserOption(S = 50, Xc = 55, Xp = 48, Time = 0.25, Timec = 0.5,
Timep = 0.5833, r = 0.1, b = 0.1 - 0.05, sigma = 0.35, doprint = TRUE)

Parameters:
Value:
S             50
Xc            55
Xp            48
time          new("standardGeneric", .Data = function (x, ...) \nstandardGeneric("time"), generic = "time", package = "stats", group = list(), valueClass = character(0), signature = "x", default = new("derivedDefaultMethod", .Data = function (x, ...) \nUseMethod("time"), target = new("signature", .Data = "ANY", names = "x", package = "methods"), defined = new("signature", .Data = "ANY", names = "x", package = "methods"), generic = "time"), skeleton = (new("derivedDefaultMethod", .Data = function (x, ...) \nUseMethod("time"), target = new("signature", .Data = "ANY", names = "x", package = "methods"), defined = new("signature", .Data = "ANY", names = "x", package = "methods"), generic = "time"))(x, ...))
Timec         0.5
Timep         0.5833
r             0.1
b             0.05
sigma         0.35
criticalValue 51.1156056231326

Option Price:
6.050727

Description:
Tue Mar 19 00:09:03 2019

> OptionOnOption(TypeFlag = "pc", S = 500, X1 = 520, X2 = 50,
+                time1 = 1/2, Time2 = 1/4, r = 0.08, b = 0.08-0.03, sigma = 0.35)

Title:
Option On Option Valuation

Call:
OptionOnOption(TypeFlag = "pc", S = 500, X1 = 520, X2 = 50, time1 = 1/2,
Time2 = 1/4, r = 0.08, b = 0.08 - 0.03, sigma = 0.35)

Parameters:
Value:
S             500
X1            520
X2            50
time1         0.5
Time2         0.25
r             0.08
b             0.05
sigma         0.35
criticalValue 538.316546560699

Option Price:
21.19647

Description:
Tue Mar 19 00:09:19 2019

> HolderExtendibleOption(TypeFlag = "c", S = 100, X1 = 100,
+                        X2 = 105, time1 = 0.50, Time2 = 0.75, r = 0.08, b = 0.08,
+                        sigma = 0.25, A = 1)

Title:
Holder Extendible Option Valuation

Call:
HolderExtendibleOption(TypeFlag = "c", S = 100, X1 = 100, X2 = 105,
time1 = 0.5, Time2 = 0.75, r = 0.08, b = 0.08, sigma = 0.25,
A = 1)

Parameters:
Value:
TypeFlag c
S        100
X1       100
X2       105
time1    0.5
Time2    0.75
r        0.08
b        0.08
sigma    0.25
A        1

Option Price:
2.729216

Description:
Tue Mar 19 00:09:53 2019

> WriterExtendibleOption(TypeFlag = "c", S = 80, X1 = 90, X2 = 82,
+                        time1 = 0.50, Time2 = 0.75, r = 0.10, b = 0.10, sigma = 0.30)

Title:
Writer Extendible Option Valuation

Call:
WriterExtendibleOption(TypeFlag = "c", S = 80, X1 = 90, X2 = 82,
time1 = 0.5, Time2 = 0.75, r = 0.1, b = 0.1, sigma = 0.3)

Parameters:
Value:
TypeFlag c
S        80
X1       90
X2       82
time1    0.5
Time2    0.75
r        0.1
b        0.1
sigma    0.3

Option Price:
6.823755

Description:
Tue Mar 19 00:10:07 2019

### Black-Scholes formula-R

Black-Scholes formula-R > BlackScholes <- function(TypeFlag = c("c", "p"), S, X, Time, r, b, sigma) { TypeFla...