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

    %% Price a 10% Floor Instrument Using a Newly Created BDT Interest-Rate Tree  

% Copyright 2015 The MathWorks, Inc.


%% 
% First set the required arguments for the three needed specifications. 
Compounding = 1; 
ValuationDate = '01-01-2000'; 
StartDate = ValuationDate; 
EndDates = ['01-01-2001'; '01-01-2002'; '01-01-2003'; 
'01-01-2004'; '01-01-2005']; 
Rates = [.1; .11; .12; .125; .13]; 
Volatility = [.2; .19; .18; .17; .16];  

%% 
% Create the specifications. 
RateSpec = intenvset('Compounding', Compounding,... 
'ValuationDate', ValuationDate,... 
'StartDates', StartDate,... 
'EndDates', EndDates,... 
'Rates', Rates); 
BDTTimeSpec = bdttimespec(ValuationDate, EndDates, Compounding); 
BDTVolSpec = bdtvolspec(ValuationDate, EndDates, Volatility);   

%% 
% Create the BDT tree from the specifications. 
BDTTree = bdttree(BDTVolSpec, RateSpec, BDTTimeSpec)  

%% 
% Set the floor arguments. Remaining arguments will use defaults. 
FloorStrike = 0.10; 
Settlement = ValuationDate; 
Maturity = '01-01-2002'; 
FloorReset = 1;  

%% 
% Use |floorbybdt| to find the price of the floor instrument. 
Price= floorbybdt(BDTTree, FloorStrike, Settlement, Maturity,... 
FloorReset)