%% Price a Swaption Using the Normal Model
% Define the zero curve, and create a RateSpec.

Settle = datenum('20-Jan-2016');
ZeroTimes = [.5 1 2 3 4 5 7 10 20 30]';
ZeroRates = [0.0052 0.0055 0.0061 0.0073 0.0094 0.0119 0.0168 0.0222 0.0293 0.0307]';
ZeroDates = datemnth(Settle,12*ZeroTimes);
RateSpec = intenvset('StartDate',Settle,'EndDates',ZeroDates,'Rates',ZeroRates)

%
% Define the swaption.

ExerciseDate = datenum('20-Jan-2021');
Maturity = datenum('20-Jan-2026');
OptSpec = 'call';
LegReset = [1 1];

%
% Compute the par swap rate.

[~,ParSwapRate] = swapbyzero(RateSpec,[NaN 0],Settle,Maturity,'LegReset',LegReset)
Strike = ParSwapRate;
BlackVol = .3;
NormalVol = BlackVol*ParSwapRate;

%
% Price with Black volatility.

Price = swaptionbyblk(RateSpec,OptSpec,Strike,Settle,ExerciseDate,Maturity,BlackVol)

%
% Price with Normal volatility.

Price_Normal = swaptionbynormal(RateSpec,OptSpec,Strike,Settle,ExerciseDate,Maturity,NormalVol)

% Copyright 2012 The MathWorks, Inc.