/* ** Version 01 ** Date : 20/07/2001 ** -------------------------------------------------------------------------- ** Copyright K.Cuthbertson and D. Nitzsche ** "Financial Engineering:Derivatives and Risk Manangement" - J. Wiley 2001 ** ** HEDGING AND VOLATILITY ** Graphing a jump diffusion process ** */ new ; cls ; @ ------------------------ next 2 statements required for GAUSS graphs ---------------------- @ library gauss pgraph ; graphset ; format /m1/rdn 16,8 ; output off ; screen off ; " -------------------------------------------------------------------------- " ; " " ; " Version 20/07/2001 " ; " -------------------------------------------------------------------------- " ; " Copyright K.Cuthbertson and D. Nitzsche " ; " " ; " Financial Engineering:Derivatives and Risk Manangement - J. Wiley 2001 " ; " HEDGING AND VOLATILITY " ; " Graphing a jump diffusion process " ; " " ; " -------------------------------------------------------------------------- " ; output off ; screen off ; " ------------------------------------------------------------ " ; " " ; " Definitions of Variables Used " ; " ----------------------------- " ; " " ; " " ; " S0 = Share Price (starting value) " ; " D = Drift parameter " ; " sigma = Volatility of S " ; " Intens = Intensity " ; " Jump = Jump parameter " ; " TT = Time to maturity " ; " dt = Time step " ; " " ; " ------------------------------------------------------------ " ; /* ------------------------------------- START USER DATA INPUT -------------------------------- */ S0 = 100 ; D = 0.05 ; sigma = 0.1 ; Intens = 0.2 ; Jump = 0.4 ; TT = 1 ; dt = 0.01 ; /* -------------------------------------- END USER DATA INPUT ------------------------------- */ /* ------------------------------------ STARTING THE CALCULATION ---------------------------- */ Size = (TT/dt)+1 ; /* rndseed 23456567 ; */ @ Switching this seed 'on', fixes the random variables @ ee = zeros(Size,1) ; S = zeros(Size,1) ; S[1,1] = S0 ; e = rndn(Size,1) ; t = 2 ; do until t > Size ; if e[t,.] < Intens*Jump ; ee[t,1] = 1 ; else ; ee[t,1] = 0 ; endif ; S[t,1] = S[t-1,1]*(1+D*dt+sigma*sqrt(dt)*(e[t,1]-Jump*ee[t,1])) ; t = t + 1 ; endo ; xx = zeros(Size,1) ; @ Setting up Vector for X-axis @ g = 1 ; h = 0 ; do until g > Size ; xx[g,1] = h ; h = h + dt ; g = g + 1 ; endo ; S_Jump = xx~S ; @ ------------------------------------ Printing Output and the Graph ------------------------- @ output on ; screen on ; ?; "----------------------------------------------------------------------- " ; ?; " HEDGING AND VOLATILITY " ; ?; " 15/06/2001 (Version 1) K. Cuthbertson / D. Nitzsche " ; ?; " Graphing a 'share price' which follows a jump diffusion process " ; ?; "----------------------------------------------------------------------- " ; " Parameter Inputs " ; "----------------------------------------------------------------------- " ; ?; ftos(S0, "Starting value of the share price : %*.*lf" ,10,2) ; ?; ftos(sigma, "Volatility of S : %*.*lf" ,24,2) ; ?; ftos(D, "Drift parameter : %*.*lf" ,28,2) ; ?; ftos(Intens, "Intensity parameter : %*.*lf" ,24,2) ; ?; ftos(Jump, "Jump parameter : %*.*lf" ,29,2) ; ?; ftos(TT, "Time period : %*.*lf" ,32,2) ; ?; ftos(dt, "Time steps : %*.*lf" ,33,2) ; ?; /* ?; " Printing complete time series of stock price "; S_Jump ; */ title("Stock Price : Jump Diffusion Process") ; xy (xx, S) ; end ;