0
$\begingroup$

I'm trying to create a code for the closed form of a SVJJ model. I don't understand why the probabilities N1 e N2 are the same. It would be an error but I don't understand where. thanks. In other words if S0 is 100 and K = 100 ( call atm) the option price is 0.39 … it is impossible !

function [svjjfft strike] = SVJJ(KAPPA,THETA,SIGMAv,RHO,V0,LAMBDAJ,MUS,SIGMAS,RHOJ,MUV,r,q,T,S0,K)

%Characteristic Function 1 Variables
%Diffusion Variables
function f1= CharFun1(w1) %valutata in w
ALPHA1 = -0.5*(w1.^2 + 1i*w1);
BETA1 = KAPPA - RHO*SIGMAv*1i*w1;
GAMMA1 = (SIGMAv^2)/2;
d1 = sqrt(BETA1.^2 - 4*ALPHA1*GAMMA1); 
rpos1 = (BETA1 + d1)/(SIGMAv^2); 
rneg1 = (BETA1 - d1)/(SIGMAv^2);
g1 = rneg1./rpos1; D1 = rneg1 .* ((1 - exp(-d1*T)) ./ (1 - g1.*exp(-d1*T)));
C1 = KAPPA * (rneg1*T - (2/(SIGMAv^2)) * log((1 - g1.*exp(-d1*T)) ./ (1 - g1)));
%Jump Variables 
MUJ1 = exp(MUS + 0.5*SIGMAS^2) / (1 - RHOJ*MUV) - 1;
c1 = 1 - RHOJ*MUV*1i*w1;
nu1 = ( (BETA1 + d1) ./ ((BETA1 + d1).*c1 - 2*MUV*ALPHA1) ) * T +( (4*MUV*ALPHA1) ./ ((d1.*c1).^2 - (2*MUV*ALPHA1 - BETA1.*c1) .^2) ) .* log( 1 - ( ((d1-BETA1).*c1 + 2*MUV*ALPHA1) ./ (2*d1.*c1) ) .* (1 - exp(-d1*T)) );
P1 = -T*(1 + MUJ1*1i*w1) + exp( MUS*1i*w1 + 0.5*(SIGMAS^2)*(1i*w1).^2 ).*nu1;
f1 = exp(C1*THETA + D1*V0 + P1*LAMBDAJ +  1i*w1*(log(S0) + (r-q)*T));
end
%Characteristic Function 2 Variables
function f2= CharFun2(w2)
ALPHA2 = -0.5*(w2.^2 + 1i*w2); 
BETA2 = KAPPA - RHO*SIGMAv*1i*w2;
GAMMA2 = (SIGMAv^2)/2;
d2 = sqrt(BETA2.^2 - 4*ALPHA2*GAMMA2);
rpos2 = (BETA2 + d2)/(SIGMAv^2);
rneg2 = (BETA2 - d2)/(SIGMAv^2);
g2 = rneg2./rpos2; 
D2 = rneg2 .* ((1 - exp(-d2*T)) ./ (1 - g2.*exp(-d2*T)));
C2 = KAPPA * (rneg2*T - (2/(SIGMAv^2)) * log((1 - g2.*exp(-d2*T))./ (1 - g2)));
%Jump Variables
MUJ2 = exp(MUS + 0.5*SIGMAS^2) / (1 - RHOJ*MUV) - 1;
c2 = 1 - RHOJ*MUV*1i*w2;
nu2 = ( (BETA2 + d2) ./ ((BETA2 + d2).*c2 - 2*MUV*ALPHA2) ) * T +  ( (4*MUV*ALPHA2) ./ ((d2.*c2).^2 - (2*MUV*ALPHA2 - BETA2.*c2) .^2) ) .* log( 1 - ( ((d2-BETA2).*c2 + 2*MUV*ALPHA2) ./  (2*d2.*c2) ) .* (1 - exp(-d2*T)) );
P2 = -T*(1 + MUJ2*1i*w2) + exp( MUS*1i*w2 +  0.5*(SIGMAS^2)*(1i*w2).^2 ).*nu2;
f2 = exp(C2*THETA + D2*V0 + P2*LAMBDAJ +  1i*w2*(log(S0) + (r-q)*T));
end
function y1=fun1(w1)
y1=real(exp(-1i*w1*log(K)).*CharFun1(w1)./(1i*w1));
end
function y2=fun2(w2)
y2=real(exp(-1i*w2*log(K)).*CharFun2(w2)./(1i*w2));
end
N1=0.5+(1/pi)* quadl(@fun1,0,200,[],[]); 
N2=0.5+(1/pi)* quadl(@fun2,0,200,[],[]); 
call_price=exp(-q*T)*S0*N1-exp(-r*T)*K*N2
%call option price
end

```
$\endgroup$
  • 1
    $\begingroup$ Where do the formulas that you coded come from? You might mention the paper or book you are following... $\endgroup$ – noob2 Feb 14 at 15:06
  • 1
    $\begingroup$ More details for SVJJ are needed. $\endgroup$ – Gordon Feb 14 at 15:30
  • 1
    $\begingroup$ A friend of mine called Google tells me this code is taken largely from STOCHASTIC VOLATILITY MODELS: CALIBRATION, PRICING AND HEDGING, by Warrick Poklewski-Koziell, MS thesis May 2012 $\endgroup$ – noob2 Feb 14 at 22:55