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

The market convention in Canada is to quote a money market equivalent yield on bonds that are in their last coupon period #1430

Open
qiubill opened this issue Jul 13, 2022 · 9 comments

Comments

@qiubill
Copy link

qiubill commented Jul 13, 2022

image-20220712-192828

The market convention in Canada is to quote a money market equivalent yield on bonds that are in their last coupon period. The formula below converts between price and simple interest yield on a bond with one cash flow remaining:

P + AI = (CP + Cm) / (1 + YME * DSM / 365)

where:
P = clean price
AI = actual/365 accrued interest
CP = 100 or call price
Cm = coupon payment at maturity
YME = money market equivalent yield
DSM = days from settlement date to maturity date

So I am not sure whether QuantLib has this kind of yield calculation support for the ql.FixedRateBond class, or there is a work around on. Please advise, thanks!!!

@github-actions
Copy link
Contributor

This issue was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.

@github-actions github-actions bot added the stale label Sep 12, 2022
@lballabio lballabio removed the stale label Sep 12, 2022
@erikhansenwong
Copy link

USD corporate bonds with less than 14 months till maturity are quoted using a similar convention. We use the same formula described in section 10.10.3 of this document (see page 49) -- the only difference being that the daycount used for USD corporate MME-yield is typically Actual/360 rather than Actual/365.

It would be great if QuantLib supported this calculation natively.

@qiubill My workaround for now has been to implement the calculation explicitly in python. If you have access to Bloomberg then you can verify the correctness of your own implementation using YAS <GO> or ME <GO>.

@qiubill
Copy link
Author

qiubill commented Nov 11, 2022 via email

@github-actions
Copy link
Contributor

This issue was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.

@jakeheke75
Copy link
Contributor

Hi @qiubill or @erikhansenwong could you please post a quick code reproducing the desired behavior? Thanks!

@jakeheke75
Copy link
Contributor

Hello @lballabio, how would you implement this requirement? With a new virtual member function in class Bond that can be eventually re-implemented in derived classes? I see that almost all the calculation functions for bonds are in adapter struct BondFunctions which refers to CashFlows functions.
So the new functionality should probably be implemented there? Thanks.

@qiubill
Copy link
Author

qiubill commented Feb 20, 2023

our implementation is fairly simple, basically was divided into two scenario: one cash flow or multiple cash flow remaining.

For the one cash flow remaining, it is super important:
maturity_adj = self.quantlib_maturity_date
dsm = maturity_adj - self.quantlib_settlement_date
bond_yield = ((100.0 + 100.0 * self.get_coupon() / self.frequency) / dirty_price - 1.0) * 365.0 / dsm

But for the multiple remaining cash flow case, it will be more complicated, especially for those quarterly or monthly coupon paid scenario, you need to have root_scalar function, but I cannot give you the implementation details, because I did not have the authorization from my company, the code belongs to the company. I believe you will be able to figure it out, and I don't think QuantLIb will implement it, because it is not generic feature.

@jakeheke75
Copy link
Contributor

I don't think QuantLIb will implement it, because it is not generic feature.
Yes, if it's too specific it probably makes sense to leave the implementation out of the library.

Out of curiosity, if we want to implement a MMY formula which is general enough, could be also this one?
MMY
or also
MMY2
Disclaimer: I am not a quantitative analyst 😃

@qiubill
Copy link
Author

qiubill commented Feb 21, 2023

Canadian-Conventions-in-FI-Markets-Release-1-2-Feb-2015 (1).pdf
Please read chapter 10.10 of the canadian convention spec, there is the detailed, as I have said, if there is more than one cash flow remaining, you will need root scalar, especially for those Quarterly or Monthly coupon paid bond

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

No branches or pull requests

4 participants