MATLAB report publisher
Contents
Connect to Webservice
createClassFromWsdl(['http://www.vannavolga.com/plainvanilla/plainvanilla.asmx?WSDL'])
ans =
PlainVanillaClass
Methods available
methods(PlainVanillaClass)
Methods for class PlainVanillaClass:
BAWAmericanApprox GCarray JumpDiffusion
BAWAmericanPutApprox GDelta Merton73
BSAmericanApprox GGamma MiltersenSwartz
Black76 GRho PlainVanillaClass
BlackScholes GTheta RollGeskeWhaley
French GVega display
GBlackScholes GarmanKolhagen
More information on one methods
help PlainVanillaClass/JumpDiffusion
JumpDiffusion(obj,CallPutFlag,s,x,t,r,v,lambda,gamma)
Jump Diffusion pricing model.
Input:
CallPutFlag = (string)
s = (double)
x = (double)
t = (double)
r = (double)
v = (double)
lambda = (double)
gamma = (double)
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)
ans =
0.067899848045209127
Calculate price with varying underlying
s = linspace(0,2,20);
t = linspace(0,1,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));
zp = str2double(JumpDiffusion(obj,'p',s(1),1,t(1),0.05,0.2,2,0.4));
else
zc = [zc, str2double(JumpDiffusion(obj,'c',s(m),1,t(n),0.05,0.2,2,0.4))];
zp = [zp, str2double(JumpDiffusion(obj,'p',s(m),1,t(n),0.05,0.2,2,0.4))];
end
end
end
Reshape the output matrix
z = reshape(zc,20,20);
Plot the Call option surface
surf(x,y,z)
xlabel('Underlying');
ylabel('Time to maturity');
zlabel('Option Value');
Plot the Put option surface
z = reshape(zp,20,20);
surf(x,y,z)
xlabel('Underlying');
ylabel('Time to maturity');
zlabel('Option Value');