Use face-scaled accrued interest in bond cash values - #256
Open
kadyrbekovhamit-cyber wants to merge 4 commits into
Open
kadyrbekovhamit-cyber wants to merge 4 commits into
kadyrbekovhamit-cyber wants to merge 4 commits into
Conversation
Signed-off-by: kadyrbekovhamit-cyber <288885044+kadyrbekovhamit-cyber@users.noreply.github.com>
Signed-off-by: kadyrbekovhamit-cyber <288885044+kadyrbekovhamit-cyber@users.noreply.github.com>
Signed-off-by: kadyrbekovhamit-cyber <288885044+kadyrbekovhamit-cyber@users.noreply.github.com>
Signed-off-by: kadyrbekovhamit-cyber <288885044+kadyrbekovhamit-cyber@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Use consistently scaled accrued interest in four bond cash-value paths:
Bond.principal()BondFRN.principal()InflationBond.inflation_principal()Bond.clean_price_from_survival_curve()The three principal methods scale dirty price by
face / par, but the released implementation subtracts accrued interest calculated for face1.0. The unscaled subtraction violates the basic identityThe released
BondZero.principal()already follows this pattern by calculating accrued interest with the supplied face.BondFRN.principal()andBondFRN.clean_price_from_dm()also relied on prior calls to initialize their previous/next coupon dates. Both now calculate accrued interest before dirty price, so direct calls on a newly constructed bond work without hidden state.Separately,
Bond.clean_price_from_survival_curve()returns a price per 100 of par but subtracts accrued interest for face1.0. In the synthetic released-version reproduction it returns103.9834175889; the dirty-minus-accrued-per-100 identity is103.0152960420, a difference of0.9681215470.Released-version reproductions
Using synthetic inputs with FinancePy 1.1.2:
These are method-level synthetic reproductions only; no production system or customer data was tested.
Correction
Each principal method now recalculates accrued interest for the supplied face amount before subtraction. The survival-curve clean-price path recalculates it for
self.par. This also leaves the object's accrued-interest state consistent with the cash value being returned.Testing
BondFRN.principal().BondFRN.clean_price_from_dm()on a separate fresh object before any other method.