Coupons per year calc seems wrong for large subset of bond data


#1

Hi,

We’re calculating priceToYield using BondDiscountingMethod. When testing, we noticed most of the Bloomberg data we fed into the code produced yields we expected but there was a large subset whose yields varied widely from what we expected. We were able to improve things dramatically by adding the 3rd constructor shown to BondFixedSecurityDefinition, shown at the top of this gist: https://gist.github.com/mateodelnorte/6a3063fc7fbb3f3d1d02. Below that is the code we’re using to calculate priceToYield.

We’re trying to reach 100% parity with data we see in Bloomberg. Is it possible we’re doing something wrong, which is causing the unmodified code to incorrectly base _couponsPerYear off of the first month when it shouldn’t?

Thanks,

Matt