JumpDiffusion

Contents

Connect to Webservice

createClassFromWsdl(['http://www.vannavolga.com/plainvanilla/plainvanilla.asmx?WSDL'])
Retrieving document at 'http://www.vannavolga.com/plainvanilla/plainvanilla.asmx?WSDL'.

ans =

PlainVanillaClass

Methods available

methods(PlainVanillaClass)
Methods for class PlainVanillaClass:

BAWAmericanApprox    GBlackScholes        GBlackScholes_Theta  MiltersenSwartz      
BSAmericanApprox     GBlackScholes_Carry  GBlackScholes_Vega   PlainVanillaClass    
Black76              GBlackScholes_Delta  GarmanKohlhagen      RollGeskeWhaley      
BlackScholes         GBlackScholes_Gamma  JumpDiffusion        display              
French               GBlackScholes_Rho    Merton73             

More information on one methods

help PlainVanillaClass/JumpDiffusion
 JumpDiffusion(obj,CallPutFlag,s,x,t,r,v,lambda,gamma,AccessCode)
 
    Jump Diffusion Model.
    
      Input:
        CallPutFlag = (string)
        s = (double)
        x = (double)
        t = (double)
        r = (double)
        v = (double)
        lambda = (double)
        gamma = (double)
        AccessCode = (string)
    
      Output:
        JumpDiffusionResult = (double)

Create a web service instance

obj = PlainVanillaClass
    endpoint: 'http://www.vannavolga.com/plainvanilla/plainvanilla.asmx'
        wsdl: 'http://www.vannavolga.com/plainvanilla/plainvanilla.asmx?WSDL'

Call the option pricing model

JumpDiffusion(obj,'c',1,1,0.5,0.05,0.20,2,0.4,Code)
ans =

0.067899848045209127

Calculate price with varying underlying

s = linspace(0,2,20);
t = linspace(0,2,20);
[x,y] = meshgrid(s,t);

clear zc;
clear zp;

for m=1:20
    for n=1:20
        if m==1 && n==1
            zc = str2double(JumpDiffusion(obj,'c',s(1),1,t(1),0.05,0.2,2,0.4,Code));
            zp = str2double(JumpDiffusion(obj,'p',s(1),1,t(1),0.05,0.2,2,0.4,Code));
        else
            zc = [zc, str2double(JumpDiffusion(obj,'c',s(m),1,t(n),0.05,0.2,2,0.4,Code))];
            zp = [zp, str2double(JumpDiffusion(obj,'p',s(m),1,t(n),0.05,0.2,2,0.4,Code))];
        end
    end
end

Reshape the output matrix

z = reshape(zc,20,20);

Plot the Call option surface

surf(x,y,z)

% Create xlabel
xlabel('Underlying');

% Create ylabel
ylabel('Time to maturity');

% Create zlabel
zlabel('Option Value');

Plot the Put option surface

z = reshape(zp,20,20);

surf(x,y,z)

% Create xlabel
xlabel('Underlying');

% Create ylabel
ylabel('Time to maturity');

% Create zlabel
zlabel('Option Value');