Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(options): clarify non-positive S/K intrinsic fallback comment

santhreal1260ce4704d7
diff --git a/agent/backtest/engines/options_portfolio.py b/agent/backtest/engines/options_portfolio.py
index 025927154..88d7d07ba 100644
--- a/agent/backtest/engines/options_portfolio.py
+++ b/agent/backtest/engines/options_portfolio.py
@@ -46,8 +46,8 @@ def bs_price(S: float, K: float, T: float, r: float, sigma: float,
>>> round(bs_price(100, 100, 1.0, 0.05, 0.2, "call"), 2)
10.45
"""
- # Non-positive spot/strike makes log(S/K) undefined; match options_pricing_tool
- # and iv_smile_adjustment by falling back to intrinsic value.
+ # Non-positive S/K makes log(S/K) undefined; reuse the intrinsic fallback
+ # (iv_smile_adjustment already soft-guards non-positive S/K).
if T <= 0 or sigma <= 0 or S <= 0 or K <= 0:
if option_type == "call":
return max(S - K, 0.0)
diff --git a/agent/tests/test_options_bs_nonpositive_strike.py b/agent/tests/test_options_bs_nonpositive_strike.py
index 222a48222..1a7e4e9de 100644
--- a/agent/tests/test_options_bs_nonpositive_strike.py
+++ b/agent/tests/test_options_bs_nonpositive_strike.py
@@ -1,4 +1,4 @@
-"""Reject non-positive spot/strike in Black-Scholes pricing helpers."""
+"""Treat non-positive spot/strike as intrinsic in Black-Scholes helpers."""
from __future__ import annotations