Refactor/merge bond into clbond - #4
Merged
Merged
Conversation
Bond and CLBond are merged into a single CLBond class since the module only ever targets the Chilean market (base-100 flows, TERA). CLBond's constructor now takes explicit typed parameters with validation instead of **kwargs, removing the double __init__ chain that existed only because of the Bond/CLBond inheritance. Also fixes a silent business-rule check: Coupons.adjust_to_notional used an assert (disabled under python -O) for its residual-sum sanity check; it now raises ValueError unconditionally.
initial_guess mixed scales: tera_value was base-100 while dv01 and the target amount were already scaled by notional. This worked only by coincidence when notional == 100; for any real notional the Newton solve's initial_guess landed far off target and diverged to nan.
Cross-checks TERA, price, par value and amount for BTP0470930 (CLP nominal) and BTU0190930 (UF-indexed) against a market valuation tool snapshot dated 2026-06-24, confirming the Bond->CLBond merge didn't change pricing behavior.
Configure commitizen to read versions from git tags via scm (matching the existing hatch-vcs setup) and generate CHANGELOG.md from conventional commits.
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.
Fix
Refactor