quantwave icon indicating copy to clipboard operation
quantwave copied to clipboard

options: implied_vol edge cases (return None/NaN on zero price and intrinsic without time value)

Open lavs9 opened this issue 3 weeks ago • 1 comments

Problem

Observed in trade_backtest 5/6-DTE strangle rebuild:

  1. implied_vol(0.0, ...) returns 0.0 on OTM options instead of None / NaN. A zero price is not a valid market quote, and a 0.0 vol can erroneously pass a naive iv > 0 check.
  2. For deep ITM options quoted at or below intrinsic (e.g. F=8000, K=7500, r=0.065, T=1.2/365, call price 499.893 where undiscounted price is 499.9998 vs intrinsic 500.0094), time value is near zero or negative, making IV undefined. implied_vol returned 0.153 instead of None / NaN.

Ask

Return None (or NaN in vectorized / Polars outputs) whenever:

  • market_price <= 0.0
  • undiscounted_price <= intrinsic (i.e. zero or negative time value)
  • t <= 0.0 or non-positive spot/strike/forward.

lavs9 avatar Nov 11 '26 12:11 lavs9

Resolved in v0.10.2: implied_vol returns None/NaN when price <= 0.0, t <= 0.0, or quote is at/below intrinsic without time value.

lavs9 avatar Nov 11 '26 13:11 lavs9