test(pricing): put-call parity, CRR convergence, Greek sanity regression tests (#345)#382
Merged
Merged
Conversation
…ression tests (#345) Add `tests/unit/pricing/identities_test.rs` with four deterministic regression tests covering the fundamental pricing identities listed in `rules/global_rules.md` §Numerical Discipline: - `put_call_parity_grid`: grid of spots × strikes × IVs × tenors asserts `C - P == S - K · e^(-rT)` within `1e-4` under zero dividend. - `crr_binomial_converges_to_black_scholes`: fixed step schedule `N ∈ {50, 200, 800}` verifies that the binomial price is within 1%% of Black-Scholes at `N = 800` and strictly no worse than at `N = 50`. - `greek_sanity_gamma_vega_equal_call_put`: `Γ_call == Γ_put` and `Vega_call == Vega_put` for European options. - `greek_sanity_delta_call_minus_put_equals_unity`: `Δ_call - Δ_put ≈ e^{-qT} → 1` under zero dividend. Tolerances are explicit per assertion. Tests are fully deterministic and require no seeded RNG. Monte-Carlo std-error bound test intentionally deferred to a follow-up with the deterministic-RNG threading from #344 so it can be seeded reproducibly. Closes #345 (core identities; MC std-error follow-up tracked separately).
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.
Summary
Add `tests/unit/pricing/identities_test.rs` with four deterministic regression tests covering the fundamental pricing identities from `rules/global_rules.md` §Numerical Discipline:
All tolerances are explicit per assertion and tests are fully deterministic (no RNG).
Monte-Carlo std-error bound test deferred to a follow-up that builds on the deterministic-RNG primitive from #344, so it can be seeded reproducibly.
Closes #345 (core identities; MC std-error follow-up tracked separately).
Test plan