I'm getting the different bond clean price from Bloomberg and from QL but surprisingly Bloomberg price matches with excel price() function
I have the following bond : GETC21117030. The parameters are given below:
Parameter Name | Value |
---|---|
Settlment Date | 30-12-20 |
Bond Issue Date | 17-Jan-19 |
Interest Acrual date | 17-Jan-19 |
Maturity Date | 17-Jan-21 |
Last Coupon Date | 17-Jul-20 |
Coupon Rate | 7.25% |
Coupon Frequency | 2 |
Day Count | ACT/ACT |
Redemption | 100 |
Yield | 7.95% |
Calendar | NullCalendar |
Convention | Unadjusted |
TermPayConv | Unadjusted |
GenRule | Backward |
if you look at the parameters you'll notice that there is only one payment left on maturity date. If I calculate price and accrued interest in QLXL I'm getting different results from Bloomberg. But surprisingly Bloomberg numbers match if I use excel native price calculation function.
I looked into the excel formula and it looks that the price calculate formula is different when there is only one payment left (see below)
When N > 1 (N is the number of coupons payable between the settlement date and redemption date), PRICE is calculated as follows:
When N = 1 (N is the number of coupons payable between the settlement date and redemption date), PRICE is calculated as follows:
DSR = number of days from settlement to next coupon date.
E = number of days in coupon period in which the settlement date falls.
A = number of days from beginning of coupon period to settlement date.
It seems that for the last payment calculation excel is moving from compounded yield to simple yield.
I calculated the clean price both with compounded yield and with simple yield. While the clean price with simple yield is close to the Bloomberg/Excel price it still does not match.
With 7.95% yield and settlement date 30 Dec 2020:
Bloomberg/Excel clean price is 99.953226, Accrued Amount 3.270380
QLXL(semiannually compounded yield) clean price is 99.95983172, Accrued Amount 3.288251366
QLXL(simple yield) clean price is 99.95278714, Accrued Amount 3.288251366
I'm not C++ specialist but the QL code I've checked does not change the price calculation algorithm when only one payment is left.
The question is: Is it possible with current implementation of QuantLib to match the price and accrued amount for the above mentioned bond (and in general with all coupon bonds when there is only one cashflow is left)?