FAILURE MAP
← Case archive

FA-61901 / Currency rounding and FX conversion / Open access

The payer on a quote-denominated leg is derived from the side alone · case 01

A customer spending a fixed number of dollars on euros has the euros rounded up in their favour.

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

ROOT CAUSE

In the quote-currency branch the paying flag is side == 'buy', although the customer then receives base.

VERIFIED REPAIR

When the amount is in quote currency the counter base amount is paid by the customer only when selling base.

Unsuccessful approach: Always rounding the quote-leg counter amount up still favours buying customers.

Case contract

solve(side, amount, ccy, pair, bid, ask): pair is six letters BASEQUOTE; side is the customer's action on the base currency ('buy' or 'sell'). The dealer sells base at ask and buys at bid. If amount is in base, the counter amount in quote is amount*rate; if in quote, the counter amount in base is amount/rate. Amounts the customer pays are rounded up (ceiling) and amounts the customer receives are rounded down (floor) at the counter currency exponent (JPY 0, KWD 3, else 2). Return [counter_amount, counter_ccy]; errors: 'ERR:side', 'ERR:crossed-quote' when bid > ask (bid == ask is valid), 'ERR:currency-not-in-pair'.

Why this case matters

Currency amounts must be rounded at the right stage and in the right unit, or ledgers, quotes and settlements drift by minor units.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN
N = 1
observations = []
def solve(side, amount, ccy, pair, bid, ask):
    exps = {'JPY': 0, 'KWD': 3}
    base, quote = pair[:3], pair[3:]
    if side not in ('buy', 'sell'): return 'ERR:side'
    b, a = Decimal(bid), Decimal(ask)
    if b > a: return 'ERR:crossed-quote'
    r = a if side == 'buy' else b
    x = Decimal(amount)
    if ccy == base:
        out, oc = x * r, quote
        pays = side == 'buy'
    elif ccy == quote:
        out, oc = x / r, base
        pays = side == 'buy'
    else:
        return 'ERR:currency-not-in-pair'
    mode = ROUND_CEILING if pays else ROUND_FLOOR
    return [format(out.quantize(Decimal(1).scaleb(-exps.get(oc, 2)), rounding=mode), 'f'), oc]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression quote-leg-payer 1', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR']),
  ('regression quote-leg-payer 2', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('partial repair guard 2', ('buy', '35334', 'USD', 'EURUSD', '18.3113', '18.3183'), ['1928.89', 'EUR']),
  ('control: buy base in base', ('buy', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.50', 'USD']),
  ('control: sell base in base', ('sell', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.10', 'USD']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD'])],
 [('regression quote-leg-payer 1', ('sell', '77.77', 'USD', 'KWDUSD', '3.2520', '3.2561'), ['23.915', 'KWD']),
  ('regression quote-leg-payer 2', ('sell', '30057', 'USD', 'EURUSD', '76.9818', '76.9826'), ['390.45', 'EUR']),
  ('partial repair guard 1', ('buy', '34866', 'KWD', 'USDKWD', '148.1320', '148.1390'), ['235.36', 'USD']),
  ('partial repair guard 2', ('buy', '9849', 'USD', 'KWDUSD', '109.5417', '109.5455'), ['89.907', 'KWD']),
  ('control: receive quote', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD']),
  ('control: crossed quote', ('buy', '5', 'EUR', 'EURUSD', '1.2', '1.1'), 'ERR:crossed-quote')],
 [('regression quote-leg-payer 1', ('sell', '50691', 'JPY', 'USDJPY', '61.7254', '61.7302'), ['821.24', 'USD']),
  ('regression quote-leg-payer 2', ('sell', '69613.58', 'USD', 'EURUSD', '41.9786', '41.9808'), ['1658.32', 'EUR']),
  ('partial repair guard 1', ('buy', '77666.89', 'JPY', 'USDJPY', '122.1001', '122.1039'), ['636.07', 'USD']),
  ('partial repair guard 2', ('buy', '51211.50', 'JPY', 'USDJPY', '106.2807', '106.2865'), ['481.82', 'USD']),
  ('control: crossed quote', ('buy', '5', 'EUR', 'EURUSD', '1.2', '1.1'), 'ERR:crossed-quote'),
  ('control: foreign currency', ('buy', '5', 'CHF', 'EURUSD', '1.08', '1.09'), 'ERR:currency-not-in-pair'),
  ('control: dinar counter', ('sell', '77.77', 'USD', 'KWDUSD', '3.2520', '3.2561'), ['23.915', 'KWD']),
  ('control: bad side', ('hold', '5', 'EUR', 'EURUSD', '1.08', '1.09'), 'ERR:side')],
 [('regression quote-leg-payer 1', ('sell', '75689.91', 'USD', 'EURUSD', '88.5926', '88.5984'), ['854.36', 'EUR']),
  ('regression quote-leg-payer 2', ('sell', '38162.39', 'USD', 'KWDUSD', '111.9590', '111.9634'), ['340.861', 'KWD']),
  ('partial repair guard 1', ('buy', '65703.38', 'USD', 'EURUSD', '135.0637', '135.0675'), ['486.44', 'EUR']),
  ('partial repair guard 2', ('buy', '31372', 'JPY', 'EURJPY', '73.3664', '73.3690'), ['427.59', 'EUR']),
  ('control: bad side', ('hold', '5', 'EUR', 'EURUSD', '1.08', '1.09'), 'ERR:side'),
  ('control: buy base in base', ('buy', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.50', 'USD']),
  ('control: sell base in base', ('sell', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.10', 'USD']),
  ('control: spend quote', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR'])],
 [('regression quote-leg-payer 1', ('sell', '24387', 'KWD', 'USDKWD', '72.1987', '72.2047'), ['337.78', 'USD']),
  ('regression quote-leg-payer 2', ('sell', '350.83', 'KWD', 'USDKWD', '107.9091', '107.9159'), ['3.26', 'USD']),
  ('partial repair guard 1', ('buy', '85834.23', 'USD', 'GBPUSD', '92.7164', '92.7184'), ['925.75', 'GBP']),
  ('partial repair guard 2', ('buy', '22301.63', 'USD', 'EURUSD', '33.8763', '33.8797'), ['658.25', 'EUR']),
  ('control: spend quote', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR']),
  ('control: receive quote', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD'])]]
for label, args, expected in cases[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 quote-leg-payer 1['92.30', 'EUR']['92.29', 'EUR']Failed
regression quote-leg-payer 2['92.32', 'EUR']['92.33', 'EUR']Failed
partial repair guard 2['1928.90', 'EUR']['1928.89', 'EUR']Failed
control: buy base in base['1083.50', 'USD']['1083.50', 'USD']Passed
control: sell base in base['1083.10', 'USD']['1083.10', 'USD']Passed
control: yen counter['1514', 'JPY']['1514', 'JPY']Passed
control: locked quote['316.25', 'USD']['316.25', 'USD']Passed

SHA-256 / bc6553b2efb3574c1d2b981400842c987f06a8bc0fb0de90bf611aff1a61edba

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN
N = 1
observations = []
def solve(side, amount, ccy, pair, bid, ask):
    exps = {'JPY': 0, 'KWD': 3}
    base, quote = pair[:3], pair[3:]
    if side not in ('buy', 'sell'): return 'ERR:side'
    b, a = Decimal(bid), Decimal(ask)
    if b > a: return 'ERR:crossed-quote'
    r = a if side == 'buy' else b
    x = Decimal(amount)
    if ccy == base:
        out, oc = x * r, quote
        pays = side == 'buy'
    elif ccy == quote:
        out, oc = x / r, base
        pays = True
    else:
        return 'ERR:currency-not-in-pair'
    mode = ROUND_CEILING if pays else ROUND_FLOOR
    return [format(out.quantize(Decimal(1).scaleb(-exps.get(oc, 2)), rounding=mode), 'f'), oc]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression quote-leg-payer 1', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR']),
  ('regression quote-leg-payer 2', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('partial repair guard 2', ('buy', '35334', 'USD', 'EURUSD', '18.3113', '18.3183'), ['1928.89', 'EUR']),
  ('control: buy base in base', ('buy', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.50', 'USD']),
  ('control: sell base in base', ('sell', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.10', 'USD']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD'])],
 [('regression quote-leg-payer 1', ('sell', '77.77', 'USD', 'KWDUSD', '3.2520', '3.2561'), ['23.915', 'KWD']),
  ('regression quote-leg-payer 2', ('sell', '30057', 'USD', 'EURUSD', '76.9818', '76.9826'), ['390.45', 'EUR']),
  ('partial repair guard 1', ('buy', '34866', 'KWD', 'USDKWD', '148.1320', '148.1390'), ['235.36', 'USD']),
  ('partial repair guard 2', ('buy', '9849', 'USD', 'KWDUSD', '109.5417', '109.5455'), ['89.907', 'KWD']),
  ('control: receive quote', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD']),
  ('control: crossed quote', ('buy', '5', 'EUR', 'EURUSD', '1.2', '1.1'), 'ERR:crossed-quote')],
 [('regression quote-leg-payer 1', ('sell', '50691', 'JPY', 'USDJPY', '61.7254', '61.7302'), ['821.24', 'USD']),
  ('regression quote-leg-payer 2', ('sell', '69613.58', 'USD', 'EURUSD', '41.9786', '41.9808'), ['1658.32', 'EUR']),
  ('partial repair guard 1', ('buy', '77666.89', 'JPY', 'USDJPY', '122.1001', '122.1039'), ['636.07', 'USD']),
  ('partial repair guard 2', ('buy', '51211.50', 'JPY', 'USDJPY', '106.2807', '106.2865'), ['481.82', 'USD']),
  ('control: crossed quote', ('buy', '5', 'EUR', 'EURUSD', '1.2', '1.1'), 'ERR:crossed-quote'),
  ('control: foreign currency', ('buy', '5', 'CHF', 'EURUSD', '1.08', '1.09'), 'ERR:currency-not-in-pair'),
  ('control: dinar counter', ('sell', '77.77', 'USD', 'KWDUSD', '3.2520', '3.2561'), ['23.915', 'KWD']),
  ('control: bad side', ('hold', '5', 'EUR', 'EURUSD', '1.08', '1.09'), 'ERR:side')],
 [('regression quote-leg-payer 1', ('sell', '75689.91', 'USD', 'EURUSD', '88.5926', '88.5984'), ['854.36', 'EUR']),
  ('regression quote-leg-payer 2', ('sell', '38162.39', 'USD', 'KWDUSD', '111.9590', '111.9634'), ['340.861', 'KWD']),
  ('partial repair guard 1', ('buy', '65703.38', 'USD', 'EURUSD', '135.0637', '135.0675'), ['486.44', 'EUR']),
  ('partial repair guard 2', ('buy', '31372', 'JPY', 'EURJPY', '73.3664', '73.3690'), ['427.59', 'EUR']),
  ('control: bad side', ('hold', '5', 'EUR', 'EURUSD', '1.08', '1.09'), 'ERR:side'),
  ('control: buy base in base', ('buy', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.50', 'USD']),
  ('control: sell base in base', ('sell', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.10', 'USD']),
  ('control: spend quote', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR'])],
 [('regression quote-leg-payer 1', ('sell', '24387', 'KWD', 'USDKWD', '72.1987', '72.2047'), ['337.78', 'USD']),
  ('regression quote-leg-payer 2', ('sell', '350.83', 'KWD', 'USDKWD', '107.9091', '107.9159'), ['3.26', 'USD']),
  ('partial repair guard 1', ('buy', '85834.23', 'USD', 'GBPUSD', '92.7164', '92.7184'), ['925.75', 'GBP']),
  ('partial repair guard 2', ('buy', '22301.63', 'USD', 'EURUSD', '33.8763', '33.8797'), ['658.25', 'EUR']),
  ('control: spend quote', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR']),
  ('control: receive quote', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD'])]]
for label, args, expected in cases[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 quote-leg-payer 1['92.30', 'EUR']['92.29', 'EUR']Failed
regression quote-leg-payer 2['92.33', 'EUR']['92.33', 'EUR']Passed
partial repair guard 2['1928.90', 'EUR']['1928.89', 'EUR']Failed
control: buy base in base['1083.50', 'USD']['1083.50', 'USD']Passed
control: sell base in base['1083.10', 'USD']['1083.10', 'USD']Passed
control: yen counter['1514', 'JPY']['1514', 'JPY']Passed
control: locked quote['316.25', 'USD']['316.25', 'USD']Passed

SHA-256 / 228eefebd651dda7a309d035b450d53a46c9fda8dc7a6586c222f771cd2dab26

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN
N = 1
observations = []
def solve(side, amount, ccy, pair, bid, ask):
    exps = {'JPY': 0, 'KWD': 3}
    base, quote = pair[:3], pair[3:]
    if side not in ('buy', 'sell'): return 'ERR:side'
    b, a = Decimal(bid), Decimal(ask)
    if b > a: return 'ERR:crossed-quote'
    r = a if side == 'buy' else b
    x = Decimal(amount)
    if ccy == base:
        out, oc = x * r, quote
        pays = side == 'buy'
    elif ccy == quote:
        out, oc = x / r, base
        pays = side == 'sell'
    else:
        return 'ERR:currency-not-in-pair'
    mode = ROUND_CEILING if pays else ROUND_FLOOR
    return [format(out.quantize(Decimal(1).scaleb(-exps.get(oc, 2)), rounding=mode), 'f'), oc]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression quote-leg-payer 1', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR']),
  ('regression quote-leg-payer 2', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('partial repair guard 2', ('buy', '35334', 'USD', 'EURUSD', '18.3113', '18.3183'), ['1928.89', 'EUR']),
  ('control: buy base in base', ('buy', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.50', 'USD']),
  ('control: sell base in base', ('sell', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.10', 'USD']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD'])],
 [('regression quote-leg-payer 1', ('sell', '77.77', 'USD', 'KWDUSD', '3.2520', '3.2561'), ['23.915', 'KWD']),
  ('regression quote-leg-payer 2', ('sell', '30057', 'USD', 'EURUSD', '76.9818', '76.9826'), ['390.45', 'EUR']),
  ('partial repair guard 1', ('buy', '34866', 'KWD', 'USDKWD', '148.1320', '148.1390'), ['235.36', 'USD']),
  ('partial repair guard 2', ('buy', '9849', 'USD', 'KWDUSD', '109.5417', '109.5455'), ['89.907', 'KWD']),
  ('control: receive quote', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD']),
  ('control: crossed quote', ('buy', '5', 'EUR', 'EURUSD', '1.2', '1.1'), 'ERR:crossed-quote')],
 [('regression quote-leg-payer 1', ('sell', '50691', 'JPY', 'USDJPY', '61.7254', '61.7302'), ['821.24', 'USD']),
  ('regression quote-leg-payer 2', ('sell', '69613.58', 'USD', 'EURUSD', '41.9786', '41.9808'), ['1658.32', 'EUR']),
  ('partial repair guard 1', ('buy', '77666.89', 'JPY', 'USDJPY', '122.1001', '122.1039'), ['636.07', 'USD']),
  ('partial repair guard 2', ('buy', '51211.50', 'JPY', 'USDJPY', '106.2807', '106.2865'), ['481.82', 'USD']),
  ('control: crossed quote', ('buy', '5', 'EUR', 'EURUSD', '1.2', '1.1'), 'ERR:crossed-quote'),
  ('control: foreign currency', ('buy', '5', 'CHF', 'EURUSD', '1.08', '1.09'), 'ERR:currency-not-in-pair'),
  ('control: dinar counter', ('sell', '77.77', 'USD', 'KWDUSD', '3.2520', '3.2561'), ['23.915', 'KWD']),
  ('control: bad side', ('hold', '5', 'EUR', 'EURUSD', '1.08', '1.09'), 'ERR:side')],
 [('regression quote-leg-payer 1', ('sell', '75689.91', 'USD', 'EURUSD', '88.5926', '88.5984'), ['854.36', 'EUR']),
  ('regression quote-leg-payer 2', ('sell', '38162.39', 'USD', 'KWDUSD', '111.9590', '111.9634'), ['340.861', 'KWD']),
  ('partial repair guard 1', ('buy', '65703.38', 'USD', 'EURUSD', '135.0637', '135.0675'), ['486.44', 'EUR']),
  ('partial repair guard 2', ('buy', '31372', 'JPY', 'EURJPY', '73.3664', '73.3690'), ['427.59', 'EUR']),
  ('control: bad side', ('hold', '5', 'EUR', 'EURUSD', '1.08', '1.09'), 'ERR:side'),
  ('control: buy base in base', ('buy', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.50', 'USD']),
  ('control: sell base in base', ('sell', '1000', 'EUR', 'EURUSD', '1.0831', '1.0835'), ['1083.10', 'USD']),
  ('control: spend quote', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR'])],
 [('regression quote-leg-payer 1', ('sell', '24387', 'KWD', 'USDKWD', '72.1987', '72.2047'), ['337.78', 'USD']),
  ('regression quote-leg-payer 2', ('sell', '350.83', 'KWD', 'USDKWD', '107.9091', '107.9159'), ['3.26', 'USD']),
  ('partial repair guard 1', ('buy', '85834.23', 'USD', 'GBPUSD', '92.7164', '92.7184'), ['925.75', 'GBP']),
  ('partial repair guard 2', ('buy', '22301.63', 'USD', 'EURUSD', '33.8763', '33.8797'), ['658.25', 'EUR']),
  ('control: spend quote', ('buy', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.29', 'EUR']),
  ('control: receive quote', ('sell', '100', 'USD', 'EURUSD', '1.0831', '1.0835'), ['92.33', 'EUR']),
  ('control: yen counter', ('buy', '10.01', 'USD', 'USDJPY', '151.20', '151.24'), ['1514', 'JPY']),
  ('control: locked quote', ('sell', '250', 'GBP', 'GBPUSD', '1.2650', '1.2650'), ['316.25', 'USD'])]]
for label, args, expected in cases[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 quote-leg-payer 1['92.29', 'EUR']['92.29', 'EUR']Passed
regression quote-leg-payer 2['92.33', 'EUR']['92.33', 'EUR']Passed
partial repair guard 2['1928.89', 'EUR']['1928.89', 'EUR']Passed
control: buy base in base['1083.50', 'USD']['1083.50', 'USD']Passed
control: sell base in base['1083.10', 'USD']['1083.10', 'USD']Passed
control: yen counter['1514', 'JPY']['1514', 'JPY']Passed
control: locked quote['316.25', 'USD']['316.25', 'USD']Passed

SHA-256 / 1fea840750414473eba2732997ada24b86fee1bb8b6a163845479b4774a4e72f

Verification & scope

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.

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

Case digest / c9cd0a3a84a6538d1c14a254403341f067413a0570512c77bed85aec24ae1cd0