Fix analytic bs_vanna: spurious sqrt(t) factor and sign error#245
Open
gaoflow wants to merge 1 commit into
Open
Fix analytic bs_vanna: spurious sqrt(t) factor and sign error#245gaoflow wants to merge 1 commit into
gaoflow wants to merge 1 commit into
Conversation
The Black-Scholes vanna is d(vega)/d(spot) = d(delta)/d(vol) = -exp(-q t) n(d1) d2 / v, but bs_vanna computed exp(-q t) sqrt(t) n(d1) d2 / v, i.e. scaled by -sqrt(t). The public EquityVanillaOption.vanna() inherited the error; the other analytic greeks (delta/gamma/vega/theta/rho) are unaffected. The existing regression only logged vanna into the golden file, freezing the wrong value. Add a real assertion in the unit tests that checks vanna against the closed form and the finite-difference of delta w.r.t. vol, and update the golden vanna column accordingly.
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.
bs_vannareturns the analytic Black-Scholes vanna scaled by-sqrt(t). It computesexp(-q t) * sqrt(t) * n(d1) * d2/v, but the correct vanna (∂vega/∂spot = ∂delta/∂vol, theDvegaDspotfrom #89, added in #94) is-exp(-q t) * n(d1) * d2/v. So there are two compounded errors: a spurioussqrt(t)factor and a flipped sign. The publicEquityVanillaOption.vanna()callsbs_vannadirectly and inherits both.I checked the whole analytic greek surface against a closed-form reference and finite-differences of the price: delta, gamma, vega, theta and rho all agree to ~1e-6; only vanna diverged. The base-class
EquityOption.vanna(finite-difference of delta) is fine, so the bug is confined to the analyticbs_vanna.The existing regression only logged vanna into the golden file, which froze the wrong value (e.g. the call vanna was negative for an OTM strike, where it should be positive). This PR adds a real assertion in
unit_testspinningvanna()against both the closed form and the finite-difference of delta w.r.t. vol, and updates the golden vanna column.Repro at
S=100, K=120, t=2, r=0.03, q=0.01, v=0.10: