FAILURE MAP
← Case archive

FA-61496 / Options payoff and settlement / Open access

Option strategy max gain, max loss and breakevens: call premium is added to the call value · case 01

Long calls look profitable at every price.

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

ROOT CAUSE

The call leg adds the premium instead of subtracting it.

VERIFIED REPAIR

Subtract the premium paid from the call intrinsic value.

Unsuccessful approach: Netting the premium inside the max floors the loss at zero.

Case contract

Inputs legs [kind C/P/S, strike (purchase price for stock S), signed qty, premium] and a multiplier. Expiry value V(S) = multiplier * sum(q*(intrinsic - premium)) for options and q*(S - price) for stock, in exact fractions. Breakpoints are 0 and every strike. Tail slope = V(top+1)-V(top). Max gain is None if the slope > 0 else the max over breakpoints; max loss is None if slope < 0 else the min. Breakevens are zeros at breakpoints and linear-interpolated sign changes between them and in the tail. Return [gain, loss, breakevens] 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
from fractions import Fraction
N = 1
observations = []
def solve(legs, multiplier):
    def value(S):
        t = Fraction(0)
        for kind, k, q, prem in legs:
            p = Fraction(str(prem))
            if kind == 'C':
                t += q * (max(S - k, 0) + p)
            elif kind == 'P':
                t += q * (max(k - S, 0) - p)
            else:
                t += q * (S - k)
        return t * multiplier
    pts = sorted(set([0] + [leg[1] for leg in legs]))
    top = pts[-1]
    slope = value(top + 1) - value(top)
    vals = [value(p) for p in pts]
    gain = None if slope > 0 else max(vals)
    loss = None if slope < 0 else min(vals)
    bes = []
    for a, b in zip(pts, pts[1:]):
        va, vb = value(a), value(b)
        if va == 0:
            bes.append(Fraction(a))
        elif va * vb < 0:
            bes.append(a - va * (b - a) / (vb - va))
    vt = value(top)
    if vt == 0:
        bes.append(Fraction(top))
    elif vt * slope < 0:
        bes.append(top - vt / slope)
    def r4(x):
        return None if x is None else float(round(x, 4))
    return [r4(gain), r4(loss), [r4(x) for x in sorted(set(bes))]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression call premium sign 1', [[['S', 85, 1, 0.0], ['C', 100, -2, 2.0], ['C', 90, -1, 0.5], ['C', 110, -2, 3.4]], 1], [16.3, None, [73.7, 108.15]]], ['regression call premium sign 2', [[['P', 95, -2, 3.4], ['C', 80, 1, 5.1]], 1], [None, -188.3, [89.4333]]], ['partial repair probe 1', [[['C', 120, -2, 7.75], ['P', 100, -2, 3.4], ['C', 105, 2, 7.75], ['P', 120, -2, 5.1]], 1], [47.0, -423.0, [108.25]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['S', 105, -1, 0.0], ['P', 80, 1, 3.4]], 100], [18160.0, None, [101.6]]], ['normal control 2', [[['P', 80, -1, 1.25], ['S', 85, 2, 0.0]], 100], [None, -24875.0, [84.375]]], ['normal control 3', [[['P', 95, 1, 1.25], ['S', 90, 2, 0.0], ['P', 80, -2, 5.1]], 1], [None, -236.05, [78.6833]]], ['normal control 4', [[['P', 95, 2, 5.1], ['P', 90, 1, 0.5], ['P', 105, 2, 2.0]], 100], [47530.0, -1470.0, [97.65]]]], [['regression call premium sign 1', [[['S', 80, -2, 0.0], ['C', 85, -1, 1.25], ['P', 100, 2, 0.5], ['C', 90, 1, 5.1]], 100], [35515.0, None, [88.03]]], ['regression call premium sign 2', [[['P', 85, -1, 0.5], ['C', 85, 2, 0.5]], 1], [None, -85.5, [85.25]]], ['partial repair probe 1', [[['P', 115, -2, 1.25], ['P', 80, -2, 3.4], ['C', 105, -2, 5.1], ['C', 95, 2, 5.1]], 1], [29.3, -380.7, [102.675]]], ['partial repair probe 2', [[['C', 105, -1, 5.1], ['P', 95, 1, 5.1], ['C', 85, 1, 5.1], ['P', 100, 1, 1.25]], 100], [18865.0, 865.0, []]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 110, -1, 5.1], ['S', 85, 2, 0.0], ['S', 110, 2, 0.0]], 100], [None, -49490.0, [98.98]]], ['normal control 2', [[['P', 80, -1, 7.75]], 100], [775.0, -7225.0, [72.25]]], ['normal control 3', [[['P', 90, 2, 3.4]], 1], [173.2, -6.8, [86.6]]]], [['regression call premium sign 1', [[['C', 80, 2, 2.0], ['P', 105, 1, 2.0], ['P', 100, -1, 1.25], ['P', 110, 1, 0.5]], 1], [None, 29.75, []]], ['regression call premium sign 2', [[['C', 85, 1, 0.5], ['C', 105, -1, 1.25], ['S', 100, -2, 0.0], ['P', 105, 2, 0.5]], 1], [409.75, None, [109.875]]], ['partial repair probe 1', [[['P', 95, -2, 5.1], ['P', 90, 1, 2.0], ['C', 100, 1, 5.1], ['C', 120, -1, 5.1]], 100], [2820.0, -9180.0, [90.9]]], ['partial repair probe 2', [[['P', 80, 1, 7.75], ['P', 115, 1, 5.1], ['C', 80, -1, 0.5], ['C', 120, 1, 0.5]], 100], [18215.0, -5285.0, [91.075]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['S', 85, -1, 0.0], ['P', 120, -2, 2.0], ['S', 95, -2, 0.0], ['P', 80, 1, 2.0]], 1], [117.0, None, [58.5]]], ['normal control 2', [[['S', 115, -2, 0.0]], 100], [23000.0, None, [115.0]]], ['normal control 3', [[['P', 85, -2, 1.25]], 1], [2.5, -167.5, [83.75]]]], [['regression call premium sign 1', [[['C', 80, 1, 3.4]], 100], [None, -340.0, [83.4]]], ['regression call premium sign 2', [[['C', 115, -1, 1.25], ['P', 105, -1, 0.5], ['P', 100, -1, 5.1]], 100], [685.0, None, [99.075, 121.85]]], ['partial repair probe 1', [[['C', 115, -1, 3.4], ['C', 80, 1, 3.4], ['S', 115, 1, 0.0]], 100], [None, -11500.0, [97.5]]], ['partial repair probe 2', [[['C', 105, 1, 0.5], ['S', 85, 1, 0.0], ['C', 90, -1, 0.5], ['S', 120, 1, 0.0]], 1], [None, -205.0, [110.0]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 105, -2, 1.25]], 100], [250.0, -20750.0, [103.75]]], ['normal control 2', [[['P', 110, -1, 1.25], ['P', 95, -1, 0.5], ['S', 110, 2, 0.0], ['P', 100, 2, 0.5]], 100], [None, -22425.0, [109.75]]], ['normal control 3', [[['S', 90, 1, 0.0]], 100], [None, -9000.0, [90.0]]]], [['regression call premium sign 1', [[['S', 100, 1, 0.0], ['C', 105, -2, 1.25], ['P', 110, 2, 0.5]], 1], [121.5, None, [111.5]]], ['regression call premium sign 2', [[['P', 100, -2, 0.5], ['C', 120, -2, 3.4], ['C', 90, 2, 5.1], ['S', 85, 1, 0.0]], 1], [None, -287.4, [93.48]]], ['partial repair probe 1', [[['C', 120, -1, 5.1], ['P', 110, 2, 0.5], ['C', 110, 1, 5.1]], 1], [219.0, -1.0, [109.5, 111.0]]], ['partial repair probe 2', [[['S', 120, -1, 0.0], ['C', 110, 1, 7.75], ['P', 110, 1, 5.1], ['C', 90, -1, 7.75]], 1], [224.9, None, [104.9667]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 120, -2, 5.1]], 1], [10.2, -229.8, [114.9]]], ['normal control 2', [[['P', 105, 1, 2.0]], 100], [10300.0, -200.0, [103.0]]], ['normal control 3', [[['P', 100, -1, 0.5], ['S', 110, 1, 0.0], ['P', 115, -2, 5.1]], 100], [None, -42930.0, [109.7667]]]]]
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 call premium sign 1[-6.3, None, []][16.3, None, [73.7, 108.15]]Failed
regression call premium sign 2[None, -178.1, [86.0333]][None, -188.3, [89.4333]]Failed
partial repair probe 1[47.0, -423.0, [108.25]][47.0, -423.0, [108.25]]Passed
boundary control 1[98.0, -2.0, [98.0]][98.0, -2.0, [98.0]]Passed
normal control 1[18160.0, None, [101.6]][18160.0, None, [101.6]]Passed
normal control 2[None, -24875.0, [84.375]][None, -24875.0, [84.375]]Passed
normal control 3[None, -236.05, [78.6833]][None, -236.05, [78.6833]]Passed
normal control 4[47530.0, -1470.0, [97.65]][47530.0, -1470.0, [97.65]]Passed

SHA-256 / 7c2a9d30129ce51d298e7dc0d5d59293f4a7f595b22332c1060fc36fb5a15523

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(legs, multiplier):
    def value(S):
        t = Fraction(0)
        for kind, k, q, prem in legs:
            p = Fraction(str(prem))
            if kind == 'C':
                t += q * max(S - k - p, 0)
            elif kind == 'P':
                t += q * (max(k - S, 0) - p)
            else:
                t += q * (S - k)
        return t * multiplier
    pts = sorted(set([0] + [leg[1] for leg in legs]))
    top = pts[-1]
    slope = value(top + 1) - value(top)
    vals = [value(p) for p in pts]
    gain = None if slope > 0 else max(vals)
    loss = None if slope < 0 else min(vals)
    bes = []
    for a, b in zip(pts, pts[1:]):
        va, vb = value(a), value(b)
        if va == 0:
            bes.append(Fraction(a))
        elif va * vb < 0:
            bes.append(a - va * (b - a) / (vb - va))
    vt = value(top)
    if vt == 0:
        bes.append(Fraction(top))
    elif vt * slope < 0:
        bes.append(top - vt / slope)
    def r4(x):
        return None if x is None else float(round(x, 4))
    return [r4(gain), r4(loss), [r4(x) for x in sorted(set(bes))]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression call premium sign 1', [[['S', 85, 1, 0.0], ['C', 100, -2, 2.0], ['C', 90, -1, 0.5], ['C', 110, -2, 3.4]], 1], [16.3, None, [73.7, 108.15]]], ['regression call premium sign 2', [[['P', 95, -2, 3.4], ['C', 80, 1, 5.1]], 1], [None, -188.3, [89.4333]]], ['partial repair probe 1', [[['C', 120, -2, 7.75], ['P', 100, -2, 3.4], ['C', 105, 2, 7.75], ['P', 120, -2, 5.1]], 1], [47.0, -423.0, [108.25]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['S', 105, -1, 0.0], ['P', 80, 1, 3.4]], 100], [18160.0, None, [101.6]]], ['normal control 2', [[['P', 80, -1, 1.25], ['S', 85, 2, 0.0]], 100], [None, -24875.0, [84.375]]], ['normal control 3', [[['P', 95, 1, 1.25], ['S', 90, 2, 0.0], ['P', 80, -2, 5.1]], 1], [None, -236.05, [78.6833]]], ['normal control 4', [[['P', 95, 2, 5.1], ['P', 90, 1, 0.5], ['P', 105, 2, 2.0]], 100], [47530.0, -1470.0, [97.65]]]], [['regression call premium sign 1', [[['S', 80, -2, 0.0], ['C', 85, -1, 1.25], ['P', 100, 2, 0.5], ['C', 90, 1, 5.1]], 100], [35515.0, None, [88.03]]], ['regression call premium sign 2', [[['P', 85, -1, 0.5], ['C', 85, 2, 0.5]], 1], [None, -85.5, [85.25]]], ['partial repair probe 1', [[['P', 115, -2, 1.25], ['P', 80, -2, 3.4], ['C', 105, -2, 5.1], ['C', 95, 2, 5.1]], 1], [29.3, -380.7, [102.675]]], ['partial repair probe 2', [[['C', 105, -1, 5.1], ['P', 95, 1, 5.1], ['C', 85, 1, 5.1], ['P', 100, 1, 1.25]], 100], [18865.0, 865.0, []]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 110, -1, 5.1], ['S', 85, 2, 0.0], ['S', 110, 2, 0.0]], 100], [None, -49490.0, [98.98]]], ['normal control 2', [[['P', 80, -1, 7.75]], 100], [775.0, -7225.0, [72.25]]], ['normal control 3', [[['P', 90, 2, 3.4]], 1], [173.2, -6.8, [86.6]]]], [['regression call premium sign 1', [[['C', 80, 2, 2.0], ['P', 105, 1, 2.0], ['P', 100, -1, 1.25], ['P', 110, 1, 0.5]], 1], [None, 29.75, []]], ['regression call premium sign 2', [[['C', 85, 1, 0.5], ['C', 105, -1, 1.25], ['S', 100, -2, 0.0], ['P', 105, 2, 0.5]], 1], [409.75, None, [109.875]]], ['partial repair probe 1', [[['P', 95, -2, 5.1], ['P', 90, 1, 2.0], ['C', 100, 1, 5.1], ['C', 120, -1, 5.1]], 100], [2820.0, -9180.0, [90.9]]], ['partial repair probe 2', [[['P', 80, 1, 7.75], ['P', 115, 1, 5.1], ['C', 80, -1, 0.5], ['C', 120, 1, 0.5]], 100], [18215.0, -5285.0, [91.075]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['S', 85, -1, 0.0], ['P', 120, -2, 2.0], ['S', 95, -2, 0.0], ['P', 80, 1, 2.0]], 1], [117.0, None, [58.5]]], ['normal control 2', [[['S', 115, -2, 0.0]], 100], [23000.0, None, [115.0]]], ['normal control 3', [[['P', 85, -2, 1.25]], 1], [2.5, -167.5, [83.75]]]], [['regression call premium sign 1', [[['C', 80, 1, 3.4]], 100], [None, -340.0, [83.4]]], ['regression call premium sign 2', [[['C', 115, -1, 1.25], ['P', 105, -1, 0.5], ['P', 100, -1, 5.1]], 100], [685.0, None, [99.075, 121.85]]], ['partial repair probe 1', [[['C', 115, -1, 3.4], ['C', 80, 1, 3.4], ['S', 115, 1, 0.0]], 100], [None, -11500.0, [97.5]]], ['partial repair probe 2', [[['C', 105, 1, 0.5], ['S', 85, 1, 0.0], ['C', 90, -1, 0.5], ['S', 120, 1, 0.0]], 1], [None, -205.0, [110.0]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 105, -2, 1.25]], 100], [250.0, -20750.0, [103.75]]], ['normal control 2', [[['P', 110, -1, 1.25], ['P', 95, -1, 0.5], ['S', 110, 2, 0.0], ['P', 100, 2, 0.5]], 100], [None, -22425.0, [109.75]]], ['normal control 3', [[['S', 90, 1, 0.0]], 100], [None, -9000.0, [90.0]]]], [['regression call premium sign 1', [[['S', 100, 1, 0.0], ['C', 105, -2, 1.25], ['P', 110, 2, 0.5]], 1], [121.5, None, [111.5]]], ['regression call premium sign 2', [[['P', 100, -2, 0.5], ['C', 120, -2, 3.4], ['C', 90, 2, 5.1], ['S', 85, 1, 0.0]], 1], [None, -287.4, [93.48]]], ['partial repair probe 1', [[['C', 120, -1, 5.1], ['P', 110, 2, 0.5], ['C', 110, 1, 5.1]], 1], [219.0, -1.0, [109.5, 111.0]]], ['partial repair probe 2', [[['S', 120, -1, 0.0], ['C', 110, 1, 7.75], ['P', 110, 1, 5.1], ['C', 90, -1, 7.75]], 1], [224.9, None, [104.9667]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 120, -2, 5.1]], 1], [10.2, -229.8, [114.9]]], ['normal control 2', [[['P', 105, 1, 2.0]], 100], [10300.0, -200.0, [103.0]]], ['normal control 3', [[['P', 100, -1, 0.5], ['S', 110, 1, 0.0], ['P', 115, -2, 5.1]], 100], [None, -42930.0, [109.7667]]]]]
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 call premium sign 1[5.5, None, [85.0, 103.4375]][16.3, None, [73.7, 108.15]]Failed
regression call premium sign 2[None, -183.2, [88.7218]][None, -188.3, [89.4333]]Failed
partial repair probe 1[None, -423.0, [109.382]][47.0, -423.0, [108.25]]Failed
boundary control 1[98.0, -2.0, [98.0]][98.0, -2.0, [98.0]]Passed
normal control 1[18160.0, None, [101.6]][18160.0, None, [101.6]]Passed
normal control 2[None, -24875.0, [84.375]][None, -24875.0, [84.375]]Passed
normal control 3[None, -236.05, [78.6833]][None, -236.05, [78.6833]]Passed
normal control 4[47530.0, -1470.0, [97.65]][47530.0, -1470.0, [97.65]]Passed

SHA-256 / 9ebeeffef77603403b264f1a143c5f6fd9c9e30dc6d9982b7bb70c1dcdc6e6d8

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(legs, multiplier):
    def value(S):
        t = Fraction(0)
        for kind, k, q, prem in legs:
            p = Fraction(str(prem))
            if kind == 'C':
                t += q * (max(S - k, 0) - p)
            elif kind == 'P':
                t += q * (max(k - S, 0) - p)
            else:
                t += q * (S - k)
        return t * multiplier
    pts = sorted(set([0] + [leg[1] for leg in legs]))
    top = pts[-1]
    slope = value(top + 1) - value(top)
    vals = [value(p) for p in pts]
    gain = None if slope > 0 else max(vals)
    loss = None if slope < 0 else min(vals)
    bes = []
    for a, b in zip(pts, pts[1:]):
        va, vb = value(a), value(b)
        if va == 0:
            bes.append(Fraction(a))
        elif va * vb < 0:
            bes.append(a - va * (b - a) / (vb - va))
    vt = value(top)
    if vt == 0:
        bes.append(Fraction(top))
    elif vt * slope < 0:
        bes.append(top - vt / slope)
    def r4(x):
        return None if x is None else float(round(x, 4))
    return [r4(gain), r4(loss), [r4(x) for x in sorted(set(bes))]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression call premium sign 1', [[['S', 85, 1, 0.0], ['C', 100, -2, 2.0], ['C', 90, -1, 0.5], ['C', 110, -2, 3.4]], 1], [16.3, None, [73.7, 108.15]]], ['regression call premium sign 2', [[['P', 95, -2, 3.4], ['C', 80, 1, 5.1]], 1], [None, -188.3, [89.4333]]], ['partial repair probe 1', [[['C', 120, -2, 7.75], ['P', 100, -2, 3.4], ['C', 105, 2, 7.75], ['P', 120, -2, 5.1]], 1], [47.0, -423.0, [108.25]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['S', 105, -1, 0.0], ['P', 80, 1, 3.4]], 100], [18160.0, None, [101.6]]], ['normal control 2', [[['P', 80, -1, 1.25], ['S', 85, 2, 0.0]], 100], [None, -24875.0, [84.375]]], ['normal control 3', [[['P', 95, 1, 1.25], ['S', 90, 2, 0.0], ['P', 80, -2, 5.1]], 1], [None, -236.05, [78.6833]]], ['normal control 4', [[['P', 95, 2, 5.1], ['P', 90, 1, 0.5], ['P', 105, 2, 2.0]], 100], [47530.0, -1470.0, [97.65]]]], [['regression call premium sign 1', [[['S', 80, -2, 0.0], ['C', 85, -1, 1.25], ['P', 100, 2, 0.5], ['C', 90, 1, 5.1]], 100], [35515.0, None, [88.03]]], ['regression call premium sign 2', [[['P', 85, -1, 0.5], ['C', 85, 2, 0.5]], 1], [None, -85.5, [85.25]]], ['partial repair probe 1', [[['P', 115, -2, 1.25], ['P', 80, -2, 3.4], ['C', 105, -2, 5.1], ['C', 95, 2, 5.1]], 1], [29.3, -380.7, [102.675]]], ['partial repair probe 2', [[['C', 105, -1, 5.1], ['P', 95, 1, 5.1], ['C', 85, 1, 5.1], ['P', 100, 1, 1.25]], 100], [18865.0, 865.0, []]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 110, -1, 5.1], ['S', 85, 2, 0.0], ['S', 110, 2, 0.0]], 100], [None, -49490.0, [98.98]]], ['normal control 2', [[['P', 80, -1, 7.75]], 100], [775.0, -7225.0, [72.25]]], ['normal control 3', [[['P', 90, 2, 3.4]], 1], [173.2, -6.8, [86.6]]]], [['regression call premium sign 1', [[['C', 80, 2, 2.0], ['P', 105, 1, 2.0], ['P', 100, -1, 1.25], ['P', 110, 1, 0.5]], 1], [None, 29.75, []]], ['regression call premium sign 2', [[['C', 85, 1, 0.5], ['C', 105, -1, 1.25], ['S', 100, -2, 0.0], ['P', 105, 2, 0.5]], 1], [409.75, None, [109.875]]], ['partial repair probe 1', [[['P', 95, -2, 5.1], ['P', 90, 1, 2.0], ['C', 100, 1, 5.1], ['C', 120, -1, 5.1]], 100], [2820.0, -9180.0, [90.9]]], ['partial repair probe 2', [[['P', 80, 1, 7.75], ['P', 115, 1, 5.1], ['C', 80, -1, 0.5], ['C', 120, 1, 0.5]], 100], [18215.0, -5285.0, [91.075]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['S', 85, -1, 0.0], ['P', 120, -2, 2.0], ['S', 95, -2, 0.0], ['P', 80, 1, 2.0]], 1], [117.0, None, [58.5]]], ['normal control 2', [[['S', 115, -2, 0.0]], 100], [23000.0, None, [115.0]]], ['normal control 3', [[['P', 85, -2, 1.25]], 1], [2.5, -167.5, [83.75]]]], [['regression call premium sign 1', [[['C', 80, 1, 3.4]], 100], [None, -340.0, [83.4]]], ['regression call premium sign 2', [[['C', 115, -1, 1.25], ['P', 105, -1, 0.5], ['P', 100, -1, 5.1]], 100], [685.0, None, [99.075, 121.85]]], ['partial repair probe 1', [[['C', 115, -1, 3.4], ['C', 80, 1, 3.4], ['S', 115, 1, 0.0]], 100], [None, -11500.0, [97.5]]], ['partial repair probe 2', [[['C', 105, 1, 0.5], ['S', 85, 1, 0.0], ['C', 90, -1, 0.5], ['S', 120, 1, 0.0]], 1], [None, -205.0, [110.0]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 105, -2, 1.25]], 100], [250.0, -20750.0, [103.75]]], ['normal control 2', [[['P', 110, -1, 1.25], ['P', 95, -1, 0.5], ['S', 110, 2, 0.0], ['P', 100, 2, 0.5]], 100], [None, -22425.0, [109.75]]], ['normal control 3', [[['S', 90, 1, 0.0]], 100], [None, -9000.0, [90.0]]]], [['regression call premium sign 1', [[['S', 100, 1, 0.0], ['C', 105, -2, 1.25], ['P', 110, 2, 0.5]], 1], [121.5, None, [111.5]]], ['regression call premium sign 2', [[['P', 100, -2, 0.5], ['C', 120, -2, 3.4], ['C', 90, 2, 5.1], ['S', 85, 1, 0.0]], 1], [None, -287.4, [93.48]]], ['partial repair probe 1', [[['C', 120, -1, 5.1], ['P', 110, 2, 0.5], ['C', 110, 1, 5.1]], 1], [219.0, -1.0, [109.5, 111.0]]], ['partial repair probe 2', [[['S', 120, -1, 0.0], ['C', 110, 1, 7.75], ['P', 110, 1, 5.1], ['C', 90, -1, 7.75]], 1], [224.9, None, [104.9667]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['normal control 1', [[['P', 120, -2, 5.1]], 1], [10.2, -229.8, [114.9]]], ['normal control 2', [[['P', 105, 1, 2.0]], 100], [10300.0, -200.0, [103.0]]], ['normal control 3', [[['P', 100, -1, 0.5], ['S', 110, 1, 0.0], ['P', 115, -2, 5.1]], 100], [None, -42930.0, [109.7667]]]]]
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 call premium sign 1[16.3, None, [73.7, 108.15]][16.3, None, [73.7, 108.15]]Passed
regression call premium sign 2[None, -188.3, [89.4333]][None, -188.3, [89.4333]]Passed
partial repair probe 1[47.0, -423.0, [108.25]][47.0, -423.0, [108.25]]Passed
boundary control 1[98.0, -2.0, [98.0]][98.0, -2.0, [98.0]]Passed
normal control 1[18160.0, None, [101.6]][18160.0, None, [101.6]]Passed
normal control 2[None, -24875.0, [84.375]][None, -24875.0, [84.375]]Passed
normal control 3[None, -236.05, [78.6833]][None, -236.05, [78.6833]]Passed
normal control 4[47530.0, -1470.0, [97.65]][47530.0, -1470.0, [97.65]]Passed

SHA-256 / a2ff2a5534e7ba2242d0a27739f5ee5fe030ed1d4d3c3352aff0b19570bde1c0

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:55.756218+00:00.

Case digest / ede540acf3ce8794db77b661dc8df83b8d6d8a8d9b6c87d03901403afa4bd71e