Problem with bndspread function: two different outcomes
Show older comments
Hi everybody. I have the following code for calculating the Z Spread for a bond (Johnson & Johnson due on 2037). I use the BNDSPREAD function and I get two different SPREADS. Am I doing something wrong? Method 1: I use the term structure provided in bloomberg. Method 2: I construct the bond term structure. SPREAD01: -208pbs. Spread02: 54.45
%% 01. Bond Characteristics JNJ 2037
EndMonthRule = 0; Face = 100; YTM = 0.05741748; Coupon = 0.0595; Settle = datenum('10/09/2007','dd/mm/yyyy'); Compounding = 2; Maturity = datenum('15/08/2037','dd/mm/yyyy'); IssueDate = datenum('15/08/2007','dd/mm/yyyy'); FirstCouponDate = datenum('15/02/2008','dd/mm/yyyy'); LastCouponDate = datenum('15/08/2037','dd/mm/yyyy'); StartDate = IssueDate; Freq = 2; Basis = 1; PxClean = 103.881;
%% 02. Spot Curve US SWAP at 10-SEP-2007
ZeroRates = [ 0.0581, 0.0570, 0.0535, 0.0489, 0.0463, 0.0460, 0.0462 ,... 0.0468 , 0.0475 , 0.0481 , 0.0487 , 0.0493 , 0.0498 , 0.0514 ,... 0.0522 ,0.0524 ]';
ZeroTermStructure = [ 0.08 ,0.25 ,0.50 ,1.00 ,2.00 ,3.00 ,4.00 ,5.00... ,6.00 ,7.00 ,8.00 ,9.00 ,10.00 ,15.00 ,20.00 , 25.00 ]';
ZeroDates = ZeroTermStructure.*365+Settle;
%% 03. ZSpread calculation under market spot rates % letting Matlab do the bootstrapping
SpotInfo01 = [ZeroDates, ZeroRates];
Spread01 = bndspread(SpotInfo01, PxClean, Coupon,... Settle, Maturity, Freq, Basis, EndMonthRule, IssueDate,... FirstCouponDate, LastCouponDate, IssueDate, Face);
%% 04. The ZSpread calculation using Bond Term Structure
% First: Getting Cash Flow term structure
CFDatesBond = cfdates(Settle, Maturity, Freq, Basis, EndMonthRule,... IssueDate, FirstCouponDate, LastCouponDate, StartDate)';
ZeroRatesBond = spline(ZeroDates,ZeroRates,CFDatesBond);
% Second: Calculating the Z Spread again
SpotInfo02 = [CFDatesBond, ZeroRatesBond];
Spread02 = bndspread(SpotInfo02, PxClean, Coupon,... Settle, Maturity, Freq, Basis, EndMonthRule, IssueDate,... FirstCouponDate, LastCouponDate, IssueDate, Face);
Answers (0)
Categories
Find more on Functional Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!