Implementation:Avhz RustQuant Implied Volatility
| Knowledge Sources | |
|---|---|
| Domains | Option_Pricing, Quantitative_Finance |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
Concrete tool for computing implied volatility from option market prices using the "Let's Be Rational" algorithm provided by the RustQuant library.
Description
This module implements the implied volatility solver based on Peter Jaeckel's Let's Be Rational paper and the py_lets_be_rational Python reference implementation. The algorithm uses a transformed rational guess with limited Householder(3) iterations to achieve near machine-precision accuracy in at most 2 iterations for normal cases. The implementation covers:
- Normalized Black function evaluation in four accuracy regions: asymptotic expansion, small-t expansion, standard CDF-based, and erfcx-based.
- Normalized vega computation for the Newton step.
- Rational cubic interpolation with convexity-preserving control parameters for initial guesses.
- Householder(3) iteration combining Newton, Halley, and third-order corrections.
The public API exposes implied_volatility(price, S, K, T, r, flag) and a convenience alias iv(). If the price is below intrinsic value, the function returns -INF; if above the maximum theoretical price, it returns INF.
Usage
Use when you need to extract implied volatility from a quoted option price with high precision. This is the solver used internally by BlackScholesMerton::implied_volatility().
Code Reference
Source Location
- Repository: RustQuant
- File: crates/RustQuant_instruments/src/options/implied_volatility.rs
- Lines: 1-1218
Signature
/// Compute implied volatility from a market option price.
/// Returns -INF if price < intrinsic, INF if price >= max theoretical price.
#[must_use]
pub fn implied_volatility(
price: f64,
S: f64,
K: f64,
T: f64,
r: f64,
flag: TypeFlag,
) -> f64
/// Convenience alias for `implied_volatility`.
pub fn iv(price: f64, S: f64, K: f64, T: f64, r: f64, flag: TypeFlag) -> f64
Import
use RustQuant::instruments::options::implied_volatility::implied_volatility;
use RustQuant::instruments::options::TypeFlag;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| price | f64 | Yes | Market price of the option |
| S | f64 | Yes | Underlying asset price |
| K | f64 | Yes | Strike price |
| T | f64 | Yes | Time to expiry in years |
| r | f64 | Yes | Risk-free interest rate |
| flag | TypeFlag | Yes | Call or Put |
Outputs
| Name | Type | Description |
|---|---|---|
| implied_vol | f64 | Implied volatility; -INF if below intrinsic, INF if above max price |
Usage Examples
use RustQuant::instruments::options::implied_volatility::implied_volatility;
use RustQuant::instruments::options::TypeFlag;
let price = 12.3;
let S = 100.0;
let K = 110.0;
let T = 0.89;
let r = 0.03;
let iv = implied_volatility(price, S, K, T, r, TypeFlag::Call);
// iv ~ 0.4027