Option Implied Moments
This repository contains code to compute option implied, or risk-neutral, higher moments from stock option data. Stock return characteristics like volatility, skewness, and kurtosis are computed based on out-of-the-money stock option contracts under risk-neutral measure $\mathbb{Q}$.
Risk-neutral volatility, skewness, and kurtosis are estimated from a cross-section of out-of-the-money calls and puts following [1]:
$$ Var^{\mathbb{Q}} = \frac{e^{r\tau}V_{i,t} - \mu^{2}}{\tau}, $$ $$ Skew^{\mathbb{Q}} = \frac{e^{r\tau}W - 3\mu e^{r\tau}V + 2\mu^{3}}{[e^{r\tau}V-\mu^{2}]^{3/2}}, $$ $$ Kurt^{\mathbb{Q}} = \frac{e^{r\tau}X - 4\mu e^{r\tau}W + 6e^{r\tau}\mu^{2}V - 3\mu^{4}}{[e^{r\tau}V-\mu^{2}]^{2}} - 3 $$
where
$$ \mu = e^{r\tau} - 1 - \frac{e^{r\tau}}{2}V - \frac{e^{r\tau}}{6}W - \frac{e^{r\tau}}{24}X $$
$V$, $W$, and $X$ are the expected squared, cubed and fourth-power log of the stock return during the period from $t$ to time $t + \tau$ under measure $\mathbb{Q}$; $r$ is the continuously compounded risk-free rate for the same period. To estimate these parameters, we follow the trapezoidal implementation from [2] to use discrete strike prices from calls and put options. Please refer to Appendix B of the paper for the formalised implementation details.
Programming Implementation Details
The library is implemented in three layers.
Note: This library works best with implied volatility surface data from data providers like WRDS.
C layer
All numerical work is done in pure C:
- Normal CDF — approximated using complementary error function:
$$ \Phi(x) = 0.5 \times \text{erfc}(\frac{-x}{\sqrt(2)}) $$
- Black-Scholes pricing — OTM option prices are computed from implied volatilities using the standard closed-form formula.
- Trapezoidal integration — calls and puts are sorted by strike, priced, and integrated separately using the trapezoidal rule following [2].
Cython layer
The Cython layer functions as a bridge between NumPy and the C extension. It accepts flat contiguous
NumPy arrays in a CSR (compressed sparse row) layout.
Strikes, implied volatilities, and flags concatenated across all groups,
with an indptr array marking the boundary of each group.
Groups are then processed in parallel using OpenMP.
Python layer
The Python layer is responsible for data preparation only. It filters OTM options, encodes call/put flags as integers, sorts and groups the data by stock and time period, and assembles the CSR layout that the Cython layer expects. After the Cython call returns, it reconstructs the output as a Polars DataFrame.
References
[1] Bakshi, G., Kapadia, N., & Madan, D. (2003). Stock return characteristics, skew laws, and the differential pricing of individual equity options. The Review of Financial Studies, 16(1), 101-143.
[2] Bali, Turan G. and Hu, Jianfeng and Murray, Scott, Option Implied Volatility, Skewness, and Kurtosis and the Cross-Section of Expected Stock Returns (January 1, 2019). Georgetown McDonough School of Business Research Paper, Available at SSRN: https://ssrn.com/abstract=2322945 or http://dx.doi.org/10.2139/ssrn.2322945
Getting Started
Installation
pip install option-implied-moments
Wheels are available for Python 3.11–3.13 on Linux, macOS, and Windows. No C compiler or CMake required.
Development Installation
For contributing or modifying the C/Cython extensions, you need CMake and a C compiler. On macOS, also install Homebrew's LLVM for OpenMP support:
brew install llvm libomp
Clone the repository and build:
git clone https://github.com/justkroft/option-implied-moments.git
cd option-implied-moments
make install
make build
Without make, set up your uv environment and make a local install:
uv pip install scikit-build-core numpy
uv pip install --no-build-isolation -e . -Ccmake.build-type=Release
OpenMP Threading
The library uses OpenMP for parallel computation across groups. You can control the number of threads:
from option_implied_moments.ext.omp_utils import get_max_threads, set_num_threads
max_threads = get_max_threads()
print(f"Available threads: {max_threads}")
set_num_threads(8) # Use 8 threads
Please take a look at the example notebook for an example of how to use the library.
License
Metadata
Release files for option-implied-moments 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| option_implied_moments-1.0.0.tar.gz | 180.8 kB | Details |
Built distributions (wheels)
Total release size: 4.6 MB
Release files / option_implied_moments-1.0.0.tar.gz
| Download URL | option_implied_moments-1.0.0.tar.gz |
|---|---|
| Size | 180.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
84a6d70d82b4794e5433049ce727013af80d42029faee886205965208c0404e6
|
|
BLAKE2b-256 checksum How to use checksums |
43ec4ae0395aad55f68b055c9b524b5187871dcc84cd0402be3c831a8630e9ff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp313-cp313-win_amd64.whl
| Download URL | option_implied_moments-1.0.0-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 213.6 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9d17ca3703deb14f97d812499f44c40c27961740e8f14f47babf0b3cf74fa7e9
|
|
BLAKE2b-256 checksum How to use checksums |
d574454758d7187f7ae0b0a127e84267cc39ca65eb7aa4582726afb65dc8081f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp313-cp313-win32.whl
| Download URL | option_implied_moments-1.0.0-cp313-cp313-win32.whl |
|---|---|
| Size | 198.0 kB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
52cd38cbf8474be7233addb4b70a134faaaef04dc206b18a660ed0d8dc19cf6d
|
|
BLAKE2b-256 checksum How to use checksums |
d8e9aa850e943460826bffd40257e5f8d9b7407fa1498bf455063c2bce8a361d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | option_implied_moments-1.0.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 298.8 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
af5e42aa0e211e997cd7ca043e3d04ec25feef06e06e73a9fe58d1021660d859
|
|
BLAKE2b-256 checksum How to use checksums |
a281f230b0c6dba07443a1ca857289e800c33fcb3bfa9a0893948fa3a68246ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | option_implied_moments-1.0.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 301.8 kB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-32 |
|
SHA-256 checksum How to use checksums |
8eb8cfc5cfd97830acf696ef250d494110535715cf680cb950167692ce046b38
|
|
BLAKE2b-256 checksum How to use checksums |
fed417de7c5b4c733cf4b0ede9d6e75bf8bd1f275369de9e285dd111b69af0e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | option_implied_moments-1.0.0-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 451.0 kB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
11d597ff4a202c27c1abbf1f3254790ffeebab909f52f3c87f41c7715a9dc58c
|
|
BLAKE2b-256 checksum How to use checksums |
eca14f3201dc922db6d7e48f5af0cdedee04dc44a1a76fe634f7db80de4b762d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp312-cp312-win_amd64.whl
| Download URL | option_implied_moments-1.0.0-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 213.8 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2aff5dcf3d974b088a599e8da2e49c2884e4b6b86b907798b1d6ac5af977a4a7
|
|
BLAKE2b-256 checksum How to use checksums |
7ed994993061d15fbf809655aa301d2b98e6343cd9c043ff66769568649faa6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp312-cp312-win32.whl
| Download URL | option_implied_moments-1.0.0-cp312-cp312-win32.whl |
|---|---|
| Size | 198.1 kB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
77c26eb185b2fc03fce3739cdc69405c48872c7159186a439549acf769e657f3
|
|
BLAKE2b-256 checksum How to use checksums |
5089aa671ce5e0b2cb99327b62fbcd4eb3d31691fc12a6daa65d2a922d6622a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | option_implied_moments-1.0.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 299.1 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
ee32bcfcd3a36ae216e4d39a442a8ebe3a3a0fbe45c105efdb4149ef24dd3b3c
|
|
BLAKE2b-256 checksum How to use checksums |
af41b6f9bade9e479c1653e70129874f0db82c7cccfed2b1fcbf42a1283cdb6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | option_implied_moments-1.0.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 301.2 kB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-32 |
|
SHA-256 checksum How to use checksums |
63cd87079720861766026e93914dc3b3230c92d14b62454c18b0ed8f40b233b4
|
|
BLAKE2b-256 checksum How to use checksums |
bd0606958ac6b4604903b84eb1ae29ba6024d5d0ea5cc0656d78db8a9dd1ee8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | option_implied_moments-1.0.0-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 451.6 kB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
9825ca8adfe5935a312acf715470f37502bde2d777f7f16a686ad95c2ee4dd73
|
|
BLAKE2b-256 checksum How to use checksums |
fa57c6d17f67a8250867ec70709c927396853a1ae56a1e8d5db3bc914d6d5989
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp311-cp311-win_amd64.whl
| Download URL | option_implied_moments-1.0.0-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 215.0 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
963a52ab6b58667b6cb89f7b8c249ca1ba590c28b623ff40c470c0da681c6b8a
|
|
BLAKE2b-256 checksum How to use checksums |
948836fd63aec437003151eaf498f2393421a60429af354f6b09de35ca981415
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp311-cp311-win32.whl
| Download URL | option_implied_moments-1.0.0-cp311-cp311-win32.whl |
|---|---|
| Size | 197.7 kB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
aaf6bbf90ad0b9350496a8cdad5e7bf9c128ac14521c46e525b10f6c5803d7e8
|
|
BLAKE2b-256 checksum How to use checksums |
673c876bb2ae63ebdaf8440fa4372170ea70585856f307448a5e2dbbf2c7c98b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | option_implied_moments-1.0.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 300.6 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
67f9c9ea7ce238736ee2427c8b7bea3806a9459782771867a4a2c25898236a61
|
|
BLAKE2b-256 checksum How to use checksums |
7f4313a680cd4bb2057417240c84f4a52736db915cbfcb2689cb12c61f2661ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
| Download URL | option_implied_moments-1.0.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl |
|---|---|
| Size | 304.3 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-32 |
|
SHA-256 checksum How to use checksums |
8bd07f477ede8e0ca5638de5d92a4ef50893d875560d22dd76af55db2171bf85
|
|
BLAKE2b-256 checksum How to use checksums |
ddfef6f53ae2b7166765f3e03595066d548c9204e03efe3377aee7672d02c226
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency logRelease files / option_implied_moments-1.0.0-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | option_implied_moments-1.0.0-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 450.8 kB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
3c2800d95fbbcf2d0ae819ae08316c859d117cf1736e244937eb046fb1d0e3fb
|
|
BLAKE2b-256 checksum How to use checksums |
5063227923c1439b8ba6271adb9bb25fbd6696df4397b197c11b3178fb806287
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 29, 2026.
Transparency log