Skip to content

Update Hull/White's r0 when the underlying term structure is relinked#2592

Merged
lballabio merged 2 commits into
lballabio:masterfrom
jewonj0620:hw_fix_bug
May 22, 2026
Merged

Update Hull/White's r0 when the underlying term structure is relinked#2592
lballabio merged 2 commits into
lballabio:masterfrom
jewonj0620:hw_fix_bug

Conversation

@jewonj0620
Copy link
Copy Markdown
Contributor

@jewonj0620 jewonj0620 commented May 19, 2026

This fixes the documented HullWhite issue where the inherited Vasicek::r0_ value was not updated after the underlying term-structure handle was relinked.

HullWhite observes the term-structure handle and rebuilds its fitting parameter in generateArguments(), but r0_ was only initialized in the constructor. As a result, after relinking the handle to a new curve, model.r0() could still return the initial curve's short rate.

This change updates r0_ in HullWhite::generateArguments() from the current term structure's instantaneous forward rate, keeping it consistent with the relinked curve.

A regression test was added to check that HullWhite::r0() changes after relinking a RelinkableHandle<YieldTermStructure>.

Add a test for this :
run_test=QuantLibTests/ShortRateModelTests/testHullWhiteUpdatesR0WhenTermStructureRelinks

@coveralls
Copy link
Copy Markdown

coveralls commented May 19, 2026

Coverage Status

coverage: 74.638%. remained the same — jewonj0620:hw_fix_bug into lballabio:master

}

void HullWhite::generateArguments() {
r0_ = termStructure()->forwardRate(0.0, 0.0, Continuous, NoFrequency);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably simpler and faster as zeroRate(0.0, Continuous, NoFrequency);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I applied a comment!

@lballabio lballabio merged commit af13604 into lballabio:master May 22, 2026
45 checks passed
@lballabio lballabio changed the title Update HullWhite r0 when termstructure relinks Update Hull/White's r0 when the underlying term structure is relinked May 22, 2026
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.

3 participants