%% Price Swaptions Using the Shifted Black Model with a Vector of Shifts
% Create the RateSpec.

ValuationDate = 'Jan-1-2016';
EndDates = {'Jan-1-2017';'Jan-1-2018';'Jan-1-2019';'Jan-1-2020';'Jan-1-2021'};
Rates = [-0.02; 0.024 ; 0.047; 0.090; 0.12;]/100;
Compounding = 1;
Basis = 1;

RateSpec = intenvset('ValuationDate',ValuationDate,'StartDates',ValuationDate, ...
'EndDates',EndDates,'Rates',Rates,'Compounding',Compounding,'Basis',Basis)

%
% Price the swaptions with using the Shifted Black model.

Settle = 'Jan-1-2016';
ExerciseDates = 'Jan-1-2017';
Maturities = {'Jan-1-2018';'Jan-1-2019';'Jan-1-2020'};
Strikes = [-0.0034;-0.0032;-0.003];
ShiftedBlackVolatilities = [0.33;0.32;0.31]; % A vector of volatilities.
Principal = 1000;
Reset = 1;
OptSpec = 'call';
Shifts = [0.0085;0.0082;0.008]; % A vector of shifts.

Prices = swaptionbyblk(RateSpec,OptSpec,Strikes,Settle,ExerciseDates, ...
Maturities,ShiftedBlackVolatilities,'Basis',Basis,'Reset',Reset, ...
'Principal',Principal,'Shift',Shifts)

% Copyright 2012 The MathWorks, Inc.