C183 HW4
YIK LUN, KEI
                                     704-115-065
                                       2017/5/30
Exercise 1
S1 <- seq(0,80,by=1)
C <- 4
E <- 50
x2 <- ifelse(S1 > E, E-S1+C, C)
plot(S1,x2,ylim=c(-30,30),type="l",
     main="Profit from selling a call: C=4,E=50",ylab="Profit",xlab="S1")
                        Profit from selling a call: C=4,E=50
         30
         20
         10
Profit
         0
         10
         30
               0            20                  40            60            80
                                                S1
Exercise 2
S1 <- seq(0,80,by=1)
P <- 3
E <- 40
x2 <- ifelse(S1 < E, E-S1-P,-P)
plot(S1,x2,ylim=c(-20,50),type="l",
     main="Profit from buying a put: P=4,E=40",ylab="Profit",xlab="S1")
                                            1
                              Profit from buying a put: P=4,E=40
         10 20 30 40 50
Profit
         0
         20
                          0     20               40           60             80
                                                 S1
Exercise 3
S1 <- seq(0,80,by=1)
P <- 6
E <- 50
x2 <- ifelse(S1 < E, (E-S1-P)*2,-P*2)
plot(S1,x2,ylim=c(-30,90),type="l",
     main="Profit from buying two puts: P=6,E=50",ylab="Profit",xlab="S1")
                                             2
                      Profit from buying two puts: P=6,E=50
         80
         60
         40
Profit
         20
         0
         20
               0            20                  40            60           80
                                                S1
S1 <- seq(0,80,by=1)
C <- 5
E <- 50
x2 <- ifelse(S1 > E, S1-E-C,-C)
plot(S1,x2,ylim=c(-30,40),type="l",
     main="Profit from buying a call: C=5,E=50",ylab="Profit",xlab="S1")
                                            3
                           Profit from buying a call: C=5,E=50
         10 20 30 40
Profit
         10 0
         30
                       0      20                40            60              80
                                                S1
S1 <- seq(0,80,by=1)
P <- 6
E <- 50
C <- 5
x1 <- ifelse(S1 > E, S1-E-C,-C)
x2 <- ifelse(S1 < E, (E-S1-P)*2,-P*2)
x3 <- x1+x2
plot(S1,x3,ylim=c(-20,85),type="l",
     main="Profit from buying two puts and one call: C=5, P=6, E=50",ylab="Profit",xlab="S1")
                                            4
               Profit from buying two puts and one call: C=5, P=6, E=50
         80
         60
         40
Profit
         20
         0
         20
                0           20                  40            60              80
                                                S1
Exercise 4
S1 <- seq(0,70,by=1)
sC <- 5
sE <- 45
bC <- 8
bE <- 40
x1 <- ifelse(S1 > bE, S1-bE-bC,-bC)
x2 <- ifelse(S1 > sE, -(S1-sE-sC)*2,sC*2)
x3 <- x1+x2
plot(S1,x3,ylim=c(-20,10),type="l",
     main="Profit from buying one call and selling two calls",ylab="Profit",xlab="S1")
                                            5
                   Profit from buying one call and selling two calls
         10
         5
         0
Profit
         5
         10
         20
               0       10        20     30            40   50   60     70
                                                 S1
Exercise 5
                ST      buy call sell call buy put sell put  Total
             ST > E2    ST  E1 E2  ST       0        0    E2  E1
           E1 < ST < E2 ST  E1      0     E2  ST     0    E2  E1
             ST < E1       0         0     E2  ST ST  E1 E2  E1
S1 <- seq(0,90,by=1)
sCE <- 60
bCE <- 50
sPE <- 50
bPE <- 60
x1 <- ifelse(S1 > bCE,   S1-bCE,0)
x2 <- ifelse(S1 > sCE,   -(S1-sCE),0)
x3 <- ifelse(S1 < sPE,   -(sPE-S1),0)
x4 <- ifelse(S1 < bPE,   bPE-S1,0)
x5 <- x1+x2+x3+x4
bull <- x1+x2
bear <- x3+x4
                                             6
plot(S1,bull,ylim=c(-1,11),type="l",
     main="bull spread",ylab="Payoff",xlab="S1")
                                       bull spread
         10
         8
         6
Payoff
         4
         2
         0
              0           20             40          60   80
                                                S1
