Advertisement
Guest User

HW3 Q1 b 10^4

a guest
Aug 16th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. # Pricing call option using Monte-Carlo Method
  2.  
  3. #Package Utilised
  4. library(MASS)
  5.  
  6. # Given parameters
  7. S0 = 100; # Initial Stock Price
  8. m = 10; # Number of stocks with dynamics under the risk neutral measure
  9. K = 100*m; # Strike Price
  10. r = 0.04; # Risk free rate
  11. sig = 0.15; # Standard deviation
  12. T = 1;
  13. p = 0.2; # Correlation
  14. N = 10000; # Number of simulations
  15.  
  16. # Covariance Matrix
  17. SIG = diag(rep(1-p,10)) + matrix(p,10,10);
  18.  
  19. # Monte Carlo simulation
  20. W <- mvrnorm(n = N, rep(0,10), SIG);
  21. SP <- (S0 * exp((r - (sig**2)/2)*T + (sig*W)));
  22. P_est <- rowSums(SP)
  23. P <- exp(-r*T)*pmax(P_est - K, 0);
  24.  
  25. C_mc <- mean(P)
  26. C_mc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement