FAILURE MAP
← Case archive

FA-61746 / Options payoff and settlement / Open access

Implied volatility by bisection with arbitrage bounds: prices at or above the upper bound are solved · case 01

Arbitrage-violating prices return the bracket edge instead of None.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The upper bound check is missing.

VERIFIED REPAIR

Return None when price >= the upper bound.

Unsuccessful approach: A strict comparison lets a price equal to the bound through.

Case contract

Inputs kind, option price, S, K, r, T (no dividends). If price <= lower bound (call max(S - K e^{-rT},0), put max(K e^{-rT} - S,0)) or price >= upper bound (call S, put K e^{-rT}) return None. Otherwise bisect sigma in [1e-6, 5] for 100 iterations on the Black-Scholes price and return the midpoint rounded to 4.

Why this case matters

Option expiry, exercise and settlement engines move cash and shares; a wrong branch misstates obligations.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(kind, price, S, K, r, T):
    def N(x):
        return 0.5 * (1 + math.erf(x / math.sqrt(2)))
    def bs(v):
        d1 = (math.log(S / K) + (r + 0.5 * v * v) * T) / (v * math.sqrt(T))
        d2 = d1 - v * math.sqrt(T)
        if kind == 'C':
            return S * N(d1) - K * math.exp(-r * T) * N(d2)
        return K * math.exp(-r * T) * N(-d2) - S * N(-d1)
    disc_k = K * math.exp(-r * T)
    lower = max(S - disc_k, 0) if kind == 'C' else max(disc_k - S, 0)
    upper = S if kind == 'C' else disc_k
    if price <= lower:
        return None
    lo, hi = 1e-6, 5.0
    for _ in range(100):
        mid = (lo + hi) / 2
        if bs(mid) > price:
            hi = mid
        else:
            lo = mid
    return round((lo + hi) / 2, 4)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression upper arbitrage bound 1', ['C', 110.0, 110.0, 120.0, 0.03, 1.0], None], ['regression upper arbitrage bound 2', ['C', 90.0, 90.0, 120.0, 0.03, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 100.0, 0.08, 0.25], None], ['partial repair probe 2', ['C', 100.0, 100.0, 95.0, 0.03, 2.0], None], ['normal control 1', ['C', 66.3463, 110.0, 120.0, 0.03, 0.25], 3.5], ['normal control 2', ['P', 18.141, 100.0, 120.0, 0.08, 2.0], 0.3], ['normal control 3', ['C', 70.2582, 90.0, 100.0, 0.03, 1.0], 2.5], ['normal control 4', ['P', 72.0164, 100.0, 100.0, 0.08, 1.0], 2.5]], [['regression upper arbitrage bound 1', ['C', 100.0, 100.0, 120.0, 0.08, 1.0], None], ['regression upper arbitrage bound 2', ['C', 110.0, 110.0, 100.0, 0.03, 2.0], None], ['partial repair probe 1', ['C', 100.0, 100.0, 100.0, 0.03, 1.0], None], ['partial repair probe 2', ['C', 110.0, 110.0, 120.0, 0.03, 1.0], None], ['normal control 1', ['C', 2.5954, 90.0, 100.0, 0.08, 1.0], 0.1], ['normal control 2', ['P', 0, 110.0, 95.0, 0.08, 1.0], None], ['normal control 3', ['C', 4.99, 100.0, 95.0, 0.0, 1.0], None], ['normal control 4', ['C', 0.01, 100.0, 100.0, 0.03, 1.0], None]], [['regression upper arbitrage bound 1', ['C', 90.0, 90.0, 120.0, 0.0, 2.0], None], ['regression upper arbitrage bound 2', ['C', 90.0, 90.0, 95.0, 0.0, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 120.0, 0.03, 1.0], None], ['partial repair probe 2', ['P', 95.0, 90.0, 95.0, 0.0, 0.25], None], ['normal control 1', ['P', 0, 100.0, 95.0, 0.0, 1.0], None], ['normal control 2', ['P', 84.8945, 90.0, 95.0, 0.03, 1.0], 3.5], ['normal control 3', ['C', 88.8328, 90.0, 100.0, 0.08, 2.0], 3.5], ['normal control 4', ['P', 10.01, 110.0, 120.0, 0.03, 1.0], 0.1388]], [['regression upper arbitrage bound 1', ['P', 119.103367, 110.0, 120.0, 0.03, 0.25], None], ['regression upper arbitrage bound 2', ['P', 119.103367, 100.0, 120.0, 0.03, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 120.0, 0.0, 0.25], None], ['partial repair probe 2', ['C', 110.0, 110.0, 120.0, 0.0, 1.0], None], ['normal control 1', ['P', 29.99, 90.0, 120.0, 0.0, 1.0], None], ['normal control 2', ['C', 101.1438, 110.0, 120.0, 0.0, 2.0], 2.5], ['normal control 3', ['P', 64.0631, 90.0, 120.0, 0.03, 1.0], 1.3], ['normal control 4', ['C', 0, 90.0, 100.0, 0.03, 1.0], None]], [['regression upper arbitrage bound 1', ['C', 90.0, 90.0, 120.0, 0.0, 1.0], None], ['regression upper arbitrage bound 2', ['P', 89.467631, 100.0, 95.0, 0.03, 2.0], None], ['partial repair probe 1', ['C', 110.0, 110.0, 100.0, 0.03, 1.0], None], ['partial repair probe 2', ['C', 90.0, 90.0, 100.0, 0.03, 1.0], None], ['normal control 1', ['P', 30.0, 90.0, 120.0, 0.0, 0.25], None], ['normal control 2', ['P', 0.0, 100.0, 100.0, 0.0, 1.0], None], ['normal control 3', ['C', 3.8442, 100.0, 100.0, 0.08, 1.0], None], ['normal control 4', ['C', 10.0, 110.0, 100.0, 0.0, 1.0], None]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression upper arbitrage bound 15.0NoneFailed
