www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/PriceSingleSteppedCallableBondHWInterestRateTreeExample.m
%% Price Single Stepped Callable Bonds Using an HW Interest-Rate Tree Model % Copyright 2015 The MathWorks, Inc. %% % Price the following single stepped callable bonds using the following data: % The data for the interest rate term structure is as follows: Rates = [0.035; 0.042147; 0.047345; 0.052707]; ValuationDate = 'Jan-1-2010'; StartDates = ValuationDate; EndDates = {'Jan-1-2011'; 'Jan-1-2012'; 'Jan-1-2013'; 'Jan-1-2014'}; Compounding = 1; % Create RateSpec RS = intenvset('ValuationDate', ValuationDate, 'StartDates', StartDates,... 'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding); % Instrument Settle = '01-Jan-2010'; Maturity = {'01-Jan-2013';'01-Jan-2014'}; CouponRate = {{'01-Jan-2012' .0425;'01-Jan-2014' .0750}}; OptSpec='call'; Strike=100; ExerciseDates='01-Jan-2012'; %Callable in two years % Build the tree with the following data VolDates = ['1-Jan-2011'; '1-Jan-2012'; '1-Jan-2013'; '1-Jan-2014']; VolCurve = 0.01; AlphaDates = '01-01-2014'; AlphaCurve = 0.1; HWVolSpec = hwvolspec(RS.ValuationDate, VolDates, VolCurve,... AlphaDates, AlphaCurve); HWTimeSpec = hwtimespec(RS.ValuationDate, VolDates, Compounding); HWT = hwtree(HWVolSpec, RS, HWTimeSpec); % The first row corresponds to the price of the callable bond with maturity % of three years. The second row corresponds to the price of the callable % bond with maturity of four years. PHW= optembndbyhw(HWT, CouponRate, Settle, Maturity,OptSpec, Strike,... ExerciseDates, 'Period', 1)