www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/PriceabondbyhjmBondwithanAmortizationScheduleExample.m
%% Price a Bond with an Amortization Schedule % Price a bond with an amortization schedule using the |Face| input argument % to define the schedule. % Copyright 2015 The MathWorks, Inc. %% % Define the interest-rate term structure. Rates = 0.065; ValuationDate = '1-Jan-2011'; StartDates = ValuationDate; EndDates= '1-Jan-2017'; Compounding = 1; %% % Create the |RateSpec|. RateSpec = intenvset('ValuationDate', ValuationDate,'StartDates', StartDates,... 'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding) %% % Create the bond instrument. The bond has a coupon rate of 7%, a period % of one year, and matures on 1-Jan-2017. CouponRate = 0.07; Settle ='1-Jan-2011'; Maturity = '1-Jan-2017'; Period = 1; Face = {{'1-Jan-2015' 100;'1-Jan-2016' 90;'1-Jan-2017' 80}}; %% % Build the HJM tree using the following market data: Volatility = [.2; .19; .18; .17]; CurveTerm = [ 1; 2; 3; 4]; MaTree = {'Jan-1-2012'; 'Jan-1-2013'; 'Jan-1-2014'; 'Jan-1-2015';... 'Jan-1-2016'; 'Jan-1-2017'}; HJMTimeSpec = hjmtimespec(ValuationDate, MaTree); HJMVolSpec = hjmvolspec('Proportional', Volatility, CurveTerm, 1e6); HJMT = hjmtree(HJMVolSpec,RateSpec,HJMTimeSpec); %% % Compute the price of the amortizing bond. Price = bondbyhjm(HJMT, CouponRate, Settle, Maturity, 'Period',... Period, 'Face' , Face) %% % Compare the results with price of a vanilla bond. PriceVanilla = bondbyhjm(HJMT, CouponRate, Settle, Maturity, Period)