regression upper arbitrage bound 25.0NoneFailed
partial repair probe 15.0NoneFailed
partial repair probe 25.0NoneFailed
normal control 13.53.5Passed
normal control 20.30.3Passed
normal control 32.52.5Passed
normal control 42.52.5Passed

SHA-256 / 6f2883e7cd15e7d6c0fc1e03e7b63a49681f960ccc6be840698efddd5afccecd

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(kind, price, S, K, r, T):
    def N(x):
        return 0.5 * (1 + math.erf(x / math.sqrt(2)))
    def bs(v):
        d1 = (math.log(S / K) + (r + 0.5 * v * v) * T) / (v * math.sqrt(T))
        d2 = d1 - v * math.sqrt(T)
        if kind == 'C':
            return S * N(d1) - K * math.exp(-r * T) * N(d2)
        return K * math.exp(-r * T) * N(-d2) - S * N(-d1)
    disc_k = K * math.exp(-r * T)
    lower = max(S - disc_k, 0) if kind == 'C' else max(disc_k - S, 0)
    upper = S if kind == 'C' else disc_k
    if price <= lower or price > upper:
        return None
    lo, hi = 1e-6, 5.0
    for _ in range(100):
        mid = (lo + hi) / 2
        if bs(mid) > price:
            hi = mid
        else:
            lo = mid
    return round((lo + hi) / 2, 4)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression upper arbitrage bound 1', ['C', 110.0, 110.0, 120.0, 0.03, 1.0], None], ['regression upper arbitrage bound 2', ['C', 90.0, 90.0, 120.0, 0.03, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 100.0, 0.08, 0.25], None], ['partial repair probe 2', ['C', 100.0, 100.0, 95.0, 0.03, 2.0], None], ['normal control 1', ['C', 66.3463, 110.0, 120.0, 0.03, 0.25], 3.5], ['normal control 2', ['P', 18.141, 100.0, 120.0, 0.08, 2.0], 0.3], ['normal control 3', ['C', 70.2582, 90.0, 100.0, 0.03, 1.0], 2.5], ['normal control 4', ['P', 72.0164, 100.0, 100.0, 0.08, 1.0], 2.5]], [['regression upper arbitrage bound 1', ['C', 100.0, 100.0, 120.0, 0.08, 1.0], None], ['regression upper arbitrage bound 2', ['C', 110.0, 110.0, 100.0, 0.03, 2.0], None], ['partial repair probe 1', ['C', 100.0, 100.0, 100.0, 0.03, 1.0], None], ['partial repair probe 2', ['C', 110.0, 110.0, 120.0, 0.03, 1.0], None], ['normal control 1', ['C', 2.5954, 90.0, 100.0, 0.08, 1.0], 0.1], ['normal control 2', ['P', 0, 110.0, 95.0, 0.08, 1.0], None], ['normal control 3', ['C', 4.99, 100.0, 95.0, 0.0, 1.0], None], ['normal control 4', ['C', 0.01, 100.0, 100.0, 0.03, 1.0], None]], [['regression upper arbitrage bound 1', ['C', 90.0, 90.0, 120.0, 0.0, 2.0], None], ['regression upper arbitrage bound 2', ['C', 90.0, 90.0, 95.0, 0.0, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 120.0, 0.03, 1.0], None], ['partial repair probe 2', ['P', 95.0, 90.0, 95.0, 0.0, 0.25], None], ['normal control 1', ['P', 0, 100.0, 95.0, 0.0, 1.0], None], ['normal control 2', ['P', 84.8945, 90.0, 95.0, 0.03, 1.0], 3.5], ['normal control 3', ['C', 88.8328, 90.0, 100.0, 0.08, 2.0], 3.5], ['normal control 4', ['P', 10.01, 110.0, 120.0, 0.03, 1.0], 0.1388]], [['regression upper arbitrage bound 1', ['P', 119.103367, 110.0, 120.0, 0.03, 0.25], None], ['regression upper arbitrage bound 2', ['P', 119.103367, 100.0, 120.0, 0.03, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 120.0, 0.0, 0.25], None], ['partial repair probe 2', ['C', 110.0, 110.0, 120.0, 0.0, 1.0], None], ['normal control 1', ['P', 29.99, 90.0, 120.0, 0.0, 1.0], None], ['normal control 2', ['C', 101.1438, 110.0, 120.0, 0.0, 2.0], 2.5], ['normal control 3', ['P', 64.0631, 90.0, 120.0, 0.03, 1.0], 1.3], ['normal control 4', ['C', 0, 90.0, 100.0, 0.03, 1.0], None]], [['regression upper arbitrage bound 1', ['C', 90.0, 90.0, 120.0, 0.0, 1.0], None], ['regression upper arbitrage bound 2', ['P', 89.467631, 100.0, 95.0, 0.03, 2.0], None], ['partial repair probe 1', ['C', 110.0, 110.0, 100.0, 0.03, 1.0], None], ['partial repair probe 2', ['C', 90.0, 90.0, 100.0, 0.03, 1.0], None], ['normal control 1', ['P', 30.0, 90.0, 120.0, 0.0, 0.25], None], ['normal control 2', ['P', 0.0, 100.0, 100.0, 0.0, 1.0], None], ['normal control 3', ['C', 3.8442, 100.0, 100.0, 0.08, 1.0], None], ['normal control 4', ['C', 10.0, 110.0, 100.0, 0.0, 1.0], None]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression upper arbitrage bound 15.0NoneFailed
