Skip to content

Refactor/merge bond into clbond - #4

Merged
oliverm91 merged 5 commits into
mainfrom
refactor/merge-bond-into-clbond
Jun 24, 2026
Merged

Refactor/merge bond into clbond#4
oliverm91 merged 5 commits into
mainfrom
refactor/merge-bond-into-clbond

Conversation

@oliverm91

Copy link
Copy Markdown
Owner

Fix

  • fixedIncome: scale tera_value by notional in get_irr_from_amount

Refactor

  • fixedIncome: merge Bond into CLBond with explicit constructor

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.
@oliverm91
oliverm91 merged commit 98b518a into main Jun 24, 2026
9 checks passed
@oliverm91
oliverm91 deleted the refactor/merge-bond-into-clbond branch June 24, 2026 23:27
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.

1 participant