%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% %%% Closed form option pricer for European option under Merton jump-diffusion %%% model %%% %%% Copyright (C) 2008 Vladimir Surkov %%% %%% %%% This program is free software: you can redistribute it and/or modify %%% it under the terms of the GNU General Public License as published by %%% the Free Software Foundation, either version 3 of the License, or %%% (at your option) any later version. %%% %%% This program is distributed in the hope that it will be useful, %%% but WITHOUT ANY WARRANTY; without even the implied warranty of %%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %%% GNU General Public License for more details. %%% %%% You should have received a copy of the GNU General Public License %%% along with this program. If not, see . %%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [values_call, values_put, time] = ClosedForm_European_MertonJumpDiffusion(S, K, T, sigma, lambda, mu, nu, r, q) values_call = zeros(length(S), length(K)); values_put = zeros(length(S), length(K)); time = cputime; N = 50; m = exp(mu+nu^2/2); for n = N:-1:0 const_n = exp(-lambda*m*T)*(lambda*m*T)^n/factorial(n); for iter_s = 1:length(S) for iter_k = 1:length(K) [value_call, value_put] = blsprice_nocheck(S(iter_s),K(iter_k),r-lambda*(m-1)+n*log(m)/T, T, sqrt(sigma*sigma+n*nu*nu/T), q); values_call(iter_s, iter_k) = values_call(iter_s, iter_k) + const_n*value_call; values_put(iter_s, iter_k) = values_put(iter_s, iter_k) + const_n*value_put; end end end time = cputime - time;