Zero coupon bond yield



I’m trying to get the yield of a zero coupon bond by using the DiscountingFixedCouponBondProductPricer.yieldFromDirtyPrice method but coming up against a problem because the factorToNextCoupon method (called by dirtyPriceFromYieldStandard), divides by the fixed rate (0) - which results in NaN everywhere.

Even though there aren’t actually any coupons, should the FixedCouponBond class support zero coupon bonds?



Hi Adam,

Thanks for pointing this to us. You are right there is a problem with fixed coupon = 0. In the code we are multiplying and then dividing by the fixed rate. This is fine, except when there is a 0. The class should support bonds with coupon = 0.

We will correct the problem very soon.

Thanks again for sharing the issue.




A fix for this has just gone into the master branch (, which will be in the 1.0 release due at the end of June.


Brilliant, Thanks, will give it a go when it’s released.