Module interp

Module interp 

Source

Functions§

bs_delta
Black-Scholes delta calculation with dividend yield Uses the standard normal CDF from statrs for precision x = ln(K/F), so d1 uses -x for standard Black-Scholes formula
build_linear_iv
Main function to build complete linear IV output Orchestrates all the above functions to produce the final result
build_linear_iv_from_market_data
Convenience function to build linear IV output using underlying price from market data Uses the underlying_price from the first market data point as the forward price
compute_all_metrics
Compute risk reversal and butterfly metrics for all symmetric delta pairs
compute_atm_iv
Compute ATM implied volatility via linear interpolation at x=0
compute_fixed_delta_iv
Solve for the log-moneyness that gives the target delta Uses Brent’s method for robust convergence
compute_fixed_delta_iv_with_config
Solve for the log-moneyness that gives the target delta with configurable extrapolation Uses Brent’s method for robust convergence
compute_metrics
Compute risk reversal and butterfly metrics from delta IVs (backward compatibility)
linear_interp
Linear interpolation in variance space Returns None if query_x is outside the range and extrapolation is disabled or fails
linear_interp_with_config
Linear interpolation with configurable extrapolation Returns None if query_x is outside the range and extrapolation is disabled or fails
prepare_points
Compute sorted (log-moneyness, total_variance) points from market data Filters out invalid IVs (market_iv <= 0), handles duplicates by averaging, and sorts by log-moneyness