$ show nl2992/fourier-option-pricer
foureng is a Python library for quantitative finance: Fourier and characteristic-function based option pricing. It exposes unified dispatchers (`price_strip` and `price`) over a registry of characteristic-function models (BSM, Heston, VG, Kou, Bates, CGMY, NIG, 3/2, rough Heston, etc.) and numerical engines (COS, Carr-Madan FFT, FRFT, Lewis, Hilbert, PROJ, CTMC, SINC, SWIFT, contour, plus Monte Carlo baselines). The product layer covers European vanillas, Bermudan/American, barriers, Asians, lookbacks, cliquets, faders, variance/credit instruments, and multi-asset payoffs. It is a library, not a service or CLI: usage is through the Python API and Jupyter notebooks.
The LLM identified 4 files worth highlighting for reuse:
Extracts cumulants from a characteristic function using FFT-on-circle Cauchy integration and builds COS truncation intervals and resolution-term rules. This is a self-contained numerical utility (CF -> cumulants -> grid bounds) that any Fourier-pricing project can reuse, and it demonstrates non-obvious contour-integration techniques for stable cumulant computation.
A vectorized machine-precision Black-Scholes implied volatility solver implemented directly from Jรคckel (2015). It takes price, forward, strike, and call/put flag and returns implied volatility with no dependence on the rest of foureng. Highly reusable for any options system needing fast, accurate IV inversion.
Defines spectral filter specifications and weight functions (Fejer, Lanczos, raised-cosine, exponential) used to damp Fourier/Gibbs oscillations in transform pricing. Standalone numerical utility applicable to generic Fourier inversion pipelines beyond this repository.
Encapsulates grid construction for multiple Fourier methods (COS, FFT, FRFT, Hilbert, etc.) and auto-grid policies driven by cumulants. The dataclass-based grid objects separate truncation and discretization concerns, making them reusable for any characteristic-function pricing engine and useful for systematic grid-policy comparisons.