Library: | finance |
See also: | BlackScholesPathIndependentMDDiv BlackScholesPathDependent1DQMC BlackScholesPathIndependent1D BlackScholesPathDependent1D |
Quantlet: | BlackScholesPathIndependentMD | |
Description: | calculates the option price and its standard deviation for path independent options in the multi-dimensional Black Scholes model by Monte Carlo simulation. |
Usage: | {z,v} = BlackScholesPathIndependentMD(s0,r,vola,dt,payoff,iterations,gennum) | |
Input: | ||
s0 | n x 1 vector of the underlying values at time 0 | |
r | scalar, risk free interest rate 5% = 0.05 | |
vola | covariance matrix of the log-price processes | |
dt | scalar, time to maturity in years | |
payoff | string, name of the payoff function for the option product | |
iterations | scalar, number of simulations | |
gennum | scalar, number of the random source which is used in the simulation | |
Output: | ||
z | scalar, estimated option price. | |
v | scalar, standard deviation of the price estimate. |
library("finance") proc(v) = SpecialOPT(s0) maxcall = 1.4*(s0[1]-40) next = 0.95*(s0[2]-60) if(next>maxcall) maxcall = next endif next = 2.1*(s0[4]-27) if(next>maxcall) maxcall = next endif next = 0.16*(s0[5]-340) if(next>maxcall) maxcall = next endif next =(s0[6]-57.5) if(next>maxcall) maxcall = next endif maxput =(55-s0[3]) if((maxput+maxcall)>0) v = maxput+maxcall else v = 0 endif endp s0 = #(40.14,59.4,56.57,26.79,335.3,58.65) r = 0.048 dt = 1 vola = #(0.1744942,0.0570134,0.0305491,0.0123347,0.0250993,0.0225357) vola = vola|#(0.0570134,0.1024468,0.0456498,0.0212167,0.0207358,0.0278711) vola = vola|#(0.0305491,0.0456498,0.0924536,0.0150578,0.0139953,0.0179354) vola = vola|#(0.0123347,0.0212167,0.0150578,0.0776464,0.0037853,0.0078510) vola = vola|#(0.0250993,0.0207358,0.0139953,0.0037853,0.0975046,0.0439312) vola = vola|#(0.0225357,0.0278711,0.0179354,0.0078510,0.0439312,0.1670526) BlackScholesPathIndependentMD(s0,r,vola,dt,"SpecialOPT",10000,3)
The results can slightly vary with every execution of this example! Contents of _tmp.z [1,] 23.315 Contents of _tmp.v [1,] 0.2135