{"abstract":"Long calls report a finite maximum gain equal to the best breakpoint value.","category":"Options payoff and settlement","checks":8,"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.","evaluation_group":"w2-options_payoff_and_settlement-strategy-risk-profile","failed_approach":"Checking only whether the last leg is long misses mixed strategies.","family":"w2-options_payoff_and_settlement-strategy-risk-profile-unbounded-gain-detection","id":"FA-61486","implementations":{"attempt":{"sha256":"b8847df5fb49c19b9c288f25389672b84bcdcc04cd8d09054b333bad8798745b","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(legs, multiplier):\n    def value(S):\n        t = Fraction(0)\n        for kind, k, q, prem in legs:\n            p = Fraction(str(prem))\n            if kind == 'C':\n                t += q * (max(S - k, 0) - p)\n            elif kind == 'P':\n                t += q * (max(k - S, 0) - p)\n            else:\n                t += q * (S - k)\n        return t * multiplier\n    pts = sorted(set([0] + [leg[1] for leg in legs]))\n    top = pts[-1]\n    slope = value(top + 1) - value(top)\n    vals = [value(p) for p in pts]\n    gain = None if slope > 0 and legs[-1][2] > 0 else max(vals)\n    loss = None if slope < 0 else min(vals)\n    bes = []\n    for a, b in zip(pts, pts[1:]):\n        va, vb = value(a), value(b)\n        if va == 0:\n            bes.append(Fraction(a))\n        elif va * vb < 0:\n            bes.append(a - va * (b - a) / (vb - va))\n    vt = value(top)\n    if vt == 0:\n        bes.append(Fraction(top))\n    elif vt * slope < 0:\n        bes.append(top - vt / slope)\n    def r4(x):\n        return None if x is None else float(round(x, 4))\n    return [r4(gain), r4(loss), [r4(x) for x in sorted(set(bes))]]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression unbounded gain detection 1', [[['C', 80, 1, 0.5]], 1], [None, -0.5, [80.5]]], ['regression unbounded gain detection 2', [[['C', 100, 2, 7.75]], 100], [None, -1550.0, [107.75]]], ['partial repair probe 1', [[['S', 85, 2, 0.0], ['C', 100, -2, 0.5], ['C', 100, 1, 0.5], ['P', 85, -2, 7.75]], 1], [None, -324.0, [81.0]]], ['partial repair probe 2', [[['C', 120, 2, 5.1], ['C', 80, 1, 5.1], ['S', 105, -1, 0.0]], 1], [None, 9.7, []]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 110, -1, 5.1], ['P', 120, -2, 3.4], ['P', 120, -1, 1.25], ['C', 120, -1, 1.25]], 100], [440.0, None, [117.8, 122.2]]], ['normal control 2', [[['P', 110, 2, 0.5]], 100], [21900.0, -100.0, [109.5]]]], [['regression unbounded gain detection 1', [[['C', 110, 1, 5.1]], 100], [None, -510.0, [115.1]]], ['regression unbounded gain detection 2', [[['S', 110, -1, 0.0], ['C', 95, 1, 5.1], ['C', 110, -1, 5.1], ['S', 90, 2, 0.0]], 100], [None, -7000.0, [70.0]]], ['partial repair probe 1', [[['P', 100, 1, 2.0], ['C', 110, 2, 7.75], ['P', 100, -1, 2.0]], 100], [None, -1550.0, [117.75]]], ['partial repair probe 2', [[['P', 85, -1, 3.4], ['C', 105, 2, 3.4], ['P', 95, 1, 7.75], ['C', 100, -1, 5.1]], 100], [None, -1105.0, [88.95, 116.05]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 110, -1, 7.75]], 1], [7.75, None, [117.75]]], ['normal control 2', [[['C', 105, 2, 5.1], ['P', 80, 2, 2.0], ['P', 100, -2, 2.0], ['C', 90, -2, 1.25]], 1], [-27.7, -47.7, []]]], [['regression unbounded gain detection 1', [[['C', 120, 1, 5.1], ['C', 110, 2, 7.75], ['S', 85, -1, 0.0]], 1], [None, -45.6, [64.4, 137.8]]], ['regression unbounded gain detection 2', [[['C', 115, 2, 5.1]], 1], [None, -10.2, [120.1]]], ['partial repair probe 1', [[['S', 115, -1, 0.0], ['C', 120, 2, 2.0], ['P', 115, 2, 0.5], ['P', 120, -2, 7.75]], 100], [None, 50.0, []]], ['partial repair probe 2', [[['S', 120, 1, 0.0], ['C', 120, -2, 1.25], ['S', 110, 2, 0.0], ['P', 115, -2, 5.1]], 1], [None, -557.3, [111.46]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['S', 85, 2, 0.0], ['C', 120, -2, 5.1], ['C', 80, -1, 0.5]], 100], [4070.0, None, [79.65, 160.7]]], ['normal control 2', [[['C', 100, -1, 1.25]], 1], [1.25, None, [101.25]]]], [['regression unbounded gain detection 1', [[['C', 80, 2, 3.4]], 100], [None, -680.0, [83.4]]], ['regression unbounded gain detection 2', [[['C', 105, 1, 2.0], ['S', 85, -1, 0.0], ['P', 100, -1, 3.4], ['C', 105, 1, 2.0]], 100], [None, -2060.0, [125.6]]], ['partial repair probe 1', [[['C', 90, 2, 2.0], ['P', 105, 2, 7.75], ['P', 85, 1, 7.75], ['P', 115, -1, 0.5]], 1], [None, -21.75, [76.625, 107.25]]], ['partial repair probe 2', [[['S', 115, 1, 0.0], ['C', 105, 1, 3.4], ['S', 100, -1, 0.0]], 100], [None, -1840.0, [123.4]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 105, 1, 1.25], ['C', 95, -1, 3.4]], 100], [215.0, -785.0, [97.15]]], ['normal control 2', [[['P', 85, 2, 5.1], ['C', 85, -1, 1.25]], 100], [16105.0, None, [80.525]]]], [['regression unbounded gain detection 1', [[['S', 115, 2, 0.0]], 1], [None, -230.0, [115.0]]], ['regression unbounded gain detection 2', [[['C', 80, 1, 0.5], ['P', 115, 2, 0.5]], 100], [None, 3350.0, []]], ['partial repair probe 1', [[['C', 85, 2, 7.75], ['C', 105, 1, 0.5], ['P', 105, -2, 5.1]], 100], [None, -21580.0, [96.45]]], ['partial repair probe 2', [[['C', 110, 1, 0.5], ['P', 115, -1, 3.4]], 100], [None, -11210.0, [111.05]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['P', 100, 1, 0.5], ['C', 105, -1, 7.75], ['C', 100, 1, 5.1]], 1], [102.15, 2.15, []]], ['normal control 2', [[['C', 110, -1, 2.0], ['C', 115, -1, 2.0], ['P', 120, 1, 0.5], ['P', 95, 2, 7.75]], 1], [298.0, None, [108.0]]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"33ae8e3c6d34711ddca6b378022395bafc640a7982e2240192a1ddfbf2b85c99","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(legs, multiplier):\n    def value(S):\n        t = Fraction(0)\n        for kind, k, q, prem in legs:\n            p = Fraction(str(prem))\n            if kind == 'C':\n                t += q * (max(S - k, 0) - p)\n            elif kind == 'P':\n                t += q * (max(k - S, 0) - p)\n            else:\n                t += q * (S - k)\n        return t * multiplier\n    pts = sorted(set([0] + [leg[1] for leg in legs]))\n    top = pts[-1]\n    slope = value(top + 1) - value(top)\n    vals = [value(p) for p in pts]\n    gain = max(vals)\n    loss = None if slope < 0 else min(vals)\n    bes = []\n    for a, b in zip(pts, pts[1:]):\n        va, vb = value(a), value(b)\n        if va == 0:\n            bes.append(Fraction(a))\n        elif va * vb < 0:\n            bes.append(a - va * (b - a) / (vb - va))\n    vt = value(top)\n    if vt == 0:\n        bes.append(Fraction(top))\n    elif vt * slope < 0:\n        bes.append(top - vt / slope)\n    def r4(x):\n        return None if x is None else float(round(x, 4))\n    return [r4(gain), r4(loss), [r4(x) for x in sorted(set(bes))]]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression unbounded gain detection 1', [[['C', 80, 1, 0.5]], 1], [None, -0.5, [80.5]]], ['regression unbounded gain detection 2', [[['C', 100, 2, 7.75]], 100], [None, -1550.0, [107.75]]], ['partial repair probe 1', [[['S', 85, 2, 0.0], ['C', 100, -2, 0.5], ['C', 100, 1, 0.5], ['P', 85, -2, 7.75]], 1], [None, -324.0, [81.0]]], ['partial repair probe 2', [[['C', 120, 2, 5.1], ['C', 80, 1, 5.1], ['S', 105, -1, 0.0]], 1], [None, 9.7, []]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 110, -1, 5.1], ['P', 120, -2, 3.4], ['P', 120, -1, 1.25], ['C', 120, -1, 1.25]], 100], [440.0, None, [117.8, 122.2]]], ['normal control 2', [[['P', 110, 2, 0.5]], 100], [21900.0, -100.0, [109.5]]]], [['regression unbounded gain detection 1', [[['C', 110, 1, 5.1]], 100], [None, -510.0, [115.1]]], ['regression unbounded gain detection 2', [[['S', 110, -1, 0.0], ['C', 95, 1, 5.1], ['C', 110, -1, 5.1], ['S', 90, 2, 0.0]], 100], [None, -7000.0, [70.0]]], ['partial repair probe 1', [[['P', 100, 1, 2.0], ['C', 110, 2, 7.75], ['P', 100, -1, 2.0]], 100], [None, -1550.0, [117.75]]], ['partial repair probe 2', [[['P', 85, -1, 3.4], ['C', 105, 2, 3.4], ['P', 95, 1, 7.75], ['C', 100, -1, 5.1]], 100], [None, -1105.0, [88.95, 116.05]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 110, -1, 7.75]], 1], [7.75, None, [117.75]]], ['normal control 2', [[['C', 105, 2, 5.1], ['P', 80, 2, 2.0], ['P', 100, -2, 2.0], ['C', 90, -2, 1.25]], 1], [-27.7, -47.7, []]]], [['regression unbounded gain detection 1', [[['C', 120, 1, 5.1], ['C', 110, 2, 7.75], ['S', 85, -1, 0.0]], 1], [None, -45.6, [64.4, 137.8]]], ['regression unbounded gain detection 2', [[['C', 115, 2, 5.1]], 1], [None, -10.2, [120.1]]], ['partial repair probe 1', [[['S', 115, -1, 0.0], ['C', 120, 2, 2.0], ['P', 115, 2, 0.5], ['P', 120, -2, 7.75]], 100], [None, 50.0, []]], ['partial repair probe 2', [[['S', 120, 1, 0.0], ['C', 120, -2, 1.25], ['S', 110, 2, 0.0], ['P', 115, -2, 5.1]], 1], [None, -557.3, [111.46]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['S', 85, 2, 0.0], ['C', 120, -2, 5.1], ['C', 80, -1, 0.5]], 100], [4070.0, None, [79.65, 160.7]]], ['normal control 2', [[['C', 100, -1, 1.25]], 1], [1.25, None, [101.25]]]], [['regression unbounded gain detection 1', [[['C', 80, 2, 3.4]], 100], [None, -680.0, [83.4]]], ['regression unbounded gain detection 2', [[['C', 105, 1, 2.0], ['S', 85, -1, 0.0], ['P', 100, -1, 3.4], ['C', 105, 1, 2.0]], 100], [None, -2060.0, [125.6]]], ['partial repair probe 1', [[['C', 90, 2, 2.0], ['P', 105, 2, 7.75], ['P', 85, 1, 7.75], ['P', 115, -1, 0.5]], 1], [None, -21.75, [76.625, 107.25]]], ['partial repair probe 2', [[['S', 115, 1, 0.0], ['C', 105, 1, 3.4], ['S', 100, -1, 0.0]], 100], [None, -1840.0, [123.4]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 105, 1, 1.25], ['C', 95, -1, 3.4]], 100], [215.0, -785.0, [97.15]]], ['normal control 2', [[['P', 85, 2, 5.1], ['C', 85, -1, 1.25]], 100], [16105.0, None, [80.525]]]], [['regression unbounded gain detection 1', [[['S', 115, 2, 0.0]], 1], [None, -230.0, [115.0]]], ['regression unbounded gain detection 2', [[['C', 80, 1, 0.5], ['P', 115, 2, 0.5]], 100], [None, 3350.0, []]], ['partial repair probe 1', [[['C', 85, 2, 7.75], ['C', 105, 1, 0.5], ['P', 105, -2, 5.1]], 100], [None, -21580.0, [96.45]]], ['partial repair probe 2', [[['C', 110, 1, 0.5], ['P', 115, -1, 3.4]], 100], [None, -11210.0, [111.05]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['P', 100, 1, 0.5], ['C', 105, -1, 7.75], ['C', 100, 1, 5.1]], 1], [102.15, 2.15, []]], ['normal control 2', [[['C', 110, -1, 2.0], ['C', 115, -1, 2.0], ['P', 120, 1, 0.5], ['P', 95, 2, 7.75]], 1], [298.0, None, [108.0]]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"a6fa5f8752cf2941182cb6a3c1a1d4f673e6bc5d7559f7b5346766161b4f91ef","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(legs, multiplier):\n    def value(S):\n        t = Fraction(0)\n        for kind, k, q, prem in legs:\n            p = Fraction(str(prem))\n            if kind == 'C':\n                t += q * (max(S - k, 0) - p)\n            elif kind == 'P':\n                t += q * (max(k - S, 0) - p)\n            else:\n                t += q * (S - k)\n        return t * multiplier\n    pts = sorted(set([0] + [leg[1] for leg in legs]))\n    top = pts[-1]\n    slope = value(top + 1) - value(top)\n    vals = [value(p) for p in pts]\n    gain = None if slope > 0 else max(vals)\n    loss = None if slope < 0 else min(vals)\n    bes = []\n    for a, b in zip(pts, pts[1:]):\n        va, vb = value(a), value(b)\n        if va == 0:\n            bes.append(Fraction(a))\n        elif va * vb < 0:\n            bes.append(a - va * (b - a) / (vb - va))\n    vt = value(top)\n    if vt == 0:\n        bes.append(Fraction(top))\n    elif vt * slope < 0:\n        bes.append(top - vt / slope)\n    def r4(x):\n        return None if x is None else float(round(x, 4))\n    return [r4(gain), r4(loss), [r4(x) for x in sorted(set(bes))]]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression unbounded gain detection 1', [[['C', 80, 1, 0.5]], 1], [None, -0.5, [80.5]]], ['regression unbounded gain detection 2', [[['C', 100, 2, 7.75]], 100], [None, -1550.0, [107.75]]], ['partial repair probe 1', [[['S', 85, 2, 0.0], ['C', 100, -2, 0.5], ['C', 100, 1, 0.5], ['P', 85, -2, 7.75]], 1], [None, -324.0, [81.0]]], ['partial repair probe 2', [[['C', 120, 2, 5.1], ['C', 80, 1, 5.1], ['S', 105, -1, 0.0]], 1], [None, 9.7, []]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 110, -1, 5.1], ['P', 120, -2, 3.4], ['P', 120, -1, 1.25], ['C', 120, -1, 1.25]], 100], [440.0, None, [117.8, 122.2]]], ['normal control 2', [[['P', 110, 2, 0.5]], 100], [21900.0, -100.0, [109.5]]]], [['regression unbounded gain detection 1', [[['C', 110, 1, 5.1]], 100], [None, -510.0, [115.1]]], ['regression unbounded gain detection 2', [[['S', 110, -1, 0.0], ['C', 95, 1, 5.1], ['C', 110, -1, 5.1], ['S', 90, 2, 0.0]], 100], [None, -7000.0, [70.0]]], ['partial repair probe 1', [[['P', 100, 1, 2.0], ['C', 110, 2, 7.75], ['P', 100, -1, 2.0]], 100], [None, -1550.0, [117.75]]], ['partial repair probe 2', [[['P', 85, -1, 3.4], ['C', 105, 2, 3.4], ['P', 95, 1, 7.75], ['C', 100, -1, 5.1]], 100], [None, -1105.0, [88.95, 116.05]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 110, -1, 7.75]], 1], [7.75, None, [117.75]]], ['normal control 2', [[['C', 105, 2, 5.1], ['P', 80, 2, 2.0], ['P', 100, -2, 2.0], ['C', 90, -2, 1.25]], 1], [-27.7, -47.7, []]]], [['regression unbounded gain detection 1', [[['C', 120, 1, 5.1], ['C', 110, 2, 7.75], ['S', 85, -1, 0.0]], 1], [None, -45.6, [64.4, 137.8]]], ['regression unbounded gain detection 2', [[['C', 115, 2, 5.1]], 1], [None, -10.2, [120.1]]], ['partial repair probe 1', [[['S', 115, -1, 0.0], ['C', 120, 2, 2.0], ['P', 115, 2, 0.5], ['P', 120, -2, 7.75]], 100], [None, 50.0, []]], ['partial repair probe 2', [[['S', 120, 1, 0.0], ['C', 120, -2, 1.25], ['S', 110, 2, 0.0], ['P', 115, -2, 5.1]], 1], [None, -557.3, [111.46]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['S', 85, 2, 0.0], ['C', 120, -2, 5.1], ['C', 80, -1, 0.5]], 100], [4070.0, None, [79.65, 160.7]]], ['normal control 2', [[['C', 100, -1, 1.25]], 1], [1.25, None, [101.25]]]], [['regression unbounded gain detection 1', [[['C', 80, 2, 3.4]], 100], [None, -680.0, [83.4]]], ['regression unbounded gain detection 2', [[['C', 105, 1, 2.0], ['S', 85, -1, 0.0], ['P', 100, -1, 3.4], ['C', 105, 1, 2.0]], 100], [None, -2060.0, [125.6]]], ['partial repair probe 1', [[['C', 90, 2, 2.0], ['P', 105, 2, 7.75], ['P', 85, 1, 7.75], ['P', 115, -1, 0.5]], 1], [None, -21.75, [76.625, 107.25]]], ['partial repair probe 2', [[['S', 115, 1, 0.0], ['C', 105, 1, 3.4], ['S', 100, -1, 0.0]], 100], [None, -1840.0, [123.4]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['C', 105, 1, 1.25], ['C', 95, -1, 3.4]], 100], [215.0, -785.0, [97.15]]], ['normal control 2', [[['P', 85, 2, 5.1], ['C', 85, -1, 1.25]], 100], [16105.0, None, [80.525]]]], [['regression unbounded gain detection 1', [[['S', 115, 2, 0.0]], 1], [None, -230.0, [115.0]]], ['regression unbounded gain detection 2', [[['C', 80, 1, 0.5], ['P', 115, 2, 0.5]], 100], [None, 3350.0, []]], ['partial repair probe 1', [[['C', 85, 2, 7.75], ['C', 105, 1, 0.5], ['P', 105, -2, 5.1]], 100], [None, -21580.0, [96.45]]], ['partial repair probe 2', [[['C', 110, 1, 0.5], ['P', 115, -1, 3.4]], 100], [None, -11210.0, [111.05]]], ['boundary control 1', [[['P', 100, 1, 2.0]], 1], [98.0, -2.0, [98.0]]], ['boundary control 2', [[['S', 100, 1, 0.0], ['C', 110, -1, 1.25]], 1], [11.25, -98.75, [98.75]]], ['normal control 1', [[['P', 100, 1, 0.5], ['C', 105, -1, 7.75], ['C', 100, 1, 5.1]], 1], [102.15, 2.15, []]], ['normal control 2', [[['C', 110, -1, 2.0], ['C', 115, -1, 2.0], ['P', 120, 1, 0.5], ['P', 95, 2, 7.75]], 1], [298.0, None, [108.0]]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-options_payoff_and_settlement-strategy-risk-profile-unbounded-gain-detection","generated_at":"2026-09-29T14:46:55.706920+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Option expiry, exercise and settlement engines move cash and shares; a wrong branch misstates obligations.","repair":"Report an unbounded gain when the tail slope is positive.","root_cause":"The maximum gain is taken over breakpoints without checking the tail slope.","sha256":"b4af00c09d731fc8f573d64c0f82a593c8bf613ab79aa510bb806c42020c5c0a","title":"Option strategy max gain, max loss and breakevens: maximum gain ignores the upside tail · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":44.411,"exit_code":1,"observations":[{"actual":[null,-0.5,[80.5]],"check":"regression unbounded gain detection 1","expected":[null,-0.5,[80.5]],"passed":true},{"actual":[null,-1550.0,[107.75]],"check":"regression unbounded gain detection 2","expected":[null,-1550.0,[107.75]],"passed":true},{"actual":[46.0,-324.0,[81.0]],"check":"partial repair probe 1","expected":[null,-324.0,[81.0]],"passed":false},{"actual":[89.7,9.7,[]],"check":"partial repair probe 2","expected":[null,9.7,[]],"passed":false},{"actual":[98.0,-2.0,[98.0]],"check":"boundary control 1","expected":[98.0,-2.0,[98.0]],"passed":true},{"actual":[11.25,-98.75,[98.75]],"check":"boundary control 2","expected":[11.25,-98.75,[98.75]],"passed":true},{"actual":[440.0,null,[117.8,122.2]],"check":"normal control 1","expected":[440.0,null,[117.8,122.2]],"passed":true},{"actual":[21900.0,-100.0,[109.5]],"check":"normal control 2","expected":[21900.0,-100.0,[109.5]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression unbounded gain detection 1\", \"actual\": [null, -0.5, [80.5]], \"expected\": [null, -0.5, [80.5]], \"passed\": true}, {\"check\": \"regression unbounded gain detection 2\", \"actual\": [null, -1550.0, [107.75]], \"expected\": [null, -1550.0, [107.75]], \"passed\": true}, {\"check\": \"partial repair probe 1\", \"actual\": [46.0, -324.0, [81.0]], \"expected\": [null, -324.0, [81.0]], \"passed\": false}, {\"check\": \"partial repair probe 2\", \"actual\": [89.7, 9.7, []], \"expected\": [null, 9.7, []], \"passed\": false}, {\"check\": \"boundary control 1\", \"actual\": [98.0, -2.0, [98.0]], \"expected\": [98.0, -2.0, [98.0]], \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": [11.25, -98.75, [98.75]], \"expected\": [11.25, -98.75, [98.75]], \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": [440.0, null, [117.8, 122.2]], \"expected\": [440.0, null, [117.8, 122.2]], \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": [21900.0, -100.0, [109.5]], \"expected\": [21900.0, -100.0, [109.5]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.144,"exit_code":1,"observations":[{"actual":[-0.5,-0.5,[80.5]],"check":"regression unbounded gain detection 1","expected":[null,-0.5,[80.5]],"passed":false},{"actual":[-1550.0,-1550.0,[107.75]],"check":"regression unbounded gain detection 2","expected":[null,-1550.0,[107.75]],"passed":false},{"actual":[46.0,-324.0,[81.0]],"check":"partial repair probe 1","expected":[null,-324.0,[81.0]],"passed":false},{"actual":[89.7,9.7,[]],"check":"partial repair probe 2","expected":[null,9.7,[]],"passed":false},{"actual":[98.0,-2.0,[98.0]],"check":"boundary control 1","expected":[98.0,-2.0,[98.0]],"passed":true},{"actual":[11.25,-98.75,[98.75]],"check":"boundary control 2","expected":[11.25,-98.75,[98.75]],"passed":true},{"actual":[440.0,null,[117.8,122.2]],"check":"normal control 1","expected":[440.0,null,[117.8,122.2]],"passed":true},{"actual":[21900.0,-100.0,[109.5]],"check":"normal control 2","expected":[21900.0,-100.0,[109.5]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression unbounded gain detection 1\", \"actual\": [-0.5, -0.5, [80.5]], \"expected\": [null, -0.5, [80.5]], \"passed\": false}, {\"check\": \"regression unbounded gain detection 2\", \"actual\": [-1550.0, -1550.0, [107.75]], \"expected\": [null, -1550.0, [107.75]], \"passed\": false}, {\"check\": \"partial repair probe 1\", \"actual\": [46.0, -324.0, [81.0]], \"expected\": [null, -324.0, [81.0]], \"passed\": false}, {\"check\": \"partial repair probe 2\", \"actual\": [89.7, 9.7, []], \"expected\": [null, 9.7, []], \"passed\": false}, {\"check\": \"boundary control 1\", \"actual\": [98.0, -2.0, [98.0]], \"expected\": [98.0, -2.0, [98.0]], \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": [11.25, -98.75, [98.75]], \"expected\": [11.25, -98.75, [98.75]], \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": [440.0, null, [117.8, 122.2]], \"expected\": [440.0, null, [117.8, 122.2]], \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": [21900.0, -100.0, [109.5]], \"expected\": [21900.0, -100.0, [109.5]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.134,"exit_code":0,"observations":[{"actual":[null,-0.5,[80.5]],"check":"regression unbounded gain detection 1","expected":[null,-0.5,[80.5]],"passed":true},{"actual":[null,-1550.0,[107.75]],"check":"regression unbounded gain detection 2","expected":[null,-1550.0,[107.75]],"passed":true},{"actual":[null,-324.0,[81.0]],"check":"partial repair probe 1","expected":[null,-324.0,[81.0]],"passed":true},{"actual":[null,9.7,[]],"check":"partial repair probe 2","expected":[null,9.7,[]],"passed":true},{"actual":[98.0,-2.0,[98.0]],"check":"boundary control 1","expected":[98.0,-2.0,[98.0]],"passed":true},{"actual":[11.25,-98.75,[98.75]],"check":"boundary control 2","expected":[11.25,-98.75,[98.75]],"passed":true},{"actual":[440.0,null,[117.8,122.2]],"check":"normal control 1","expected":[440.0,null,[117.8,122.2]],"passed":true},{"actual":[21900.0,-100.0,[109.5]],"check":"normal control 2","expected":[21900.0,-100.0,[109.5]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression unbounded gain detection 1\", \"actual\": [null, -0.5, [80.5]], \"expected\": [null, -0.5, [80.5]], \"passed\": true}, {\"check\": \"regression unbounded gain detection 2\", \"actual\": [null, -1550.0, [107.75]], \"expected\": [null, -1550.0, [107.75]], \"passed\": true}, {\"check\": \"partial repair probe 1\", \"actual\": [null, -324.0, [81.0]], \"expected\": [null, -324.0, [81.0]], \"passed\": true}, {\"check\": \"partial repair probe 2\", \"actual\": [null, 9.7, []], \"expected\": [null, 9.7, []], \"passed\": true}, {\"check\": \"boundary control 1\", \"actual\": [98.0, -2.0, [98.0]], \"expected\": [98.0, -2.0, [98.0]], \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": [11.25, -98.75, [98.75]], \"expected\": [11.25, -98.75, [98.75]], \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": [440.0, null, [117.8, 122.2]], \"expected\": [440.0, null, [117.8, 122.2]], \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": [21900.0, -100.0, [109.5]], \"expected\": [21900.0, -100.0, [109.5]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}