Option Pricing • Implied Volatility • Greeks
Python package: vollib 1.0.7 • TypeScript package: vollib
Vollib is a family of libraries for calculating option prices, implied volatility, and greeks.
The current Python package is vollib 1.0.7 and later. It supports Python 3.9 through
3.12 and should be installed with pip install -U vollib.
Existing py_vollib installs and imports continue to work through a deprecated transition
package and compatibility namespace, but new Python code should import from vollib.
The temporary vollib-test package is superseded by the official release.
What makes vollib special is that it is built around Peter Jäckel's LetsBeRational, a fast and accurate technique for obtaining Black implied volatility from option prices. LetsBeRational is designed to reach machine precision in at most two iterations, and usually one, on standard 64-bit floating point hardware.
Building on this solid foundation, vollib provides functions to calculate option prices, implied volatility and greeks using Black, Black-Scholes, and Black-Scholes-Merton. vollib implements both analytical and numerical greeks.
LetsBeRational was originally written in C++.
The legacy Python package, vollib 0.1.x, used the SWIG-wrapped implementation and targeted
Python 2.7.
The py_vollib package name was introduced during the Python 3 transition. Starting with
version 1.0.7, the canonical Python package name is again vollib. The old Python 2.7 line
remains available only for pinned legacy installs.
A strictly positive strike price is part of vollib's supported input domain for Black, Black-Scholes, and Black-Scholes-Merton calculations. This preserves the behavior of the LetsBeRational-backed implementation; callers who want to support limiting cases such as a zero-strike call should handle those boundaries in application code.
TypeScript, Java, and JavaScript repositories are listed on the Source page. The Python API
documentation for vollib 1.0.7 is available on the Documentation page.
If you use any version of LetsBeRational or Vollib we would be most grateful if you would kindly give credit by linking back to this page.