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

    %% Price a Sinking Fund Bond Using an HJM Interest-Rate Tree Model  

% Copyright 2015 The MathWorks, Inc.


%% 
% A corporation issues a three year bond with a sinking fund obligation
% requiring the company to sink 1/3 of face value after the first year and
% 1/3 after the second year. The company has the option to buy the bonds
% in the market or call them at $99. The following data describes the details
% needed for pricing the sinking fund bond: 
Rates = [0.035; 0.042147; 0.047345; 0.052707];
ValuationDate = 'Jan-1-2011';
StartDates = ValuationDate;
EndDates = {'Jan-1-2012'; 'Jan-1-2013'; 'Jan-1-2014'; 'Jan-1-2015'};
Compounding = 1;  

%% 
% Create the |RateSpec|. 
RateSpec = intenvset('ValuationDate', ValuationDate, 'StartDates',...
StartDates, 'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding)  

%% 
% Build the |HJM| tree. 
Sigma = 0.1;
HJMTimeSpec = hjmtimespec(ValuationDate, EndDates, Compounding);
HJMVolSpec = hjmvolspec('Constant', Sigma);
HJMT = hjmtree(HJMVolSpec, RateSpec, HJMTimeSpec)  

%% 
% Define the sinking fund instrument. The bond has a coupon rate of 4.5%,
% a period of one year and matures in 1-Jan-2013. Face decreases 1/3 after
% the first year. 
CouponRate = 0.045;
Settle = 'Jan-1-2011';
Maturity =  'Jan-1-2013';
Period = 1;
Face = { {'Jan-1-2012'  100; ...
          'Jan-1-2013'   66.6666}};   

%% 
% Define the option provision. 
OptSpec = 'call';
Strike = 99;
ExerciseDates = 'Jan-1-2012';  

%% 
% Price of non-sinking fund bond. 
PNSF = bondbyhjm(HJMT, CouponRate, Settle, Maturity, Period)  

%% 
% Price of the bond with the option sinking provision. 
PriceSF = optembndbyhjm(HJMT, CouponRate, Settle, Maturity,...
OptSpec, Strike, ExerciseDates, 'Period', Period, 'Face', Face)