{"abstract":"Currencies we receive are reported as outgoing payments.","category":"Currency rounding and FX conversion","checks":6,"contract":"solve(trades): each trade is [pay_ccy, pay_amount, recv_ccy, recv_amount] from our side. Net per currency = received - paid. Return [[ccy, net], ...] sorted by currency code, omitting currencies whose net is exactly zero; nets are plain strings at the currency exponent (JPY 0, KWD 3, else 2).","evaluation_group":"w2-currency_rounding_and_fx_conversion-multicurrency-settlement-netting","failed_approach":"Reporting absolute nets hides which side pays.","family":"w2-currency_rounding_and_fx_conversion-multicurrency-settlement-netting-net-direction","id":"FA-62101","implementations":{"attempt":{"sha256":"5c98061ec0beeec70f95294492d4ac2521fc64fe10d3b5eadaa74f268a3cf16e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN\nN = 1\nobservations = []\ndef solve(trades):\n    exps = {'JPY': 0, 'KWD': 3}\n    net = {}\n    for pay_c, pay_a, rec_c, rec_a in trades:\n        net[pay_c] = net.get(pay_c, Decimal(0)) - Decimal(pay_a)\n        net[rec_c] = net.get(rec_c, Decimal(0)) + Decimal(rec_a)\n    out = []\n    for c in sorted(net):\n        v = abs(net[c])\n        if v == 0: continue\n        out.append([c, format(v.quantize(Decimal(1).scaleb(-exps.get(c, 2))), 'f')])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression net-direction 1', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('regression net-direction 2', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('control: empty', ([],), []),\n  ('control: unsorted codes',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']])],\n [('regression net-direction 1', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('regression net-direction 2',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']]),\n  ('control: empty', ([],), []),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), [])],\n [('regression net-direction 1',\n   ([['JPY', '1806', 'KWD', '4720.108'], ['USD', '3724.50', 'JPY', '222'], ['KWD', '4720.108', 'JPY', '1806']],),\n   [['JPY', '222'], ['USD', '-3724.50']]),\n  ('regression net-direction 2',\n   ([['GBP', '3755.04', 'GBP', '2258.67'], ['JPY', '4', 'GBP', '4532.21'], ['USD', '3940', 'EUR', '3321.70'],\n     ['KWD', '2315', 'JPY', '2875']],),\n   [['EUR', '3321.70'], ['GBP', '3035.84'], ['JPY', '2871'], ['KWD', '-2315.000'], ['USD', '-3940.00']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']])],\n [('regression net-direction 1',\n   ([['USD', '3559.19', 'EUR', '1234.78'], ['USD', '3870', 'KWD', '4202'], ['USD', '3791.99', 'KWD', '3508.411'],\n     ['USD', '3404.57', 'GBP', '663.83']],),\n   [['EUR', '1234.78'], ['GBP', '663.83'], ['KWD', '7710.411'], ['USD', '-14625.75']]),\n  ('regression net-direction 2',\n   ([['USD', '1062.91', 'GBP', '4208.76'], ['EUR', '468.58', 'EUR', '2562.98'], ['GBP', '4208.76', 'USD', '1062.91']],),\n   [['EUR', '2094.40']]),\n  ('partial repair guard 2',\n   ([['EUR', '4780', 'GBP', '4817.42'], ['EUR', '937.30', 'JPY', '1728'], ['GBP', '394', 'USD', '949']],),\n   [['EUR', '-5717.30'], ['GBP', '4423.42'], ['JPY', '1728'], ['USD', '949.00']]),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('control: empty', ([],), []),\n  ('control: unsorted codes',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']])],\n [('regression net-direction 1',\n   ([['EUR', '4780', 'GBP', '4817.42'], ['EUR', '937.30', 'JPY', '1728'], ['GBP', '394', 'USD', '949']],),\n   [['EUR', '-5717.30'], ['GBP', '4423.42'], ['JPY', '1728'], ['USD', '949.00']]),\n  ('regression net-direction 2',\n   ([['GBP', '2181', 'KWD', '1051.460'], ['JPY', '550', 'EUR', '3789'], ['USD', '506.38', 'JPY', '1697'],\n     ['KWD', '1052.629', 'EUR', '763.75']],),\n   [['EUR', '4552.75'], ['GBP', '-2181.00'], ['JPY', '1147'], ['KWD', '-1.169'], ['USD', '-506.38']]),\n  ('partial repair guard 2',\n   ([['EUR', '4958.34', 'JPY', '456'], ['KWD', '149.894', 'EUR', '4865.00'], ['GBP', '4322.22', 'GBP', '4150.09'],\n     ['USD', '4134', 'GBP', '151.91'], ['JPY', '456', 'EUR', '4958.34']],),\n   [['EUR', '4865.00'], ['GBP', '-20.22'], ['KWD', '-149.894'], ['USD', '-4134.00']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']])]]\nfor label, args, expected in cases[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":"905d25996c3eb386435432e1a7c1e32ee4c8b9e9e4c054875a09d845c5c97778","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN\nN = 1\nobservations = []\ndef solve(trades):\n    exps = {'JPY': 0, 'KWD': 3}\n    net = {}\n    for pay_c, pay_a, rec_c, rec_a in trades:\n        net[pay_c] = net.get(pay_c, Decimal(0)) + Decimal(pay_a)\n        net[rec_c] = net.get(rec_c, Decimal(0)) - Decimal(rec_a)\n    out = []\n    for c in sorted(net):\n        v = net[c]\n        if v == 0: continue\n        out.append([c, format(v.quantize(Decimal(1).scaleb(-exps.get(c, 2))), 'f')])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression net-direction 1', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('regression net-direction 2', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('control: empty', ([],), []),\n  ('control: unsorted codes',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']])],\n [('regression net-direction 1', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('regression net-direction 2',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']]),\n  ('control: empty', ([],), []),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), [])],\n [('regression net-direction 1',\n   ([['JPY', '1806', 'KWD', '4720.108'], ['USD', '3724.50', 'JPY', '222'], ['KWD', '4720.108', 'JPY', '1806']],),\n   [['JPY', '222'], ['USD', '-3724.50']]),\n  ('regression net-direction 2',\n   ([['GBP', '3755.04', 'GBP', '2258.67'], ['JPY', '4', 'GBP', '4532.21'], ['USD', '3940', 'EUR', '3321.70'],\n     ['KWD', '2315', 'JPY', '2875']],),\n   [['EUR', '3321.70'], ['GBP', '3035.84'], ['JPY', '2871'], ['KWD', '-2315.000'], ['USD', '-3940.00']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']])],\n [('regression net-direction 1',\n   ([['USD', '3559.19', 'EUR', '1234.78'], ['USD', '3870', 'KWD', '4202'], ['USD', '3791.99', 'KWD', '3508.411'],\n     ['USD', '3404.57', 'GBP', '663.83']],),\n   [['EUR', '1234.78'], ['GBP', '663.83'], ['KWD', '7710.411'], ['USD', '-14625.75']]),\n  ('regression net-direction 2',\n   ([['USD', '1062.91', 'GBP', '4208.76'], ['EUR', '468.58', 'EUR', '2562.98'], ['GBP', '4208.76', 'USD', '1062.91']],),\n   [['EUR', '2094.40']]),\n  ('partial repair guard 2',\n   ([['EUR', '4780', 'GBP', '4817.42'], ['EUR', '937.30', 'JPY', '1728'], ['GBP', '394', 'USD', '949']],),\n   [['EUR', '-5717.30'], ['GBP', '4423.42'], ['JPY', '1728'], ['USD', '949.00']]),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('control: empty', ([],), []),\n  ('control: unsorted codes',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']])],\n [('regression net-direction 1',\n   ([['EUR', '4780', 'GBP', '4817.42'], ['EUR', '937.30', 'JPY', '1728'], ['GBP', '394', 'USD', '949']],),\n   [['EUR', '-5717.30'], ['GBP', '4423.42'], ['JPY', '1728'], ['USD', '949.00']]),\n  ('regression net-direction 2',\n   ([['GBP', '2181', 'KWD', '1051.460'], ['JPY', '550', 'EUR', '3789'], ['USD', '506.38', 'JPY', '1697'],\n     ['KWD', '1052.629', 'EUR', '763.75']],),\n   [['EUR', '4552.75'], ['GBP', '-2181.00'], ['JPY', '1147'], ['KWD', '-1.169'], ['USD', '-506.38']]),\n  ('partial repair guard 2',\n   ([['EUR', '4958.34', 'JPY', '456'], ['KWD', '149.894', 'EUR', '4865.00'], ['GBP', '4322.22', 'GBP', '4150.09'],\n     ['USD', '4134', 'GBP', '151.91'], ['JPY', '456', 'EUR', '4958.34']],),\n   [['EUR', '4865.00'], ['GBP', '-20.22'], ['KWD', '-149.894'], ['USD', '-4134.00']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']])]]\nfor label, args, expected in cases[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":"93fd22727a7738839711cc55c0b24c8b414f9c1ca479a600cfb6b0cfa8298dcc","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN\nN = 1\nobservations = []\ndef solve(trades):\n    exps = {'JPY': 0, 'KWD': 3}\n    net = {}\n    for pay_c, pay_a, rec_c, rec_a in trades:\n        net[pay_c] = net.get(pay_c, Decimal(0)) - Decimal(pay_a)\n        net[rec_c] = net.get(rec_c, Decimal(0)) + Decimal(rec_a)\n    out = []\n    for c in sorted(net):\n        v = net[c]\n        if v == 0: continue\n        out.append([c, format(v.quantize(Decimal(1).scaleb(-exps.get(c, 2))), 'f')])\n    return out\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression net-direction 1', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('regression net-direction 2', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('control: empty', ([],), []),\n  ('control: unsorted codes',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']])],\n [('regression net-direction 1', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('regression net-direction 2',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']]),\n  ('control: empty', ([],), []),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), [])],\n [('regression net-direction 1',\n   ([['JPY', '1806', 'KWD', '4720.108'], ['USD', '3724.50', 'JPY', '222'], ['KWD', '4720.108', 'JPY', '1806']],),\n   [['JPY', '222'], ['USD', '-3724.50']]),\n  ('regression net-direction 2',\n   ([['GBP', '3755.04', 'GBP', '2258.67'], ['JPY', '4', 'GBP', '4532.21'], ['USD', '3940', 'EUR', '3321.70'],\n     ['KWD', '2315', 'JPY', '2875']],),\n   [['EUR', '3321.70'], ['GBP', '3035.84'], ['JPY', '2871'], ['KWD', '-2315.000'], ['USD', '-3940.00']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']])],\n [('regression net-direction 1',\n   ([['USD', '3559.19', 'EUR', '1234.78'], ['USD', '3870', 'KWD', '4202'], ['USD', '3791.99', 'KWD', '3508.411'],\n     ['USD', '3404.57', 'GBP', '663.83']],),\n   [['EUR', '1234.78'], ['GBP', '663.83'], ['KWD', '7710.411'], ['USD', '-14625.75']]),\n  ('regression net-direction 2',\n   ([['USD', '1062.91', 'GBP', '4208.76'], ['EUR', '468.58', 'EUR', '2562.98'], ['GBP', '4208.76', 'USD', '1062.91']],),\n   [['EUR', '2094.40']]),\n  ('partial repair guard 2',\n   ([['EUR', '4780', 'GBP', '4817.42'], ['EUR', '937.30', 'JPY', '1728'], ['GBP', '394', 'USD', '949']],),\n   [['EUR', '-5717.30'], ['GBP', '4423.42'], ['JPY', '1728'], ['USD', '949.00']]),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']]),\n  ('control: empty', ([],), []),\n  ('control: unsorted codes',\n   ([['USD', '1.00', 'EUR', '0.92'], ['GBP', '0.79', 'USD', '1.00'], ['KWD', '0.307', 'CHF', '0.88']],),\n   [['CHF', '0.88'], ['EUR', '0.92'], ['GBP', '-0.79'], ['KWD', '-0.307']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']])],\n [('regression net-direction 1',\n   ([['EUR', '4780', 'GBP', '4817.42'], ['EUR', '937.30', 'JPY', '1728'], ['GBP', '394', 'USD', '949']],),\n   [['EUR', '-5717.30'], ['GBP', '4423.42'], ['JPY', '1728'], ['USD', '949.00']]),\n  ('regression net-direction 2',\n   ([['GBP', '2181', 'KWD', '1051.460'], ['JPY', '550', 'EUR', '3789'], ['USD', '506.38', 'JPY', '1697'],\n     ['KWD', '1052.629', 'EUR', '763.75']],),\n   [['EUR', '4552.75'], ['GBP', '-2181.00'], ['JPY', '1147'], ['KWD', '-1.169'], ['USD', '-506.38']]),\n  ('partial repair guard 2',\n   ([['EUR', '4958.34', 'JPY', '456'], ['KWD', '149.894', 'EUR', '4865.00'], ['GBP', '4322.22', 'GBP', '4150.09'],\n     ['USD', '4134', 'GBP', '151.91'], ['JPY', '456', 'EUR', '4958.34']],),\n   [['EUR', '4865.00'], ['GBP', '-20.22'], ['KWD', '-149.894'], ['USD', '-4134.00']]),\n  ('control: chained trades', ([['USD', '108.35', 'EUR', '100.00'], ['EUR', '100.00', 'JPY', '16200']],),\n   [['JPY', '16200'], ['USD', '-108.35']]),\n  ('control: short amounts', ([['USD', '5', 'GBP', '4']],), [['GBP', '4.00'], ['USD', '-5.00']]),\n  ('control: fully offset', ([['USD', '10.00', 'EUR', '9.20'], ['EUR', '9.20', 'USD', '10.00']],), []),\n  ('control: same currency swap', ([['KWD', '1.250', 'KWD', '1.000']],), [['KWD', '-0.250']])]]\nfor label, args, expected in cases[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, bounded teaching model with a stipulated toy contract; it makes no claim of conformance to any real regulation, standard, or institution's rules. 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-currency_rounding_and_fx_conversion-multicurrency-settlement-netting-net-direction","generated_at":"2026-09-29T14:47:01.423394+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Currency amounts must be rounded at the right stage and in the right unit, or ledgers, quotes and settlements drift by minor units.","repair":"Received amounts increase and paid amounts decrease the net.","root_cause":"The paid leg is added and the received leg subtracted.","sha256":"133d83f93de6bd696799bfb3051c80e62ed91e902463a4c3e74c4e32895508eb","title":"Net positions are computed as paid minus received · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.69,"exit_code":1,"observations":[{"actual":[["JPY","16200"],["USD","108.35"]],"check":"regression net-direction 1","expected":[["JPY","16200"],["USD","-108.35"]],"passed":false},{"actual":[["GBP","4.00"],["USD","5.00"]],"check":"regression net-direction 2","expected":[["GBP","4.00"],["USD","-5.00"]],"passed":false},{"actual":[],"check":"control: fully offset","expected":[],"passed":true},{"actual":[["KWD","0.250"]],"check":"control: same currency swap","expected":[["KWD","-0.250"]],"passed":false},{"actual":[],"check":"control: empty","expected":[],"passed":true},{"actual":[["CHF","0.88"],["EUR","0.92"],["GBP","0.79"],["KWD","0.307"]],"check":"control: unsorted codes","expected":[["CHF","0.88"],["EUR","0.92"],["GBP","-0.79"],["KWD","-0.307"]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression net-direction 1\", \"actual\": [[\"JPY\", \"16200\"], [\"USD\", \"108.35\"]], \"expected\": [[\"JPY\", \"16200\"], [\"USD\", \"-108.35\"]], \"passed\": false}, {\"check\": \"regression net-direction 2\", \"actual\": [[\"GBP\", \"4.00\"], [\"USD\", \"5.00\"]], \"expected\": [[\"GBP\", \"4.00\"], [\"USD\", \"-5.00\"]], \"passed\": false}, {\"check\": \"control: fully offset\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: same currency swap\", \"actual\": [[\"KWD\", \"0.250\"]], \"expected\": [[\"KWD\", \"-0.250\"]], \"passed\": false}, {\"check\": \"control: empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: unsorted codes\", \"actual\": [[\"CHF\", \"0.88\"], [\"EUR\", \"0.92\"], [\"GBP\", \"0.79\"], [\"KWD\", \"0.307\"]], \"expected\": [[\"CHF\", \"0.88\"], [\"EUR\", \"0.92\"], [\"GBP\", \"-0.79\"], [\"KWD\", \"-0.307\"]], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.267,"exit_code":1,"observations":[{"actual":[["JPY","-16200"],["USD","108.35"]],"check":"regression net-direction 1","expected":[["JPY","16200"],["USD","-108.35"]],"passed":false},{"actual":[["GBP","-4.00"],["USD","5.00"]],"check":"regression net-direction 2","expected":[["GBP","4.00"],["USD","-5.00"]],"passed":false},{"actual":[],"check":"control: fully offset","expected":[],"passed":true},{"actual":[["KWD","0.250"]],"check":"control: same currency swap","expected":[["KWD","-0.250"]],"passed":false},{"actual":[],"check":"control: empty","expected":[],"passed":true},{"actual":[["CHF","-0.88"],["EUR","-0.92"],["GBP","0.79"],["KWD","0.307"]],"check":"control: unsorted codes","expected":[["CHF","0.88"],["EUR","0.92"],["GBP","-0.79"],["KWD","-0.307"]],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression net-direction 1\", \"actual\": [[\"JPY\", \"-16200\"], [\"USD\", \"108.35\"]], \"expected\": [[\"JPY\", \"16200\"], [\"USD\", \"-108.35\"]], \"passed\": false}, {\"check\": \"regression net-direction 2\", \"actual\": [[\"GBP\", \"-4.00\"], [\"USD\", \"5.00\"]], \"expected\": [[\"GBP\", \"4.00\"], [\"USD\", \"-5.00\"]], \"passed\": false}, {\"check\": \"control: fully offset\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: same currency swap\", \"actual\": [[\"KWD\", \"0.250\"]], \"expected\": [[\"KWD\", \"-0.250\"]], \"passed\": false}, {\"check\": \"control: empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: unsorted codes\", \"actual\": [[\"CHF\", \"-0.88\"], [\"EUR\", \"-0.92\"], [\"GBP\", \"0.79\"], [\"KWD\", \"0.307\"]], \"expected\": [[\"CHF\", \"0.88\"], [\"EUR\", \"0.92\"], [\"GBP\", \"-0.79\"], [\"KWD\", \"-0.307\"]], \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":40.475,"exit_code":0,"observations":[{"actual":[["JPY","16200"],["USD","-108.35"]],"check":"regression net-direction 1","expected":[["JPY","16200"],["USD","-108.35"]],"passed":true},{"actual":[["GBP","4.00"],["USD","-5.00"]],"check":"regression net-direction 2","expected":[["GBP","4.00"],["USD","-5.00"]],"passed":true},{"actual":[],"check":"control: fully offset","expected":[],"passed":true},{"actual":[["KWD","-0.250"]],"check":"control: same currency swap","expected":[["KWD","-0.250"]],"passed":true},{"actual":[],"check":"control: empty","expected":[],"passed":true},{"actual":[["CHF","0.88"],["EUR","0.92"],["GBP","-0.79"],["KWD","-0.307"]],"check":"control: unsorted codes","expected":[["CHF","0.88"],["EUR","0.92"],["GBP","-0.79"],["KWD","-0.307"]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression net-direction 1\", \"actual\": [[\"JPY\", \"16200\"], [\"USD\", \"-108.35\"]], \"expected\": [[\"JPY\", \"16200\"], [\"USD\", \"-108.35\"]], \"passed\": true}, {\"check\": \"regression net-direction 2\", \"actual\": [[\"GBP\", \"4.00\"], [\"USD\", \"-5.00\"]], \"expected\": [[\"GBP\", \"4.00\"], [\"USD\", \"-5.00\"]], \"passed\": true}, {\"check\": \"control: fully offset\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: same currency swap\", \"actual\": [[\"KWD\", \"-0.250\"]], \"expected\": [[\"KWD\", \"-0.250\"]], \"passed\": true}, {\"check\": \"control: empty\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"control: unsorted codes\", \"actual\": [[\"CHF\", \"0.88\"], [\"EUR\", \"0.92\"], [\"GBP\", \"-0.79\"], [\"KWD\", \"-0.307\"]], \"expected\": [[\"CHF\", \"0.88\"], [\"EUR\", \"0.92\"], [\"GBP\", \"-0.79\"], [\"KWD\", \"-0.307\"]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}