FAILURE MAP
← Case archive

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

Every currency's deposit rate is scaled on a 360-day basis · case 01

Sterling and Canadian-dollar forwards are mispriced by the basis difference.

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

ROOT CAUSE

A single 360-day denominator is used for both legs.

VERIFIED REPAIR

Use each currency's own money-market day basis.

Unsuccessful approach: Using the base currency's basis for both legs still misprices mixed-basis pairs.

Case contract

solve(pair, spot, base_pct, quote_pct, days): covered-interest-parity outright F = S*(1 + rq*days/Bq)/(1 + rb*days/Bb) with money-market bases GBP, AUD, CAD 365 and USD, EUR, JPY, CHF 360; rates are given in percent. The pip exponent is 2 for JPY-quoted pairs, else 4. Return [F rounded half-even to pip exponent + 1 decimals, forward points = (F - S)*10**pip_exp rounded half-even to 2 decimals] as strings, both computed from the exact F.

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(pair, spot, base_pct, quote_pct, days):
    basis = {'USD': 360, 'EUR': 360, 'JPY': 360, 'CHF': 360, 'GBP': 365, 'AUD': 365, 'CAD': 365}
    base, quote = pair[:3], pair[3:]
    S = Decimal(spot)
    rb, rq = Decimal(base_pct) / 100, Decimal(quote_pct) / 100
    F = S * (1 + rq * days / 360) / (1 + rb * days / 360)
    pe = 2 if quote == 'JPY' else 4
    pts = ((F - S) * Decimal(10) ** pe).quantize(Decimal('0.01'), rounding=ROUND_HALF_EVEN)
    return [format(F.quantize(Decimal(1).scaleb(-(pe + 1)), rounding=ROUND_HALF_EVEN), 'f'), format(pts, 'f')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression money-market-basis 1', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('regression money-market-basis 2', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16'])],
 [('regression money-market-basis 1', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('regression money-market-basis 2', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
  ('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85'])],
 [('regression money-market-basis 1', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
  ('regression money-market-basis 2', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])],
 [('regression money-market-basis 1', ('AUDJPY', '5.9212', '0.74', '1.63', 182), ['5.948', '2.68']),
  ('regression money-market-basis 2', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64'])],
 [('regression money-market-basis 1', ('GBPJPY', '5.4304', '2.54', '5.76', 365), ['5.605', '17.48']),
  ('regression money-market-basis 2', ('USDCAD', '90.4307', '5.79', '0.97', 365), ['86.24494', '-41857.60']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])]]
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 money-market-basis 1['1.26516', '1.58']['1.26538', '3.85']Failed
regression money-market-basis 2['1.35402', '-36.77']['1.35359', '-41.12']Failed
control: euro dollar year['1.09876', '187.64']['1.09876', '187.64']Passed
control: dollar yen half year['146.341', '-365.85']['146.341', '-365.85']Passed
control: aussie yen['98.416', '-34.85']['98.421', '-34.37']Failed
control: euro franc['0.95078', '-4.16']['0.95078', '-4.16']Passed

SHA-256 / f68ad7f5b98f93a56b0d9027aed4a183838626129e57366adcd45546a80b0a28

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(pair, spot, base_pct, quote_pct, days):
    basis = {'USD': 360, 'EUR': 360, 'JPY': 360, 'CHF': 360, 'GBP': 365, 'AUD': 365, 'CAD': 365}
    base, quote = pair[:3], pair[3:]
    S = Decimal(spot)
    rb, rq = Decimal(base_pct) / 100, Decimal(quote_pct) / 100
    F = S * (1 + rq * days / basis[base]) / (1 + rb * days / basis[base])
    pe = 2 if quote == 'JPY' else 4
    pts = ((F - S) * Decimal(10) ** pe).quantize(Decimal('0.01'), rounding=ROUND_HALF_EVEN)
    return [format(F.quantize(Decimal(1).scaleb(-(pe + 1)), rounding=ROUND_HALF_EVEN), 'f'), format(pts, 'f')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression money-market-basis 1', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('regression money-market-basis 2', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16'])],
 [('regression money-market-basis 1', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('regression money-market-basis 2', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
  ('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85'])],
 [('regression money-market-basis 1', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
  ('regression money-market-basis 2', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])],
 [('regression money-market-basis 1', ('AUDJPY', '5.9212', '0.74', '1.63', 182), ['5.948', '2.68']),
  ('regression money-market-basis 2', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64'])],
 [('regression money-market-basis 1', ('GBPJPY', '5.4304', '2.54', '5.76', 365), ['5.605', '17.48']),
  ('regression money-market-basis 2', ('USDCAD', '90.4307', '5.79', '0.97', 365), ['86.24494', '-41857.60']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])]]
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 money-market-basis 1['1.26516', '1.56']['1.26538', '3.85']Failed
regression money-market-basis 2['1.35402', '-36.77']['1.35359', '-41.12']Failed
control: euro dollar year['1.09876', '187.64']['1.09876', '187.64']Passed
control: dollar yen half year['146.341', '-365.85']['146.341', '-365.85']Passed
control: aussie yen['98.421', '-34.38']['98.421', '-34.37']Failed
control: euro franc['0.95078', '-4.16']['0.95078', '-4.16']Passed

SHA-256 / ea5f92bbb0afa8a2f376056a9a22d375168a21546383dc29932e28ab514cba96

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(pair, spot, base_pct, quote_pct, days):
    basis = {'USD': 360, 'EUR': 360, 'JPY': 360, 'CHF': 360, 'GBP': 365, 'AUD': 365, 'CAD': 365}
    base, quote = pair[:3], pair[3:]
    S = Decimal(spot)
    rb, rq = Decimal(base_pct) / 100, Decimal(quote_pct) / 100
    F = S * (1 + rq * days / basis[quote]) / (1 + rb * days / basis[base])
    pe = 2 if quote == 'JPY' else 4
    pts = ((F - S) * Decimal(10) ** pe).quantize(Decimal('0.01'), rounding=ROUND_HALF_EVEN)
    return [format(F.quantize(Decimal(1).scaleb(-(pe + 1)), rounding=ROUND_HALF_EVEN), 'f'), format(pts, 'f')]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression money-market-basis 1', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('regression money-market-basis 2', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16'])],
 [('regression money-market-basis 1', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('regression money-market-basis 2', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
  ('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85'])],
 [('regression money-market-basis 1', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
  ('regression money-market-basis 2', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])],
 [('regression money-market-basis 1', ('AUDJPY', '5.9212', '0.74', '1.63', 182), ['5.948', '2.68']),
  ('regression money-market-basis 2', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37']),
  ('control: dollar cad', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
  ('control: euro franc', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64'])],
 [('regression money-market-basis 1', ('GBPJPY', '5.4304', '2.54', '5.76', 365), ['5.605', '17.48']),
  ('regression money-market-basis 2', ('USDCAD', '90.4307', '5.79', '0.97', 365), ['86.24494', '-41857.60']),
  ('control: euro dollar year', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
  ('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85']),
  ('control: sterling dollar', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
  ('control: aussie yen', ('AUDJPY', '98.765', '4.35', '0.10', 30), ['98.421', '-34.37'])]]
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 money-market-basis 1['1.26538', '3.85']['1.26538', '3.85']Passed
regression money-market-basis 2['1.35359', '-41.12']['1.35359', '-41.12']Passed
control: euro dollar year['1.09876', '187.64']['1.09876', '187.64']Passed
control: dollar yen half year['146.341', '-365.85']['146.341', '-365.85']Passed
control: aussie yen['98.421', '-34.37']['98.421', '-34.37']Passed
control: euro franc['0.95078', '-4.16']['0.95078', '-4.16']Passed

SHA-256 / 0f70fc98fccbcce3df19a27e5be21c66a85eca33c3942fad457c7dbad1b165b7

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:03.491395+00:00.

Case digest / 0c0e027d1fe219a51f3b7645b3fb2905d7ce8be00adf147259ea74ddafd76b2c