Skip to content
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

Open
ShaunParkYieldX opened this issue Jul 19, 2023 · 5 comments
Open

Comments

@ShaunParkYieldX
Copy link

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

@ritonglue
Copy link

ritonglue commented Jun 20, 2024

Same problem with this Bond
ISIN : XS2352739184
Dated Date : 2021-06-30
First coupon date : 2021-10-15
Maturity Date : 2026-06-30
Coupon : 0,0425 EUR
Nominal : 1,00 EUR
Coupon Frequency Semi-Annual
Day Count Convention: 30/360
Stub : Smart final

Buy example
Quantity : 1 000 000
SettlementDate : 2023-06-06
Clean Price : 100.09 %
Results from DiscountingFixedCouponBondProductPricer.DEFAULT are :
Accrued : EUR 12041.67 (correct)

The yieldFromDirtyPrice method computes : 7.8034173382765015 %
This is far to below from 8.5 % with a such clean price.

I changed the last period from 1 to 2*0.208333 and the yield is now 8.46 % which is closer to 8.5 %

@ritonglue
Copy link

Unfortunately, my PR breaks existing result. For example if one uses ACT_ACT_ISDA.

@ritonglue
Copy link

@ritonglue
Copy link

The new PR doesn't break results if one uses ACT_ACT_ISDA.

@jodastephen
Copy link
Member

PR #2694

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants