vollib logo

Blazingly Fast & Accurate

Option Pricing • Implied Volatility • Greeks
Python • Java • TypeScript • WASM • Kotlin

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.

Sponsors


Try the Vollib Demo & Playground Codelet below. Create your own CodeLets at indri.ai.

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 are now deprecated and so Python developers still using the legacy version should plan to migrate to py_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.

At the same time as releasing py_vollib, the sponsors released pure Javascript and pure Java versions as j_vollib and js_vollib, respectively. Java and Javascript developers should refer to the py_vollib documentation.

If you use any version of LetsBeRationacxl or Vollib we would be most grateful if you would kindly give credit by linking back to this page.