%% Price a Cap Using the Shifted Black Model
% Create the RateSpec.

ValuationDate = 'Mar-01-2016';
EndDates = {'Mar-01-2017';'Mar-01-2018';'Mar-01-2019';'Mar-01-2020';'Mar-01-2021'};
Rates = [-0.21; -0.12; 0.01; 0.10; 0.20]/100;
Compounding = 1;
Basis = 1;

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

%
% Price the cap with a negative strike using the Shifted Black model.

Settle = 'Jun-01-2016'; % Cap starts in 3 months.
Maturity = 'Sep-01-2016';
ShiftedBlackVolatility = 0.31;
CapRate = -0.003;  % -0.3 percent strike.
CapReset = 4;
Principal = 100000;
Shift = 0.01; % 1 percent shift.

CapPrice = capbyblk(RateSpec,CapRate,Settle,Maturity,ShiftedBlackVolatility,...
'Reset',CapReset,'ValuationDate',ValuationDate,'Principal',Principal,...
'Basis',Basis,'Shift',Shift)

% Copyright 2012 The MathWorks, Inc.