Fix off-by-one in the Bachelier implied-volatility denominator polynomial - #315
Open
Abhayindia wants to merge 1 commit into
Open
Abhayindia wants to merge 1 commit into
Abhayindia wants to merge 1 commit into
Conversation
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.
put_ivpanicked withindex out of bounds: the len is 9 but the index is 9because the denominator loop ran1..=B.len(). The clippy pass in c9ae943 rewrote that to.skip(1), which stopped the panic but left the two inverters summing different polynomials - and both were wrong anyway. The Choi-Kim-Kwak denominator is1 + sum_{k=1..9} b_k eta^k, soB[i]carries poweri+1, noti. It's invisible at the money (eta is small, the denominator barely matters) and gets bad fast on the wings.Round-tripping price -> iv through the model's own pricer, f=100, t=1. Before:
After:
Added a round-trip test over strikes and vols - it fails on master and passes with this change. The 25 pre-existing failures in
finite_difference_pricer/longstaff_schwartz/sabr(#272) are untouched: 62 passed / 25 failed both before and after.Closes #312.