daily pastebin goal
64%
SHARE
TWEET

HW3 Q1 b 10^4

a guest Aug 16th, 2018 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top