French
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/French
French(obj,CallPutFlag,s,x,t,t1,r,b,v,AccessCode)
French Model.
Input:
CallPutFlag = (string)
s = (double)
x = (double)
t = (double)
t1 = (double)
r = (double)
b = (double)
v = (double)
AccessCode = (string)
Output:
FrenchResult = (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
French(obj,'c',1,1,0.5,0.05,0.08,0.08,0.2,Code)
ans =
0.043657491891801126
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(French(obj,'c',s(1),1,t(1),0.05,0.08,0.08,0.2,Code));
zp = str2double(French(obj,'p',s(1),1,t(1),0.05,0.08,0.08,0.2,Code));
else
zc = [zc, str2double(French(obj,'c',s(m),1,t(n),0.05,0.08,0.08,0.2,Code))];
zp = [zp, str2double(French(obj,'p',s(m),1,t(n),0.05,0.08,0.08,0.2,Code))];
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');