How justkroft/option-implied-moments works
Option Implied Moments is a Python library that estimates risk-neutral variance, skewness, and kurtosis from option data. Its principal workflow accepts a Polars DataFrame, filters and groups out-of-the-money options, packs group data for a Cython extension, and returns a DataFrame of moments. The README describes Cython as the NumPy-to-C bridge and says groups are processed in parallel with OpenMP. The Cython sources were not excerpted, so those links rely on documented behavior; internal C numerical stages are supported by the excerpted C source.
Main entry points: option_implied_moments.py Moments API · trapezoid_rnm.pyx Group dispatcher · trapezoid_core.c Black-Scholes pricing · omp_utils.pyx OpenMP controls
Components 11
Python API
- Moments API
src/option_implied_moments/option_implied_moments.py - Filter and group
src/option_implied_moments/option_implied_moments.py - CSR packing
src/option_implied_moments/option_implied_moments.py
Cython bridge
- Group dispatcher
src/option_implied_moments/ext/trapezoid_rnm.pyx - OpenMP controls
src/option_implied_moments/ext/omp_utils.pyx
C numerics
- Black-Scholes pricing
src/option_implied_moments/ext/trapezoid_core.c - Trapezoid integration
src/option_implied_moments/ext/trapezoid_core.c - Moment calculation
src/option_implied_moments/ext/trapezoid_core.c
Other components
- Library caller
- Option data
- Moments DataFrame
Connections 10
- Library caller → Moments API: calls
README.md - Option data → Moments API: provides
src/option_implied_moments/option_implied_moments.py - Moments API → Filter and group: prepares
src/option_implied_moments/option_implied_moments.py - Filter and group → CSR packing: assembles
src/option_implied_moments/option_implied_moments.py - CSR packing → Group dispatcher: calls
src/option_implied_moments/option_implied_moments.py - Group dispatcher → Black-Scholes pricing: prices options
README.md - Group dispatcher → OpenMP controls: parallelizes groups
README.md - Black-Scholes pricing → Trapezoid integration: feeds prices
src/option_implied_moments/ext/trapezoid_core.c - Trapezoid integration → Moment calculation: computes moments
src/option_implied_moments/ext/trapezoid_core.c - Moments API → Moments DataFrame: returns
src/option_implied_moments/option_implied_moments.py