pub fn py_refine_vol_and_greeks(
s: f64,
r: f64,
b: f64,
is_call: bool,
k: f64,
t: f64,
target_price: f64,
initial_vol: f64,
db_dr: f64,
) -> PyResult<BlackScholesGreeksResult>Expand description
Refines implied volatility using an initial guess and computes greeks.
This function uses compute_iv_and_greeks which performs a Halley iteration
to refine the volatility estimate from an initial guess.
db_dr is zero for fixed carry and one for carry defined as r - q, including r == q.
Rho is per percentage point.
Refinement falls back to the full implied-volatility solver when its volatility reaches a clamp bound or it fails to reprice the premium within 0.01 percent. The exact implementation is used when the fast kernel cannot reprice the solved premium within that tolerance.
ยงErrors
Returns an error if:
- Model inputs or the premium are invalid.
- The premium has no finite positive implied volatility.
- Results are nonfinite, inconsistent, or fail the 0.01 percent repricing tolerance.