Skip to content

Allow defining globalGuess() in bootstrap traits#2553

Draft
eltoder wants to merge 1 commit into
lballabio:masterfrom
eltoder:feature/global-guess
Draft

Allow defining globalGuess() in bootstrap traits#2553
eltoder wants to merge 1 commit into
lballabio:masterfrom
eltoder:feature/global-guess

Conversation

@eltoder

@eltoder eltoder commented Apr 21, 2026

Copy link
Copy Markdown
Contributor

Currently, GlobalBootstrap uses the regular Traits::guess() method. This method was designed for IterativeBootstrap and usually uses previous points to make the guess for the next point. In some traits (ZeroYield, ForwardRate, SimpleZeroYield) it also uses methods that rely on curve's interpolation (zeroRate(), forwardRate()). However, GlobalBootstrap does NOT update interpolation while computing initial guess, so the result is not well defined. We could update interpolation before calling guess() but:

  1. This would add significant overhead.

  2. Since GlobalBootstrap doesn't run optimizations until it got initial guesses for all points, the guesses are basically a constant, so this seems excessive.

Instead, add a new method, globalGuess(), which does not use previous points or rely on interpolation. For traits that don't define it, keep using the old logic.

Also, make Traits::transformDirect()/transformInverse() methods optional so we don't have to define them for traits that don't need them.

@coveralls

coveralls commented Apr 21, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 74.444% (-0.001%) from 74.445% — eltoder:feature/global-guess into lballabio:master

@eltoder

eltoder commented Apr 21, 2026

Copy link
Copy Markdown
Contributor Author

@lballabio it looks like AppVeyor has some issues with VC++ version.

Currently, GlobalBootstrap uses the regular Traits::guess() method. This
method was designed for IterativeBootstrap and usually uses previous
points to make the guess for the next point. In some traits (ZeroYield,
ForwardRate, SimpleZeroYield) it also uses methods that rely on curve's
interpolation (zeroRate(), forwardRate()). However, GlobalBootstrap does
NOT update interpolation while computing initial guess, so the result is
not well defined. We could update interpolation before calling guess()
but:

1. This would add significant overhead.

2. Since GlobalBootstrap doesn't run optimizations until it got initial
   guesses for all points, the guesses are basically a constant, so this
   seems excessive.

Instead, add a new method, globalGuess(), which does not use previous
points or rely on interpolation. For traits that don't define it, keep
using the old logic.

Also, make Traits::transformDirect()/transformInverse() methods optional
so we don't have to define them for traits that don't need them.
@eltoder eltoder force-pushed the feature/global-guess branch from 8864079 to d17986c Compare April 21, 2026 14:39
@lballabio

Copy link
Copy Markdown
Owner

Tiny risk of breaking if someone inherited from the traits and called the parent transformX, I guess? Not sure it's worth going through a deprecation cycle though. Also it wouldn't check that everything work when they're missing.

@eltoder eltoder marked this pull request as draft April 27, 2026 19:28
@eltoder

eltoder commented Apr 27, 2026

Copy link
Copy Markdown
Contributor Author

@lballabio That's a fair point. I can put them back with a deprecation attribute if you prefer. However, I agree with you that it's quite unlikely that anyone is using them. Especially since the ones I'm deleting are all no-ops, they simply return their argument back, so there's little point in calling them.

Also, I apologize, I need to rework this change a bit, so I've put this PR in draft for now. I'll mark it as ready when I'm done.

@lballabio

Copy link
Copy Markdown
Owner

Ok, thanks.

@lballabio

Copy link
Copy Markdown
Owner

As for the methods, I'd remove them and not bother with deprecation.

@github-actions

Copy link
Copy Markdown
Contributor

This PR was automatically marked as stale because it has been open 60 days with no activity. Remove stale label or comment, or this will be closed in two weeks.

@github-actions github-actions Bot added the stale label Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants