%% Price a European Swaption Using a Linear Gaussian Two-Factor Model
% Define the ZeroCurve, a, b, sigma, eta, and rho parameters to compute the price of the swaption.

Settle = datenum('15-Dec-2007');
 
ZeroTimes = [3/12 6/12 1 5 7 10 20 30]';
ZeroRates = [0.033 0.034 0.035 0.040 0.042 0.044 0.048 0.0475]';
CurveDates = daysadd(Settle,360*ZeroTimes,1);
 
irdc = IRDataCurve('Zero',Settle,CurveDates,ZeroRates);
 
a = .07;
b = .5;
sigma = .01;
eta = .006;
rho = -.7;
 
Reset = 1;
ExerciseDate = daysadd(Settle,360*5,1);
Maturity = daysadd(ExerciseDate,360*[3;4],1);
Strike = .05;
  
Price = swaptionbylg2f(irdc,a,b,sigma,eta,rho,Strike,ExerciseDate,Maturity,'Reset',Reset)

% Copyright 2015 The MathWorks, Inc.