Skip to content

test(pricing): put-call parity, CRR convergence, Greek sanity regression tests (#345)#382

Merged
joaquinbejar merged 1 commit into
mainfrom
issue-345-regression-tests
Apr 19, 2026
Merged

test(pricing): put-call parity, CRR convergence, Greek sanity regression tests (#345)#382
joaquinbejar merged 1 commit into
mainfrom
issue-345-regression-tests

Conversation

@joaquinbejar
Copy link
Copy Markdown
Owner

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:

  • `put_call_parity_grid`: grid spots × strikes × IVs × tenors asserting `C - P == S - K · e^(-rT)` within `1e-4` under zero dividend.
  • `crr_binomial_converges_to_black_scholes`: step schedule `N ∈ {50, 200, 800}`; binomial within 1% of BS at `N = 800` and strictly better 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` with zero dividend.

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

  • `cargo test --test tests --all-features pricing::identities_test` — 4 passed; 0 failed.
  • `cargo clippy --all-targets --all-features -- -D warnings` clean.
  • `cargo fmt --all --check`.

…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).
@joaquinbejar joaquinbejar merged commit d57ed6c into main Apr 19, 2026
10 of 11 checks passed
@joaquinbejar joaquinbejar deleted the issue-345-regression-tests branch April 19, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add put-call parity, CRR convergence, and Greek sanity regression tests

1 participant