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

Make BondFunctions BPV and YVBP consistent #1900

Conversation

jez6
Copy link
Contributor

@jez6 jez6 commented Jan 30, 2024

Most BondFunctions methods are overloaded, with one version converting its arguments and chaining to a different overload where defaults are handled and then a call made to static CashFlows methods to do the actual calculations -- e.g. BondFunctions::duration() and BondFunctions::duration() (v1.33).

basisPointValue() and yieldValueBasisPoint() have similarly paired overloads, however do not follow the same trampolining pattern: both methods instead directly call upstream CashFlows methods.
This results in the settlement date not being set correctly -- unless explicitly passed in -- in the overloads not taking an InterestRate object when passed to the underlying calculations (settlement is defaulted in these methods’ declarations).

Make these two methods' behavior consistent with other BondFunctions methods and add tests to assert parity.

- Make BondFunctions::basisPointValue() and yieldValueBasisPoint()
  overloads taking DayCounter, Compounding, and Frequency call
  the overloads taking an InterestRate to correct settlement date-
  handling as well as to be consistent with similarly-paired
  methods
Copy link

boring-cyborg bot commented Jan 30, 2024

Thanks for opening this pull request! It might take a while before we look at it, so don't worry if there seems to be no feedback. We'll get to it.

@CLAassistant
Copy link

CLAassistant commented Jan 30, 2024

CLA assistant check
All committers have signed the CLA.

@lballabio
Copy link
Owner

Thanks! May you check the CLAassistant comment above?

@coveralls
Copy link

Coverage Status

coverage: 72.382% (+0.05%) from 72.328%
when pulling a80fbc0 on jez6:2-make-basispointvalue-and-yieldvaluebasispoint-behavior-consistent-with-other-bondfunctions-methods
into a72b76b on lballabio:master.

@jez6
Copy link
Contributor Author

jez6 commented Jan 30, 2024

Thanks! May you check the CLAassistant comment above?

Done!

@lballabio lballabio added this to the Release 1.34 milestone Jan 30, 2024
@lballabio lballabio merged commit c6e9323 into lballabio:master Jan 30, 2024
48 checks passed
Copy link

boring-cyborg bot commented Jan 30, 2024

Congratulations on your first merged pull request!

@jez6 jez6 deleted the 2-make-basispointvalue-and-yieldvaluebasispoint-behavior-consistent-with-other-bondfunctions-methods branch February 21, 2024 13:54
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

Successfully merging this pull request may close these issues.

4 participants