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?
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.