%% Price a Swaption Using the Shifted Black Model
% 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 swaption with a negative strike using the Shifted Black model.

Settle = 'Jan-1-2016';
ExerciseDates = 'Jan-1-2017';
Maturity = 'Jan-1-2020';
Strike = -0.003; % Set -0.3 percent strike.
ShiftedBlackVolatility = 0.31;
Principal = 1000;
Reset = 1;
OptSpec = 'call';
Shift = 0.008; % Set 0.8 percent shift.

Price = swaptionbyblk(RateSpec,OptSpec,Strike,Settle,ExerciseDates, ...
Maturity,ShiftedBlackVolatility,'Basis',Basis,'Reset',Reset,...
'Principal',Principal,'Shift',Shift)

% Copyright 2012 The MathWorks, Inc.