plot(S1,bear,ylim=c(-1,11),type="l",
     main="bear spread",ylab="Payoff",xlab="S1")
                                       bear spread
         10
         8
         6
Payoff
         4
         2
         0
              0           20             40          60   80
                                                S1
                                            7
plot(S1,x5,ylim=c(5,15),type="l",
     main="box spread",ylab="Payoff",xlab="S1")
                                       box spread
         14
         12
Payoff
         10
         8
         6
              0             20           40          60   80
                                                S1
Exercise 6
k should be round up to 6
k <- log(60/((1/1.2)^10 * 50 ))/log(1.2/(1/1.2));k
## [1] 5.5
u <- 1.2
d <- 1/1.2
S <- 50
E <- 60
Su10 <- 50 * u^10
Su9d1 <- 50 * u^9*   d
Su8d2 <- 50 * u^8*   d^2
Su7d3 <- 50 * u^7*   d^3
Su6d4 <- 50 * u^6*   d^4
Su5d5 <- 50 * u^5*   d^5
Su4d6 <- 50 * u^4*   d^6
Su3d7 <- 50 * u^3*   d^7
                                            8
Su2d8 <- 50 * u^2* d^8
Su1d9 <- 50 * u^1* d^9
Sd10 <- 50 * d^10
period10 <- c(Su10,Su9d1,Su8d2,Su7d3,Su6d4,Su5d5,Su4d6,Su3d7,Su2d8,Su1d9,Sd10)
period10
##   [1] 309.586821 214.990848 149.299200 103.680000        72.000000   50.000000
##   [7] 34.722222 24.112654 16.744899 11.628402             8.075279
c10 <- ifelse(period10 > E, period10-E , 0)
c10
##   [1] 249.5868 154.9908    89.2992   43.6800   12.0000     0.0000    0.0000
##   [8]   0.0000   0.0000     0.0000    0.0000
p <- (1+0.1-d)/(u-d)
pprime <- (p*u)/(1+0.1)
50*pbinom(5,10,pprime, lower.tail=FALSE) -
  (60/(1+0.1)^10)*pbinom(5,10, p, lower.tail=FALSE)
## [1] 27.48628
p <- (1 + 0.1 - d) / (u-d)
pro <- c(p^10 * choose(10,0), p^9 * (1-p) * choose(10,1), p^8 * (1-p)^2 * choose(10,2),
         p^7 * (1-p)^3 * choose(10,3), p^6 * (1-p)^4 * choose(10,4), p^5 * (1-p)^5* choose(10,5),
         p^4 * (1-p)^6* choose(10,6),p^3 * (1-p)^7* choose(10,7),p^2 * (1-p)^8* choose(10,8),
         p^1 * (1-p)^9* choose(10,9), (1-p)^10* choose(10,10))
sum(pro * c10) / (1+0.1)^10
## [1] 27.48628
Exercise 7
u <- 1+0.06
d <- 1-0.05
S <- 50
E <- 51
t<-1/4
rp <- 0.05
                                                  9
p <- (exp(rp*t)-d)/(u-d)
Su <- S * u
Sd <- S * d
Sud <- S * u * d
Suu <- S * u * u
Sdd <- S * d * d
bioptions <- matrix(rep("",15),nrow=5,ncol=3)
Cuu <- max(Suu-E,0)
Cud <- max(Sud-E,0)
Cdd <- max(Sdd-E,0)
Cu <- (Cuu*p + Cud*(1-p))/(exp(rp*t))
Cd <- (Cud*p + Cdd*(1-p))/(exp(rp*t))
C <- (Cu*p + Cd*(1-p))/(exp(rp*t))
bioptions[3,1]     <-   paste("S0=",S,", C=",round(C,4))
bioptions[2,2]     <-   paste("Su=",Su,", Cu=",round(Cu,3));
bioptions[4,2]     <-   paste("Sd=",Sd,", Cd=",round(Cd,3))
bioptions[1,3]     <-   paste("Suu=",Suu,", Cuu=",Cuu)
bioptions[3,3]     <-   paste("Sdu=",Sud,", Cud=",Cud)
bioptions[5,3]     <-   paste("Sdd=",Sdd,", Cdd=",Cdd)
bioptions
##          [,1]                 [,2]                   [,3]
##   [1,]   ""                   ""                     "Suu= 56.18 , Cuu= 5.18"
##   [2,]   ""                   "Su= 53 , Cu= 2.91"    ""
##   [3,]   "S0= 50 , C= 1.6351" ""                     "Sdu= 50.35 , Cud= 0"
##   [4,]   ""                   "Sd= 47.5 , Cd= 0"     ""
##   [5,]   ""                   ""                     "Sdd= 45.125 , Cdd= 0"
Exercise 8
Puu <- max(E-Suu,0)
Pud <- max(E-Sud,0)
Pdd <- max(E-Sdd,0)
Pu <- (Puu*p + Pud*(1-p))/(exp(rp*t))
Pd <- (Pud*p + Pdd*(1-p))/(exp(rp*t))
P <- (Pu*p + Pd*(1-p))/(exp(rp*t))
bioptions[3,1]     <-   paste("S0=",S,", P=",round(P,3))
bioptions[2,2]     <-   paste("Su=",Su,", Pu=",round(Pu,3));
bioptions[4,2]     <-   paste("Sd=",Sd,", Pd=",round(Pd,3))
bioptions[1,3]     <-   paste("Suu=",Suu,", Puu=",Puu)
bioptions[3,3]     <-   paste("Sdu=",Sud,", Pud=",round(Pud,3))
bioptions[5,3]     <-   paste("Sdd=",Sdd,", Pdd=",Pdd)
bioptions
##      [,1]                     [,2]                     [,3]
## [1,] ""                       ""                       "Suu= 56.18 , Puu= 0"
## [2,] ""                       "Su= 53 , Pu= 0.277"     ""
                                                 10