regression upper arbitrage bound 25.0NoneFailed
partial repair probe 15.0NoneFailed
partial repair probe 25.0NoneFailed
normal control 13.53.5Passed
normal control 20.30.3Passed
normal control 32.52.5Passed
normal control 42.52.5Passed

SHA-256 / 04775d694ff3a6c550250c0de80c8fe08212f82c7027f3b35f98ab13f3d18cae

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(kind, price, S, K, r, T):
    def N(x):
        return 0.5 * (1 + math.erf(x / math.sqrt(2)))
    def bs(v):
        d1 = (math.log(S / K) + (r + 0.5 * v * v) * T) / (v * math.sqrt(T))
        d2 = d1 - v * math.sqrt(T)
        if kind == 'C':
            return S * N(d1) - K * math.exp(-r * T) * N(d2)
        return K * math.exp(-r * T) * N(-d2) - S * N(-d1)
    disc_k = K * math.exp(-r * T)
    lower = max(S - disc_k, 0) if kind == 'C' else max(disc_k - S, 0)
    upper = S if kind == 'C' else disc_k
    if price <= lower or price >= upper:
        return None
    lo, hi = 1e-6, 5.0
    for _ in range(100):
        mid = (lo + hi) / 2
        if bs(mid) > price:
            hi = mid
        else:
            lo = mid
    return round((lo + hi) / 2, 4)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression upper arbitrage bound 1', ['C', 110.0, 110.0, 120.0, 0.03, 1.0], None], ['regression upper arbitrage bound 2', ['C', 90.0, 90.0, 120.0, 0.03, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 100.0, 0.08, 0.25], None], ['partial repair probe 2', ['C', 100.0, 100.0, 95.0, 0.03, 2.0], None], ['normal control 1', ['C', 66.3463, 110.0, 120.0, 0.03, 0.25], 3.5], ['normal control 2', ['P', 18.141, 100.0, 120.0, 0.08, 2.0], 0.3], ['normal control 3', ['C', 70.2582, 90.0, 100.0, 0.03, 1.0], 2.5], ['normal control 4', ['P', 72.0164, 100.0, 100.0, 0.08, 1.0], 2.5]], [['regression upper arbitrage bound 1', ['C', 100.0, 100.0, 120.0, 0.08, 1.0], None], ['regression upper arbitrage bound 2', ['C', 110.0, 110.0, 100.0, 0.03, 2.0], None], ['partial repair probe 1', ['C', 100.0, 100.0, 100.0, 0.03, 1.0], None], ['partial repair probe 2', ['C', 110.0, 110.0, 120.0, 0.03, 1.0], None], ['normal control 1', ['C', 2.5954, 90.0, 100.0, 0.08, 1.0], 0.1], ['normal control 2', ['P', 0, 110.0, 95.0, 0.08, 1.0], None], ['normal control 3', ['C', 4.99, 100.0, 95.0, 0.0, 1.0], None], ['normal control 4', ['C', 0.01, 100.0, 100.0, 0.03, 1.0], None]], [['regression upper arbitrage bound 1', ['C', 90.0, 90.0, 120.0, 0.0, 2.0], None], ['regression upper arbitrage bound 2', ['C', 90.0, 90.0, 95.0, 0.0, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 120.0, 0.03, 1.0], None], ['partial repair probe 2', ['P', 95.0, 90.0, 95.0, 0.0, 0.25], None], ['normal control 1', ['P', 0, 100.0, 95.0, 0.0, 1.0], None], ['normal control 2', ['P', 84.8945, 90.0, 95.0, 0.03, 1.0], 3.5], ['normal control 3', ['C', 88.8328, 90.0, 100.0, 0.08, 2.0], 3.5], ['normal control 4', ['P', 10.01, 110.0, 120.0, 0.03, 1.0], 0.1388]], [['regression upper arbitrage bound 1', ['P', 119.103367, 110.0, 120.0, 0.03, 0.25], None], ['regression upper arbitrage bound 2', ['P', 119.103367, 100.0, 120.0, 0.03, 0.25], None], ['partial repair probe 1', ['C', 100.0, 100.0, 120.0, 0.0, 0.25], None], ['partial repair probe 2', ['C', 110.0, 110.0, 120.0, 0.0, 1.0], None], ['normal control 1', ['P', 29.99, 90.0, 120.0, 0.0, 1.0], None], ['normal control 2', ['C', 101.1438, 110.0, 120.0, 0.0, 2.0], 2.5], ['normal control 3', ['P', 64.0631, 90.0, 120.0, 0.03, 1.0], 1.3], ['normal control 4', ['C', 0, 90.0, 100.0, 0.03, 1.0], None]], [['regression upper arbitrage bound 1', ['C', 90.0, 90.0, 120.0, 0.0, 1.0], None], ['regression upper arbitrage bound 2', ['P', 89.467631, 100.0, 95.0, 0.03, 2.0], None], ['partial repair probe 1', ['C', 110.0, 110.0, 100.0, 0.03, 1.0], None], ['partial repair probe 2', ['C', 90.0, 90.0, 100.0, 0.03, 1.0], None], ['normal control 1', ['P', 30.0, 90.0, 120.0, 0.0, 0.25], None], ['normal control 2', ['P', 0.0, 100.0, 100.0, 0.0, 1.0], None], ['normal control 3', ['C', 3.8442, 100.0, 100.0, 0.08, 1.0], None], ['normal control 4', ['C', 10.0, 110.0, 100.0, 0.0, 1.0], None]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression upper arbitrage bound 1NoneNonePassed
regression upper arbitrage bound 2NoneNonePassed
partial repair probe 1NoneNonePassed
partial repair probe 2NoneNonePassed
normal control 13.53.5Passed
normal control 20.30.3Passed
normal control 32.52.5Passed
normal control 42.52.5Passed

SHA-256 / 1067edd3328aea20e7583243b3fc649752e831a7473d1a3f498ca72ad44b248b

Verification & scope

A deterministic toy contract stated explicitly in the contract field; no claim of conformance to any exchange or clearing rulebook. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:46:58.094793+00:00.

Case digest / 190a734b47fe6b25f720523e9328def3d94ef20d025341f3c19c71a260b2f0f0