Vollib is a collection of libraries for calculating option prices, implied volatility and greeks. What makes vollib special is that it is built around Peter Jäckel's LetsBeRational, an extremely fast and accurate technique for obtaining Black's implied volatility.

LetsBeRational can obtain implied volatility from option prices with as little as two iterations to maximum attainable precision on standard (64 bit floating point) hardware for all possible inputs.

Another advantage of LetsBeRational is its fast and accurate implementation of the cumulative normal distribution function. Jäckel's implementation provides better accuracy across a wider range of inputs, while being two orders of magnitude faster than its equivalent in scipy.stats.

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, and the Python lets_be_rational Version 1.0.9 exposes the original functions by means of a SWIG wrapper. Vollib Version 0.1.5 uses the SWIG-wrapped version of lets_be_rational, and is incompatible with Python 3.x.

Based on popular demand, we have released py_vollib and py_lets_be_rational. With these new versions we have eliminated the dependencies on C and SWIG, as both libraries are in pure Python. Each is compatible with Python 3.x as well as Python 2.7. The original C/SWIG-dependent versions will remain available indefinitely as lets_be_rational and vollib.

Translation of LetsBeRational from C to Python resulted in significantly slower performance. However, the use of Numba restored the Python code's execution speed close to the original levels of C+SWIG.

In the same spirit, as of this release, Gammon Capital are pleased to host pure Javascript and pure Java versions of both LetsBeRational and Vollib as open source github projects.

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.