-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yield calculates incorrectly on bonds with short/long last coupon #2592
Comments
Same problem with this Bond Buy example The yieldFromDirtyPrice method computes : 7.8034173382765015 % I changed the last period from 1 to 2*0.208333 and the yield is now 8.46 % which is closer to 8.5 % |
Unfortunately, my PR breaks existing result. For example if one uses ACT_ACT_ISDA. |
Discussion about this problem in the forum : https://forums.opengamma.com/t/yield-calculates-incorrectly-on-bonds-with-short-long-last-coupon/1248 |
The new PR doesn't break results if one uses ACT_ACT_ISDA. |
PR #2694 |
Here is an example bond.
Cusip: 52107QAG0
ISIN: US52107QAG01
Dated Date: 02/13/2015
First Coupon Date: 09/01/2015
Maturity Date: 02/13/2015
Coupon: 3.75
Coupon Frequency: Semi-Annual
Day Count Convention: 30/360
This bond has long first coupon (02/13/2015 to 09/01/2015) and short last coupon (09/01/2024 to 02/13/2025)
In DiscountingFixedCouponBondProductPricer, inside method dirtyPriceFromYieldStandard, the last coupon and principal are discounted back to the first coupon date. It uses variable called pvAtFirstCoupon.
The problem appears to be with Math.pow(factorOnPeriod, (double)pow), where pow is assumed to be an integer. When a bond has short/long last coupon, that last period will not be 1. For a short last coupon, the last period is less than one. For a long last coupon, the last period is greater than one.
This incorrect discounting of the last coupon and principal results in the yield calculation being incorrect for bonds with short/long last coupon.›
The text was updated successfully, but these errors were encountered: