FA-62326 / Currency rounding and FX conversion / Open access
The base and quote deposit rates are swapped in the parity formula · case 01
A higher-yielding quote currency produces forward discount points instead of premium points.
ROOT CAUSE
The numerator uses the base rate and the denominator the quote rate.
THE FAILURE
The numerator uses the base rate and the denominator the quote rate.
Unsuccessful approach: A linear rate-difference approximation has the right sign but the wrong magnitude.
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 + rb * days / basis[base]) / (1 + rq * days / basis[quote])
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 parity-orientation 1', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('regression parity-orientation 2', ('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']),
('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'])],
[('regression parity-orientation 1', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('regression parity-orientation 2', ('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']),
('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85'])],
[('regression parity-orientation 1', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('regression parity-orientation 2', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
('partial repair guard 2', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
('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 parity-orientation 1', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
('regression parity-orientation 2', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
('partial repair guard 2', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
('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 parity-orientation 1', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
('regression parity-orientation 2', ('AUDJPY', '5.9212', '0.74', '1.63', 182), ['5.948', '2.68']),
('partial repair guard 2', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression parity-orientation 1 | ['1.06156', '-184.44'] | ['1.09876', '187.64'] | Failed |
| regression parity-orientation 2 | ['153.750', '375.00'] | ['146.341', '-365.85'] | Failed |
| control: sterling dollar | ['1.26462', '-3.85'] | ['1.26538', '3.85'] | Failed |
| control: aussie yen | ['99.110', '34.49'] | ['98.421', '-34.37'] | Failed |
| control: dollar cad | ['1.36182', '41.24'] | ['1.35359', '-41.12'] | Failed |
| control: euro franc | ['0.95162', '4.16'] | ['0.95078', '-4.16'] | Failed |
SHA-256 / 0f0bfa156914435cbe8b1da6fdb8c0e4a74744de78fc02b08476238333b34c9e
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 - rb) * days / basis[quote])
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 parity-orientation 1', ('EURUSD', '1.0800', '3.60', '5.40', 360), ['1.09876', '187.64']),
('regression parity-orientation 2', ('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']),
('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'])],
[('regression parity-orientation 1', ('GBPUSD', '1.2650', '5.25', '5.30', 91), ['1.26538', '3.85']),
('regression parity-orientation 2', ('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']),
('control: dollar yen half year', ('USDJPY', '150.00', '5.00', '0.00', 180), ['146.341', '-365.85'])],
[('regression parity-orientation 1', ('USDCAD', '1.3577', '5.30', '4.75', 182), ['1.35359', '-41.12']),
('regression parity-orientation 2', ('EURCHF', '0.9512', '3.75', '1.50', 7), ['0.95078', '-4.16']),
('partial repair guard 2', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
('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 parity-orientation 1', ('USDCAD', '128.6366', '0.30', '6.36', 365), ['136.40300', '77663.95']),
('regression parity-orientation 2', ('AUDJPY', '54.4548', '0.49', '4.06', 91), ['54.947', '49.17']),
('partial repair guard 2', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
('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 parity-orientation 1', ('GBPUSD', '17.5535', '4.72', '0.07', 182), ['17.15594', '-3975.59']),
('regression parity-orientation 2', ('AUDJPY', '5.9212', '0.74', '1.63', 182), ['5.948', '2.68']),
('partial repair guard 2', ('GBPJPY', '137.7426', '3.56', '5.48', 1), ['137.750', '0.75']),
('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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression parity-orientation 1 | ['1.09944', '194.40'] | ['1.09876', '187.64'] | Failed |
| regression parity-orientation 2 | ['146.250', '-375.00'] | ['146.341', '-365.85'] | Failed |
| control: sterling dollar | ['1.26516', '1.60'] | ['1.26538', '3.85'] | Failed |
| control: aussie yen | ['98.415', '-34.98'] | ['98.421', '-34.37'] | Failed |
| control: dollar cad | ['1.35398', '-37.23'] | ['1.35359', '-41.12'] | Failed |
| control: euro franc | ['0.95078', '-4.16'] | ['0.95078', '-4.16'] | Passed |
SHA-256 / 0b7ae53958d3d0565190d3efec90f395ce391495bba6986c55f65e57cc2a258a
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 6 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:03.670041+00:00.
Case digest / e5d399d9265292ac51d3909bd41d134d894c1191583cc07937b91a7963e5cb05