feat(quantlib): add finite-difference sensitivity Greeks for barrier options - #1203
feat(quantlib): add finite-difference sensitivity Greeks for barrier options#1203santhreal wants to merge 1 commit into
Conversation
31f0539 to
c1625a7
Compare
…options Compute Delta, Gamma, Theta, Vega, and Rho for single-barrier options via central finite differences. Signed-off-by: santhreal <64453045+santhreal@users.noreply.github.com>
c1625a7 to
8b63c4b
Compare
he-yufeng
left a comment
There was a problem hiding this comment.
This one is a real implementation and the finite differences are correct where the price is smooth. The hard case for barrier Greeks is near the barrier, and that is where this breaks: with dS = 1e-4 * S, any spot within that distance of H puts one stencil leg across the barrier, where the knock-out value collapses to the rebate, so delta and gamma come out wrong exactly where barrier Greeks matter most. The test only covers the far-from-barrier case, which is the easy one.
Could you add either a one-sided stencil when the stencil would cross H, or at minimum a documented limitation plus a near-barrier test pinning the current behavior? Happy to approve once the hard case is handled or honestly bounded.
Summary
Implements central finite-difference calculation of sensitivity Greeks (Delta, Gamma, Theta, Vega, Rho) for single-barrier options.
Changes
barrier_greeksinagent/src/quantlib/options.pysupporting all 8 standard barrier option configurations with Greek scaling consistent withbs_greeks.agent/tests/quantlib/test_options.py.Signed-off-by: santhreal 64453045+santhreal@users.noreply.github.com