Bond valuation using bndprice

4 views (last 30 days)
Karl
Karl on 28 May 2013
Hi guys! I'm writing a program in which I need to determine the price of a number of bonds and bills. However, for some reason I get different prices when I try to calculate it "manually" and when I use the bndprice function. The reason is probably obvious, but I can't really see it. Any help would be much appreciated! An example:
%Create a simple T-bill example
settlement='2010-01-01';
maturity='2012-12-31';
yield=0.05;
coupon=0;
period=0;
face=100;
%Convert dates to serial numbers
settlement=datenum(settlement,'yyyy-mm-dd');
maturity=datenum(maturity, 'yyyy-mm-dd');
%bndprice uses semi annually compounded yields
yieldSemiAnnual=2*((1+yield)^(1/2)-1);
%Manual calculation. Use daysdif to calculate the number of days between %settlement and maturity.
priceI=face/(1+yield*(daysdif(settlement,maturity,2)/360));
%Using bndprice
[a,b]=bndprice(yieldSemiAnnual,coupon,settlement,maturity,period,2);
priceII=a+b;
PriceI equals 86.799 and PriceII equals 86.395. What am I doing wrong?

Answers (0)

Categories

Find more on Financial Data Analytics 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!