Login  Register

Re: Fixed-rate bond pricing can yield different results compared to Excel's built-in functions

Posted by Gavin08 on Oct 30, 2011; 8:54pm
URL: http://quantlib.414.s1.nabble.com/Fixed-rate-bond-pricing-can-yield-different-results-compared-to-Excel-s-built-in-functions-tp6340p6353.html

StephenWong wrote
I have applied the present value formula as stated before on all the bonds. I changed all the bonds to mature within 5 months. The prices from the qlBondCleanPriceFromYield match the values obtained from that formula.

One can make all the prices agree between qlBonCleanPriceFromYield with the PRICE from Excel if all the settlement dates are on coupon dates. The prices differ whenever the settlement dates don't fall on a coupon date. The settlement dates indeed are on coupon dates for your first three bonds but not for the remainder.  
In conclusion, the two functions are using different formulae to get different results.
True, it's a good observation that prices only diverge whenever we are at a mid-coupon date and perfectly match at coupon dates. But which formula - QL's or Excel's - is more accurate? Or where does the difference come from? Is there a loss of precision at some point of the calculation due to rounding (hard to believe)?

Would be great if somebody knowledgeable about the internals of Quantlib could shed light on this.