www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/ComputethePriceofanAmortizingCapUsingtheBDTModelExample.m

    %% Compute the Price of an Amortizing Cap Using the BDT Model   

% Copyright 2015 The MathWorks, Inc.


%% 
% Define the |RateSpec|. 
Rates = [0.03583; 0.042147; 0.047345; 0.052707; 0.054302];
ValuationDate = '15-Nov-2011';
StartDates = ValuationDate;
EndDates = {'15-Nov-2012';'15-Nov-2013';'15-Nov-2014' ;'15-Nov-2015';'15-Nov-2016'};
Compounding = 1;
RateSpec = intenvset('ValuationDate', ValuationDate,'StartDates', StartDates,...
'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding)  

%% 
% Define the cap instrument. 
Settle ='15-Nov-2011';
Maturity = '15-Nov-2015';
Strike = 0.04;
Reset = 1;
Principal ={{'15-Nov-2012' 100;'15-Nov-2013' 70;'15-Nov-2014' 40;'15-Nov-2015' 10}};  

%% 
% Build the BDT Tree. 
BDTTimeSpec = bdttimespec(ValuationDate, EndDates);
Volatility = 0.10;  
BDTVolSpec = bdtvolspec(ValuationDate, EndDates, Volatility*ones(1,length(EndDates))');
BDTTree = bdttree(BDTVolSpec, RateSpec, BDTTimeSpec)  

%% 
% Price the amortizing cap. 
Basis = 0;
Price = capbybdt(BDTTree, Strike, Settle, Maturity, Reset, Basis, Principal)