Stochastic process pricing engine with a Streamlit dashboard.
- 6 stochastic process families (GBM, Heston, Bates, SABR, LocalVol, RBergomi).
- 12+ pricers covering analytic, lattice, finite difference, Monte Carlo, COS Fourier and MLMC.
- 4 calibrators (SABR, Heston via COS, SVI raw, Dupire local vol bootstrapper).
- Greek engines: full analytic vector, lattice, MC pathwise, MC LRM, CRN bumping.
- AOT JIT warmup, batched CRR, vectorised Black-Scholes surface, pluggable cache adapter.
- 9 tab Streamlit dashboard (pricing, surface, greeks, convergence, strategy, IV, process lab, calibration, risk).
models/ domain types, pricers, processes, calibration
utils/ plotting, IV inversion, greeks, sensitivities, synthetic quotes
services/ application service layer between dashboard and core
ui/ streamlit components and sidebar
app.py streamlit entry point
controller.py legacy shim, DeprecationWarning on import
tests/ regression and parity smoke (pytest)
pip install -e .[dev]
pyproject.toml pins python>=3.10 and gates yfinance, pytest, ruff, black, mypy behind extras.
streamlit run app.py
Set DERIVATIVES_PRICING_NO_WARMUP=1 to skip the eager numba warmup at import; call models.pricers.prewarm() manually instead.
pytest -q
The conftest exports DERIVATIVES_PRICING_NO_WARMUP=1 so the suite stays cold-start fast.
- Domain:
models.optionsships slot-frozen value objects.models.processesholds stochastic process classes that self register through@autoregister.models.pricersexposes the pricer surface, aPricerRegistrywith MRO walk, and aprewarm()opt-in. - Service:
servicesis the only layer that knows about Streamlit, but it does so through a runtime-adaptivecached()adapter so the same helpers run in plain Python, notebooks or tests with a transparentlru_cachefallback. - Greeks:
utils.greeksships analytic, MC pathwise + LRM, lattice and CRN bumping calculators.GreekCalculatorRegistrydispatches via(pricer_class, method)keys and walks the pricer MRO. - Calibration:
models.calibrationcarries SVI, SABR, Heston (COS-driven) and Dupire bootstrapper. All return aCalibrationResultdataclass.
- JIT kernels (
numba.njit) on every hot path, withcache=Trueandparallel=Truewhere applicable. - AOT warmup pass eagerly compiles every kernel at import; cached
.nbifiles keep subsequent boots fast. - Vectorised Black-Scholes surface bypasses the per-cell Python loop (40x speedup at 25x25).
cached()decorator fingerprints ndarrays throughtobytesand dicts recursively so non-streamlit callers also hit the cache.slots=Trueon every frozen dataclass for smaller per-instance footprint.
- Streamlit imports live only in
services._cache,uiandapp.py. - New processes register via
@autoregister; new Greeks register viaGreekCalculatorRegistry.register. - Sidebar option type branching dispatches through
_BUILDERSmapping.