{"abstract":"A multiple with a leg already won is valued as if that leg did not exist.","category":"Betting odds conversion","checks":9,"contract":"Cash-out offer for a single or multiple back bet. legs rows are [price taken, current] where current is a decimal price for an open leg, \"won\" or \"lost\". Any lost leg makes the offer [0, 0]. Otherwise value = stake * product of prices taken / product of current prices of open legs, reduced by margin_pct percent, rounded down to a cent. partial_cents 0 means full cash-out: return [value, 0]. A partial amount above the value returns \"invalid\"; otherwise return [partial, remaining stake] with remaining = floor(stake * (1 - partial / value)).","contract_signature":"legs, stake_cents, margin_pct, partial_cents","evaluation_group":"w2-odds-conversion-cash-out-valuation","failed_approach":"Multiplying won legs by their profit only undervalues them.","family":"w2-odds-conversion-cash-out-valuation-settled-leg","id":"FA-84696","implementations":{"attempt":{"sha256":"a858f242b5ddc8c26ecc852696ef9be7e5d34f89739b1d37cc5cdd1efcd8a02d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nimport math\nN = 1\nobservations = []\ndef solve(legs, stake_cents, margin_pct, partial_cents):\n    value = Fraction(stake_cents)\n    for price, cur in legs:\n        if cur == 'lost':\n            return [0, 0]\n        value *= Fraction(price) - (1 if cur == 'won' else 0)\n        if cur != 'won':\n            value /= Fraction(cur)\n    value = value * (100 - Fraction(margin_pct)) / 100\n    full = math.floor(value)\n    if partial_cents == 0:\n        return [full, 0]\n    if partial_cents > full:\n        return 'invalid'\n    remaining = math.floor(stake_cents * (1 - Fraction(partial_cents, full)))\n    return [partial_cents, remaining]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ndef run(args):\n    try:\n        return solve(*args)\n    except Exception as exc:\n        return 'raised ' + type(exc).__name__\ncases = [[('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg', ([['2.34', 'won'], ['2.34', 'won']], 1000, '0', 200), [200, 963]),\n  ('variant scenario 1', ([['3.31', '1.25']], 1000, '7.5', 200), [200, 918]),\n  ('variant scenario 2', ([['1.52', 'lost'], ['4.56', '2.64']], 1000, '7.5', 500), [0, 0])],\n [('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg', ([['3.22', 'won']], 500, '5', 0), [1529, 0]),\n  ('variant scenario 1',\n   ([['4.04', '1.83'], ['1.86', '2.30'], ['1.41', 'lost']], 2500, '5', 0),\n   [0, 0]),\n  ('variant scenario 2',\n   ([['4.07', 'lost'], ['1.73', '4.97'], ['4.67', 'won'], ['1.95', 'won']], 1000, '5', 0),\n   [0, 0])],\n [('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg', ([['1.96', 'won'], ['4.86', 'won']], 500, '7.5', 500), [500, 443]),\n  ('variant scenario 1', ([['3.99', 'won'], ['3.43', 'lost']], 1000, '0', 800), [0, 0]),\n  ('variant scenario 2',\n   ([['2.83', '3.24'], ['4.46', '3.35'], ['3.41', 'won'], ['4.39', '5.31']], 2500, '0', 800),\n   [800, 2255])],\n [('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg', ([['1.88', '2.96'], ['4.98', 'won']], 500, '0', 0), [1581, 0]),\n  ('variant scenario 1',\n   ([['3.69', '3.54'], ['2.84', '5.65'], ['1.59', 'lost']], 2500, '7.5', 0),\n   [0, 0]),\n  ('variant scenario 2',\n   ([['3.74', '3.53'], ['4.23', 'lost'], ['3.97', 'won'], ['2.51', 'lost']], 2500, '5', 800),\n   [0, 0])],\n [('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg',\n   ([['2.64', 'won'], ['3.03', '3.29'], ['4.82', '4.42'], ['3.27', '4.34']], 2500, '5', 800),\n   [800, 2078]),\n  ('variant scenario 1',\n   ([['2.27', 'lost'], ['3.11', '2.62'], ['2.35', '5.79'], ['2.20', '1.56']], 1000, '5', 0),\n   [0, 0]),\n  ('variant scenario 2', ([['3.88', '4.62'], ['1.58', 'lost']], 2500, '7.5', 0), [0, 0])]]\nfor label, args, expected in cases[N - 1]:\n    check(label, run(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":"13e865b330c60f1119d49af52f6edc1a23e12164639aae369858cca7fa655c3f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom fractions import Fraction\nimport math\nN = 1\nobservations = []\ndef solve(legs, stake_cents, margin_pct, partial_cents):\n    value = Fraction(stake_cents)\n    for price, cur in legs:\n        if cur == 'lost':\n            return [0, 0]\n        if cur == 'won':\n            continue\n        value *= Fraction(price)\n        if cur != 'won':\n            value /= Fraction(cur)\n    value = value * (100 - Fraction(margin_pct)) / 100\n    full = math.floor(value)\n    if partial_cents == 0:\n        return [full, 0]\n    if partial_cents > full:\n        return 'invalid'\n    remaining = math.floor(stake_cents * (1 - Fraction(partial_cents, full)))\n    return [partial_cents, remaining]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ndef run(args):\n    try:\n        return solve(*args)\n    except Exception as exc:\n        return 'raised ' + type(exc).__name__\ncases = [[('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg', ([['2.34', 'won'], ['2.34', 'won']], 1000, '0', 200), [200, 963]),\n  ('variant scenario 1', ([['3.31', '1.25']], 1000, '7.5', 200), [200, 918]),\n  ('variant scenario 2', ([['1.52', 'lost'], ['4.56', '2.64']], 1000, '7.5', 500), [0, 0])],\n [('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg', ([['3.22', 'won']], 500, '5', 0), [1529, 0]),\n  ('variant scenario 1',\n   ([['4.04', '1.83'], ['1.86', '2.30'], ['1.41', 'lost']], 2500, '5', 0),\n   [0, 0]),\n  ('variant scenario 2',\n   ([['4.07', 'lost'], ['1.73', '4.97'], ['4.67', 'won'], ['1.95', 'won']], 1000, '5', 0),\n   [0, 0])],\n [('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg', ([['1.96', 'won'], ['4.86', 'won']], 500, '7.5', 500), [500, 443]),\n  ('variant scenario 1', ([['3.99', 'won'], ['3.43', 'lost']], 1000, '0', 800), [0, 0]),\n  ('variant scenario 2',\n   ([['2.83', '3.24'], ['4.46', '3.35'], ['3.41', 'won'], ['4.39', '5.31']], 2500, '0', 800),\n   [800, 2255])],\n [('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg', ([['1.88', '2.96'], ['4.98', 'won']], 500, '0', 0), [1581, 0]),\n  ('variant scenario 1',\n   ([['3.69', '3.54'], ['2.84', '5.65'], ['1.59', 'lost']], 2500, '7.5', 0),\n   [0, 0]),\n  ('variant scenario 2',\n   ([['3.74', '3.53'], ['4.23', 'lost'], ['3.97', 'won'], ['2.51', 'lost']], 2500, '5', 800),\n   [0, 0])],\n [('control single shortened', ([['3.00', '2.00']], 1000, '0', 0), [1500, 0]),\n  ('control margin applied', ([['3.00', '2.00']], 1000, '5', 0), [1425, 0]),\n  ('boundary won leg keeps price', ([['2.00', 'won'], ['2.00', '1.50']], 1000, '0', 0), [2666, 0]),\n  ('boundary partial cash out', ([['3.00', '2.00']], 1000, '0', 500), [500, 666]),\n  ('control lost leg', ([['2.00', 'lost'], ['2.00', '1.50']], 1000, '0', 0), [0, 0]),\n  ('boundary partial above value', ([['2.00', '4.00']], 1000, '0', 600), 'invalid'),\n  ('regression: settled leg',\n   ([['2.64', 'won'], ['3.03', '3.29'], ['4.82', '4.42'], ['3.27', '4.34']], 2500, '5', 800),\n   [800, 2078]),\n  ('variant scenario 1',\n   ([['2.27', 'lost'], ['3.11', '2.62'], ['2.35', '5.79'], ['2.20', '1.56']], 1000, '5', 0),\n   [0, 0]),\n  ('variant scenario 2', ([['3.88', '4.62'], ['1.58', 'lost']], 2500, '7.5', 0), [0, 0])]]\nfor label, args, expected in cases[N - 1]:\n    check(label, run(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":"Stipulated, bounded toy contract stated in the contract field; not a claim of conformance with any operator, exchange or regulator rule set. 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-odds-conversion-cash-out-valuation-settled-leg","generated_at":"2026-09-29T14:50:33.307237+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Cash-out and partial cash-out offers are recomputed from live prices on every tick.","root_cause":"Won legs skip the multiplication by the price taken.","sha256":"6fb6dc2fd8c75ed3592d8a60f2ffe68e72658559d3b2cbf1abda27213faebd48","title":"Settled winning leg dropped from the cash-out value · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":42.585,"exit_code":1,"observations":[{"actual":[1500,0],"check":"control single shortened","expected":[1500,0],"passed":true},{"actual":[1425,0],"check":"control margin applied","expected":[1425,0],"passed":true},{"actual":[1333,0],"check":"boundary won leg keeps price","expected":[2666,0],"passed":false},{"actual":[500,666],"check":"boundary partial cash out","expected":[500,666],"passed":true},{"actual":[0,0],"check":"control lost leg","expected":[0,0],"passed":true},{"actual":"invalid","check":"boundary partial above value","expected":"invalid","passed":true},{"actual":[200,888],"check":"regression: settled leg","expected":[200,963],"passed":false},{"actual":[200,918],"check":"variant scenario 1","expected":[200,918],"passed":true},{"actual":[0,0],"check":"variant scenario 2","expected":[0,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control single shortened\", \"actual\": [1500, 0], \"expected\": [1500, 0], \"passed\": true}, {\"check\": \"control margin applied\", \"actual\": [1425, 0], \"expected\": [1425, 0], \"passed\": true}, {\"check\": \"boundary won leg keeps price\", \"actual\": [1333, 0], \"expected\": [2666, 0], \"passed\": false}, {\"check\": \"boundary partial cash out\", \"actual\": [500, 666], \"expected\": [500, 666], \"passed\": true}, {\"check\": \"control lost leg\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"boundary partial above value\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"regression: settled leg\", \"actual\": [200, 888], \"expected\": [200, 963], \"passed\": false}, {\"check\": \"variant scenario 1\", \"actual\": [200, 918], \"expected\": [200, 918], \"passed\": true}, {\"check\": \"variant scenario 2\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":44.647,"exit_code":1,"observations":[{"actual":[1500,0],"check":"control single shortened","expected":[1500,0],"passed":true},{"actual":[1425,0],"check":"control margin applied","expected":[1425,0],"passed":true},{"actual":[1333,0],"check":"boundary won leg keeps price","expected":[2666,0],"passed":false},{"actual":[500,666],"check":"boundary partial cash out","expected":[500,666],"passed":true},{"actual":[0,0],"check":"control lost leg","expected":[0,0],"passed":true},{"actual":"invalid","check":"boundary partial above value","expected":"invalid","passed":true},{"actual":[200,800],"check":"regression: settled leg","expected":[200,963],"passed":false},{"actual":[200,918],"check":"variant scenario 1","expected":[200,918],"passed":true},{"actual":[0,0],"check":"variant scenario 2","expected":[0,0],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"control single shortened\", \"actual\": [1500, 0], \"expected\": [1500, 0], \"passed\": true}, {\"check\": \"control margin applied\", \"actual\": [1425, 0], \"expected\": [1425, 0], \"passed\": true}, {\"check\": \"boundary won leg keeps price\", \"actual\": [1333, 0], \"expected\": [2666, 0], \"passed\": false}, {\"check\": \"boundary partial cash out\", \"actual\": [500, 666], \"expected\": [500, 666], \"passed\": true}, {\"check\": \"control lost leg\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}, {\"check\": \"boundary partial above value\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"regression: settled leg\", \"actual\": [200, 800], \"expected\": [200, 963], \"passed\": false}, {\"check\": \"variant scenario 1\", \"actual\": [200, 918], \"expected\": [200, 918], \"passed\": true}, {\"check\": \"variant scenario 2\", \"actual\": [0, 0], \"expected\": [0, 0], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}