FA-62171 / Currency rounding and FX conversion / Open access
USDCAD is settled T+2 like other pairs · case 01
USDCAD trades settle a business day late.
ROOT CAUSE
The T+1 exception for the USD/CAD pair is missing.
THE FAILURE
The T+1 exception for the USD/CAD pair is missing.
Unsuccessful approach: Applying T+1 to every CAD pair also shortens EURCAD settlement.
Case contract
solve(trade, pair, holidays): stipulated spot value-date rule. USDCAD/CADUSD settle T+1, every other pair T+2. Count forward from the trade date: a day before the final one counts only if it is a weekday and not a holiday of the non-USD currencies of the pair; the value date itself must be a weekday that is a holiday in neither currency. holidays maps currency to ISO date strings. Return the ISO value date.
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 datetime import date, timedelta
N = 1
observations = []
def solve(trade, pair, holidays):
d = date.fromisoformat(trade)
base, quote = pair[:3], pair[3:]
def good(x, ccys):
return x.weekday() < 5 and all(x.isoformat() not in holidays.get(c, []) for c in ccys)
lag = 2
non_usd = [c for c in (base, quote) if c != 'USD']
x, n = d, 0
while n < lag:
x += timedelta(days=1)
if good(x, non_usd if n < lag - 1 else [base, quote]):
n += 1
return x.isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression cad-settlement-lag 1', ('2026-03-02', 'USDCAD', {}), '2026-03-03'),
('regression cad-settlement-lag 2',
('2026-07-17', 'CADUSD', {'EUR': ['2026-07-20', '2026-07-22'], 'CAD': ['2026-07-20']}), '2026-07-21'),
('partial repair guard 1', ('2026-03-02', 'EURCAD', {}), '2026-03-04'),
('partial repair guard 2',
('2026-02-24', 'EURCAD',
{'JPY': ['2026-02-25', '2026-02-26', '2026-02-28'], 'CAD': ['2026-02-26', '2026-02-27', '2026-03-01'], 'GBP': []}),
'2026-03-02'),
('control: plain t+2', ('2026-03-02', 'EURUSD', {}), '2026-03-04'),
('control: over weekend', ('2026-03-05', 'EURUSD', {}), '2026-03-09'),
('control: usd holiday t+1', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-03']}), '2026-03-04'),
('control: usd holiday on spot', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-04']}), '2026-03-05')],
[('regression cad-settlement-lag 1', ('2026-06-15', 'CADUSD', {}), '2026-06-16'),
('regression cad-settlement-lag 2',
('2026-02-03', 'CADUSD',
{'JPY': ['2026-02-04'], 'EUR': ['2026-02-04', '2026-02-07', '2026-02-08'], 'CAD': ['2026-02-07', '2026-02-08']}),
'2026-02-04'),
('partial repair guard 1',
('2026-03-19', 'EURCAD',
{'JPY': ['2026-03-20', '2026-03-21', '2026-03-22', '2026-03-23', '2026-03-24'],
'EUR': ['2026-03-24'],
'CAD': ['2026-03-24'],
'GBP': ['2026-03-20', '2026-03-21', '2026-03-22']}),
'2026-03-23'),
('partial repair guard 2',
('2026-02-16', 'EURCAD',
{'USD': ['2026-02-17', '2026-02-18', '2026-02-20'],
'EUR': ['2026-02-17', '2026-02-21'],
'CAD': [],
'GBP': ['2026-02-17', '2026-02-20']}),
'2026-02-19'),
('control: usd holiday on spot', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-04']}), '2026-03-05'),
('control: cad t+1', ('2026-03-02', 'USDCAD', {}), '2026-03-03'),
('control: euro holiday t+1', ('2026-03-02', 'EURUSD', {'EUR': ['2026-03-03']}), '2026-03-05'),
('control: cross with cad', ('2026-03-02', 'EURCAD', {}), '2026-03-04')],
[('regression cad-settlement-lag 1',
('2026-08-21', 'USDCAD',
{'USD': ['2026-08-23', '2026-08-25', '2026-08-26'],
'JPY': ['2026-08-23', '2026-08-25'],
'EUR': ['2026-08-24', '2026-08-25', '2026-08-26'],
'GBP': ['2026-08-22', '2026-08-24']}),
'2026-08-24'),
('regression cad-settlement-lag 2',
('2026-10-05', 'USDCAD', {'EUR': ['2026-10-06', '2026-10-07', '2026-10-09'], 'GBP': []}), '2026-10-06'),
('partial repair guard 1',
('2026-03-23', 'EURCAD',
{'JPY': ['2026-03-27'], 'EUR': ['2026-03-25'], 'CAD': ['2026-03-24', '2026-03-26'], 'GBP': ['2026-03-25']}),
'2026-03-30'),
('partial repair guard 2',
('2026-02-03', 'EURCAD',
{'USD': ['2026-02-07'], 'JPY': ['2026-02-04', '2026-02-05', '2026-02-07', '2026-02-08'], 'GBP': ['2026-02-08']}),
'2026-02-05'),
('control: cross with cad', ('2026-03-02', 'EURCAD', {}), '2026-03-04'),
('control: cad usd holiday', ('2026-03-06', 'CADUSD', {'USD': ['2026-03-09']}), '2026-03-10'),
('control: yen cross', ('2026-04-28', 'GBPJPY', {'JPY': ['2026-04-29', '2026-04-30']}), '2026-05-04'),
('control: plain t+2', ('2026-03-02', 'EURUSD', {}), '2026-03-04')],
[('regression cad-settlement-lag 1',
('2026-09-17', 'CADUSD',
{'JPY': ['2026-09-22'], 'CAD': ['2026-09-18', '2026-09-20'], 'GBP': ['2026-09-20', '2026-09-21']}),
'2026-09-21'),
('regression cad-settlement-lag 2', ('2026-04-23', 'USDCAD', {'EUR': ['2026-04-24']}), '2026-04-24'),
('partial repair guard 1',
('2026-08-28', 'EURCAD',
{'USD': ['2026-08-30', '2026-08-31', '2026-09-01'],
'EUR': ['2026-08-31', '2026-09-01'],
'CAD': ['2026-08-29', '2026-08-31'],
'GBP': ['2026-08-29', '2026-09-01']}),
'2026-09-03'),
('partial repair guard 2',
('2026-03-19', 'EURCAD', {'USD': ['2026-03-21'], 'JPY': ['2026-03-20'], 'EUR': ['2026-03-20'], 'CAD': []}),
'2026-03-24'),
('control: plain t+2', ('2026-03-02', 'EURUSD', {}), '2026-03-04'),
('control: over weekend', ('2026-03-05', 'EURUSD', {}), '2026-03-09'),
('control: usd holiday t+1', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-03']}), '2026-03-04'),
('control: usd holiday on spot', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-04']}), '2026-03-05')],
[('regression cad-settlement-lag 1',
('2026-08-10', 'USDCAD',
{'JPY': ['2026-08-11', '2026-08-13'],
'EUR': ['2026-08-11', '2026-08-13', '2026-08-15'],
'GBP': ['2026-08-12', '2026-08-15']}),
'2026-08-11'),
('regression cad-settlement-lag 2',
('2026-03-30', 'CADUSD', {'EUR': ['2026-04-04'], 'GBP': ['2026-04-01', '2026-04-03']}), '2026-03-31'),
('partial repair guard 1',
('2026-06-29', 'EURCAD', {'EUR': ['2026-06-30', '2026-07-04'], 'GBP': ['2026-06-30', '2026-07-04']}), '2026-07-02'),
('partial repair guard 2',
('2026-06-05', 'EURCAD',
{'USD': ['2026-06-06', '2026-06-10'],
'EUR': ['2026-06-08', '2026-06-09'],
'CAD': ['2026-06-09'],
'GBP': ['2026-06-07', '2026-06-10']}),
'2026-06-11'),
('control: usd holiday on spot', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-04']}), '2026-03-05'),
('control: cad t+1', ('2026-03-02', 'USDCAD', {}), '2026-03-03'),
('control: euro holiday t+1', ('2026-03-02', 'EURUSD', {'EUR': ['2026-03-03']}), '2026-03-05'),
('control: cross with cad', ('2026-03-02', 'EURCAD', {}), '2026-03-04')]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression cad-settlement-lag 1 | 2026-03-04 | 2026-03-03 | Failed |
| regression cad-settlement-lag 2 | 2026-07-22 | 2026-07-21 | Failed |
| partial repair guard 1 | 2026-03-04 | 2026-03-04 | Passed |
| partial repair guard 2 | 2026-03-02 | 2026-03-02 | Passed |
| control: plain t+2 | 2026-03-04 | 2026-03-04 | Passed |
| control: over weekend | 2026-03-09 | 2026-03-09 | Passed |
| control: usd holiday t+1 | 2026-03-04 | 2026-03-04 | Passed |
| control: usd holiday on spot | 2026-03-05 | 2026-03-05 | Passed |
SHA-256 / 72bb091c2af17cdcc4535856964ab1856b1753a7cbd9e6aa22cd5cec1f7715b6
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from datetime import date, timedelta
N = 1
observations = []
def solve(trade, pair, holidays):
d = date.fromisoformat(trade)
base, quote = pair[:3], pair[3:]
def good(x, ccys):
return x.weekday() < 5 and all(x.isoformat() not in holidays.get(c, []) for c in ccys)
lag = 1 if 'CAD' in (base, quote) else 2
non_usd = [c for c in (base, quote) if c != 'USD']
x, n = d, 0
while n < lag:
x += timedelta(days=1)
if good(x, non_usd if n < lag - 1 else [base, quote]):
n += 1
return x.isoformat()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression cad-settlement-lag 1', ('2026-03-02', 'USDCAD', {}), '2026-03-03'),
('regression cad-settlement-lag 2',
('2026-07-17', 'CADUSD', {'EUR': ['2026-07-20', '2026-07-22'], 'CAD': ['2026-07-20']}), '2026-07-21'),
('partial repair guard 1', ('2026-03-02', 'EURCAD', {}), '2026-03-04'),
('partial repair guard 2',
('2026-02-24', 'EURCAD',
{'JPY': ['2026-02-25', '2026-02-26', '2026-02-28'], 'CAD': ['2026-02-26', '2026-02-27', '2026-03-01'], 'GBP': []}),
'2026-03-02'),
('control: plain t+2', ('2026-03-02', 'EURUSD', {}), '2026-03-04'),
('control: over weekend', ('2026-03-05', 'EURUSD', {}), '2026-03-09'),
('control: usd holiday t+1', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-03']}), '2026-03-04'),
('control: usd holiday on spot', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-04']}), '2026-03-05')],
[('regression cad-settlement-lag 1', ('2026-06-15', 'CADUSD', {}), '2026-06-16'),
('regression cad-settlement-lag 2',
('2026-02-03', 'CADUSD',
{'JPY': ['2026-02-04'], 'EUR': ['2026-02-04', '2026-02-07', '2026-02-08'], 'CAD': ['2026-02-07', '2026-02-08']}),
'2026-02-04'),
('partial repair guard 1',
('2026-03-19', 'EURCAD',
{'JPY': ['2026-03-20', '2026-03-21', '2026-03-22', '2026-03-23', '2026-03-24'],
'EUR': ['2026-03-24'],
'CAD': ['2026-03-24'],
'GBP': ['2026-03-20', '2026-03-21', '2026-03-22']}),
'2026-03-23'),
('partial repair guard 2',
('2026-02-16', 'EURCAD',
{'USD': ['2026-02-17', '2026-02-18', '2026-02-20'],
'EUR': ['2026-02-17', '2026-02-21'],
'CAD': [],
'GBP': ['2026-02-17', '2026-02-20']}),
'2026-02-19'),
('control: usd holiday on spot', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-04']}), '2026-03-05'),
('control: cad t+1', ('2026-03-02', 'USDCAD', {}), '2026-03-03'),
('control: euro holiday t+1', ('2026-03-02', 'EURUSD', {'EUR': ['2026-03-03']}), '2026-03-05'),
('control: cross with cad', ('2026-03-02', 'EURCAD', {}), '2026-03-04')],
[('regression cad-settlement-lag 1',
('2026-08-21', 'USDCAD',
{'USD': ['2026-08-23', '2026-08-25', '2026-08-26'],
'JPY': ['2026-08-23', '2026-08-25'],
'EUR': ['2026-08-24', '2026-08-25', '2026-08-26'],
'GBP': ['2026-08-22', '2026-08-24']}),
'2026-08-24'),
('regression cad-settlement-lag 2',
('2026-10-05', 'USDCAD', {'EUR': ['2026-10-06', '2026-10-07', '2026-10-09'], 'GBP': []}), '2026-10-06'),
('partial repair guard 1',
('2026-03-23', 'EURCAD',
{'JPY': ['2026-03-27'], 'EUR': ['2026-03-25'], 'CAD': ['2026-03-24', '2026-03-26'], 'GBP': ['2026-03-25']}),
'2026-03-30'),
('partial repair guard 2',
('2026-02-03', 'EURCAD',
{'USD': ['2026-02-07'], 'JPY': ['2026-02-04', '2026-02-05', '2026-02-07', '2026-02-08'], 'GBP': ['2026-02-08']}),
'2026-02-05'),
('control: cross with cad', ('2026-03-02', 'EURCAD', {}), '2026-03-04'),
('control: cad usd holiday', ('2026-03-06', 'CADUSD', {'USD': ['2026-03-09']}), '2026-03-10'),
('control: yen cross', ('2026-04-28', 'GBPJPY', {'JPY': ['2026-04-29', '2026-04-30']}), '2026-05-04'),
('control: plain t+2', ('2026-03-02', 'EURUSD', {}), '2026-03-04')],
[('regression cad-settlement-lag 1',
('2026-09-17', 'CADUSD',
{'JPY': ['2026-09-22'], 'CAD': ['2026-09-18', '2026-09-20'], 'GBP': ['2026-09-20', '2026-09-21']}),
'2026-09-21'),
('regression cad-settlement-lag 2', ('2026-04-23', 'USDCAD', {'EUR': ['2026-04-24']}), '2026-04-24'),
('partial repair guard 1',
('2026-08-28', 'EURCAD',
{'USD': ['2026-08-30', '2026-08-31', '2026-09-01'],
'EUR': ['2026-08-31', '2026-09-01'],
'CAD': ['2026-08-29', '2026-08-31'],
'GBP': ['2026-08-29', '2026-09-01']}),
'2026-09-03'),
('partial repair guard 2',
('2026-03-19', 'EURCAD', {'USD': ['2026-03-21'], 'JPY': ['2026-03-20'], 'EUR': ['2026-03-20'], 'CAD': []}),
'2026-03-24'),
('control: plain t+2', ('2026-03-02', 'EURUSD', {}), '2026-03-04'),
('control: over weekend', ('2026-03-05', 'EURUSD', {}), '2026-03-09'),
('control: usd holiday t+1', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-03']}), '2026-03-04'),
('control: usd holiday on spot', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-04']}), '2026-03-05')],
[('regression cad-settlement-lag 1',
('2026-08-10', 'USDCAD',
{'JPY': ['2026-08-11', '2026-08-13'],
'EUR': ['2026-08-11', '2026-08-13', '2026-08-15'],
'GBP': ['2026-08-12', '2026-08-15']}),
'2026-08-11'),
('regression cad-settlement-lag 2',
('2026-03-30', 'CADUSD', {'EUR': ['2026-04-04'], 'GBP': ['2026-04-01', '2026-04-03']}), '2026-03-31'),
('partial repair guard 1',
('2026-06-29', 'EURCAD', {'EUR': ['2026-06-30', '2026-07-04'], 'GBP': ['2026-06-30', '2026-07-04']}), '2026-07-02'),
('partial repair guard 2',
('2026-06-05', 'EURCAD',
{'USD': ['2026-06-06', '2026-06-10'],
'EUR': ['2026-06-08', '2026-06-09'],
'CAD': ['2026-06-09'],
'GBP': ['2026-06-07', '2026-06-10']}),
'2026-06-11'),
('control: usd holiday on spot', ('2026-03-02', 'EURUSD', {'USD': ['2026-03-04']}), '2026-03-05'),
('control: cad t+1', ('2026-03-02', 'USDCAD', {}), '2026-03-03'),
('control: euro holiday t+1', ('2026-03-02', 'EURUSD', {'EUR': ['2026-03-03']}), '2026-03-05'),
('control: cross with cad', ('2026-03-02', 'EURCAD', {}), '2026-03-04')]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression cad-settlement-lag 1 | 2026-03-03 | 2026-03-03 | Passed |
| regression cad-settlement-lag 2 | 2026-07-21 | 2026-07-21 | Passed |
| partial repair guard 1 | 2026-03-03 | 2026-03-04 | Failed |
| partial repair guard 2 | 2026-02-25 | 2026-03-02 | Failed |
| control: plain t+2 | 2026-03-04 | 2026-03-04 | Passed |
| control: over weekend | 2026-03-09 | 2026-03-09 | Passed |
| control: usd holiday t+1 | 2026-03-04 | 2026-03-04 | Passed |
| control: usd holiday on spot | 2026-03-05 | 2026-03-05 | Passed |
SHA-256 / 164d98da322cc1719d47eae8d9981433541589cdf73261abd79b7a07e5f40e41
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:47:02.101550+00:00.
Case digest / f78c66a5416ae239b3084c05378212fb92a535f06a1c6354be6dcddf3362bc1f