Architecture¶
Recruiter-facing systems view
option_pricing is organized as a layered quant library: typed public routes enter a reviewable quant core, and diagnostics stay downstream where they can inspect the same workflow that produces the proof pages.
The page walks the same stack as a workflow and safeguards story: repair, smooth handoff, local-vol extraction, PDE validation, and published proof outputs.
Recruiter-Facing System Picture¶
The architecture contract is simple: keep the public surface readable, keep the quant checkpoints explicit, and keep reviewer-facing evidence outside the engines so it can inspect the workflow rather than disappear inside it.
Public surface Typed routes stay readable and library-first.
Workflow spine Repair, handoff, local-vol, and PDE remain explicit checkpoints.
Proof edge Diagnostics stay downstream so the evidence can stay rich without polluting the engines.
Workflow And Safeguards Story¶
The technical story is the five checkpoints below: each one answers a different reviewer question before the workflow is allowed to move forward.
Why this matters
The architecture is not trying to hide complexity. It is trying to put complexity where it can be inspected. The proof workflow becomes credible because each transition exposes the next failure mode before the next layer starts relying on it.
-
Repair the raw surface first
VolSurface,calibrate_svi(...), and no-arbitrage diagnostics keep slice quality visible.- The reviewer can inspect quoted data, repaired slices, and fit stress before any time-smoothing story begins.
-
Make the smooth handoff explicit
ESSVINodalSurfacepreserves the exact calibrated nodes.project_essvi_nodes(...)andESSVISmoothedSurfacecreate the Dupire-oriented smooth surface only after explicit validation.validate_essvi_nodes(...)andvalidate_essvi_continuous(...)separate nodal validity from continuous-surface admissibility.
-
Extract local vol with failure visibility
LocalVolSurface.from_implied(...)keeps the handoff object visible.- Invalid masks, denominator checks, and curvature diagnostics preserve the reason why extraction succeeds or fails instead of collapsing it into one opaque output.
-
Validate the PDE wiring
bs_pde_wiring,local_vol_pde_wiring,GridConfig,ICRemedy, andRannacherCN1Dmake the solver choices reviewable.- The final question at this stage is not whether the stack runs, but whether it reprices, localizes error, and behaves sensibly as the grid changes.
-
Publish proof outputs and diagnostics
- Repricing grids, convergence sweeps, benchmark artifacts, and
pytest -q demos --nbmakeare all downstream of the same workflow. - That is what lets the docs, tests, and performance page tell one coherent story.
- Repricing grids, convergence sweeps, benchmark artifacts, and
Public Routes Into The Stack¶
The package exposes several entry styles, but they are not equal in purpose. The point is to keep the default public path readable without hiding the more explicit routes needed for quant workflows.
| Route | Use it when | Representative objects and functions |
|---|---|---|
| Instrument-based | You want the recommended typed public workflow | VanillaOption, bs_price_instrument, mc_price_instrument, binom_price_instrument |
| Flat-input | You want compact scripts or method comparisons | PricingInputs, bs_price, mc_price, binom_price |
| Curves-first | You want discounting and forwards to stay explicit | PricingContext, DiscountCurve, ForwardCurve |
| Volatility namespace | You are working on surfaces, eSSVI, local vol, or the proof path | VolSurface, ESSVINodalSurface, ESSVISmoothedSurface, LocalVolSurface |
Confidence Model¶
Confidence comes from layered safeguards rather than one final integration test. Each stage has its own failure mode, its own guardrails, and its own published evidence.
| Stage | Main guardrails | Evidence surfaced to the reviewer |
|---|---|---|
| Surface construction and repair | Strike ordering, forward positivity, no-arbitrage proxies, fit diagnostics | Quoted-versus-repaired plots, slice stress, no-arb summaries |
| Smooth eSSVI handoff | Constraint checks, seam inspection, nodal vs continuous validation | Seam-jump table, projection diagnostics, invalid-count summary |
| Local-vol extraction | Invalid masks, reason codes, denominator and curvature checks | Gatheral and Dupire reports, heatmaps, difference views |
| PDE solve | Domain bounds, boundary handling, remedy choice, convergence sweeps | Repricing grids, convergence plots, digital-remedy benchmarks |
| Proof outputs and CI loop | Notebook execution plus committed benchmark artifacts | Proof pages, benchmark page, CI-executed demos |
Extension And Maintenance¶
Extension points
- Add new pricers under
pricers/without rewriting the surface or diagnostics layers. - Add new volatility models under
vol/without changing the public entry patterns. - Add new PDE methods by extending the numerical factory layer instead of hard-coding them into one workflow.
- Add new diagnostics downstream of the pricing stack so evidence stays rich without creating reverse dependencies.
Maintenance notes
- The generic SVI-derived local-vol path remains demo-grade for Dupire because its time-direction behavior is only piecewise smooth.
- Diagnostics depend on optional plotting and comparison tooling in places, so some cross-checks remain conditional.
- The docs should continue steering Dupire-oriented readers toward the smooth eSSVI handoff rather than implying all surface paths are equally defensible.