www.gusucode.com > fininst 案例源码程序 matlab代码 > fininst/PriceaSinkingFundBondUsinganHWnterestRateTreeModelExample.m
%% Price a Sinking Fund Bond Using an HW Interest-Rate Tree Model % Copyright 2015 The MathWorks, Inc. %% % A corporation issues a two year bond with a sinking fund obligation requiring % the company to sink 1/3 of face value after the first 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.1;0.1;0.1;0.1]; ValuationDate = 'Jan-1-2011'; StartDates = ValuationDate; EndDates = {'Jan-1-2012'; 'Jan-1-2013'; 'Jan-1-2014'; 'Jan-1-2015'}; Compounding = 1; % Create RateSpec RateSpec = intenvset('ValuationDate', ValuationDate, 'StartDates',... StartDates, 'EndDates', EndDates,'Rates', Rates, 'Compounding', Compounding); % Build the HW tree % The data to build the tree is as follows: VolDates = ['1-Jan-2012'; '1-Jan-2013'; '1-Jan-2014';'1-Jan-2015']; VolCurve = 0.01; AlphaDates = '01-01-2015'; AlphaCurve = 0.1; HWVolSpec = hwvolspec(RateSpec.ValuationDate, VolDates, VolCurve,... AlphaDates, AlphaCurve); HWTimeSpec = hwtimespec(RateSpec.ValuationDate, VolDates, Compounding); HWT = hwtree(HWVolSpec, RateSpec, HWTimeSpec); % Instrument % The bond has a coupon rate of 9%, a period of one year and matures in % 1-Jan-2013. Face decreases 1/3 after the first year. CouponRate = 0.09; Settle = 'Jan-1-2011'; Maturity = 'Jan-1-2013'; Period = 1; Face = { ... {'Jan-1-2012' 100; ... 'Jan-1-2013' 66.6666}; ... }; % Option provision OptSpec = 'call'; Strike = 99; ExerciseDates = 'Jan-1-2012'; % Price of non-sinking fund bond. PNSF = bondbyhw(HWT, CouponRate, Settle, Maturity, Period) %% % Price of the bond with the option sinking provision. PriceSF = optembndbyhw(HWT, CouponRate, Settle, Maturity,... OptSpec, Strike, ExerciseDates, 'Period', Period, 'Face', Face)