## [3,] "S0= 50 , P= 1.376" ""                     "Sdu= 50.35 , Pud= 0.65"
## [4,] ""                  "Sd= 47.5 , Pd= 2.866" ""
## [5,] ""                  ""                     "Sdd= 45.125 , Pdd= 5.875"
C + E/(exp(rp*(1/2)));P+S # t =1/2
## [1] 51.37588
## [1] 51.37588
Cu + E/(exp(rp*(1/4)));Pu+Su # t =1/4
## [1] 53.27674
## [1] 53.27674
Cd + E/(exp(rp*(1/4)));Pd+Sd
## [1] 50.36647
## [1] 50.36647
Cuu + E/(exp(rp*0));Puu+Suu # t = 0
## [1] 56.18
## [1] 56.18
Cud + E/(exp(rp*0));Pud+Sud
## [1] 51
## [1] 51
Cdd + E/(exp(rp*0));Pdd+Sdd
## [1] 51
## [1] 51
Exercise 9
If the put option were American, we need to calculate the value of the put at each node and compare it to
the payoff from early exercise. The put value at any node will be the greater beteen these two values.
early0 <- max(E-S,0)
earlyu <- max(E-Su,0)
earlyd <- max(E-Sd,0)
earlyuu <- max(E-Suu,0)
earlyud <- max(E-Sud,0)
earlydd <- max(E-Sdd,0)
bioptions[3,1] <- paste("P=",round(P,3),", EE=",early0)
bioptions[2,2] <- paste("Pu=",round(Pu,3),", EE=",earlyu);
bioptions[4,2] <- paste("Pd=",round(Pd,3),", EE=",earlyd)
bioptions[1,3] <- paste("Puu=",Puu,", EE=",earlyuu)
bioptions[3,3] <- paste("Pud=",round(Pud,3),", EE=",round(earlyud,3))
bioptions[5,3] <- paste("Pdd=",Pdd,", EE=",earlydd)
bioptions
##       [,1]                  [,2]                      [,3]
                                                   11
##   [1,]   ""                 ""                    "Puu= 0 , EE= 0"
##   [2,]   ""                 "Pu= 0.277 , EE= 0"   ""
##   [3,]   "P= 1.376 , EE= 1" ""                    "Pud= 0.65 , EE= 0.65"
##   [4,]   ""                 "Pd= 2.866 , EE= 3.5" ""
##   [5,]   ""                 ""                    "Pdd= 5.875 , EE= 5.875"
P <- (Pu*p + earlyd*(1-p))/(exp(rp*t));P
## [1] 1.645603
We can see that when t=1 and stock price goes down, the price for put option is 2.866. However, if we can
early exercise the put option, the payoff is 3.5, which is greater than 2.866. Hence it is optimal to early
exercise the put option at that node. In addition, if we had early exercised the put option at t=1, then the
put price at t=0 should also be changed based on the put price at t=1. Eventually, the put price at t=0
should be $1.645603
                                                    12