FA-61908 / Currency rounding and FX conversion / Member archive
Customer-facing FX amounts use nearest rounding instead of house-favourable rounding · case 03
Receivable amounts are rounded up to the nearest cent, paying customers fractions the dealer does not hold.
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.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression house-rounding-direction 1 | ["1658.31", "EUR"] | ["1658.32", "EUR"] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