Repository navigation
Allow negative rates and dividend yields in the finite difference pricer - #473
Open
Vaibhav1067 wants to merge 2 commits into
Open
Vaibhav1067 wants to merge 2 commits into
Vaibhav1067 wants to merge 2 commits into
Conversation
The new tests fail on master, where black_scholes_fd rejects a negative risk-free rate or dividend yield.
black_scholes_fd raised ValueError for a negative risk-free rate or dividend yield, so BlackScholesAlgorithmTypes.FINITE_DIFFERENCE could not price options in negative-rate markets. Nothing in the theta scheme depends on their sign: the PDE discounts at r with drift (r - q) S, and American options are floored at the exercise value after each step, which also covers the two exercise boundaries that negative rates can create. Remove the two checks. With the checks removed, European prices match the analytic formula to 1.3e-4, and American prices match a 2001-step Leisen-Reimer tree to within 0.012 (0.03%) over 162 cases with r and q in [-0.03, 0.03].
This branch has not been deployed
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.
Problem
black_scholes_fdraisesValueErrorfor any negative risk-free rate or dividend yield (validate_black_scholes_fd_inputs), soBlackScholesAlgorithmTypes.FINITE_DIFFERENCEcannot price European or American options in negative-rate markets (EUR, CHF and JPY rates were negative for years):This matters most for American options. The analytic approximations in
bs_american_analytic.pyreturn NaN forr < 0orq < 0(Bjerksund–Stensland notes it does not handle the negative-rate double-boundary regimes), so finite difference is the natural method to use there, but it is blocked.Change
Remove the two sign checks. Nothing in the solver depends on the sign of
rorq: the PDE discounts atrwith drift(r - q) Son a log-spaced grid centred on spot, and American options are floored at the exercise value after every step. That projection also handles the caser < 0 < q, where an American call or put can have two exercise boundaries (Battauz, De Donno and Sbuelz, 2015), without any special treatment.Validation
Over 162 cases with
Sin {70, 100, 130},Tin {0.25, 1, 3},rin {-0.03, -0.005, 0.02},qin {-0.02, 0, 0.03} andvolin {0.15, 0.4}, with the default grid:No American FD price fell below
max(European, intrinsic).Tests
Three new tests in
tests/unit/test_model_finite_difference.py, in their own first commit; all 8 cases fail on master with theValueError:r, negativeqor both, against the analytic price.r < 0 <= q, where early exercise is never optimal, against the European put. This is a model-free check.r < 0 < q(double boundary) against a 2001-step Leisen–Reimer tree, and not below the European call.Full unit suite: 1983 passed (1975 before plus the 8 new cases).
I used an AI assistant (Claude) to help find and write this change, and reviewed and validated it myself.