FA-58004 / Double-entry ledger accounting / Member archive
Foreign currency period-end revaluation: bid and ask selection · case 04
Foreign payables are understated at period end.
Case contract
x = {'bid': [num, den], 'ask': [num, den], 'accounts': [[name, 'asset'|'liability', monetary, foreign units, carried home cents]]}. Monetary assets are revalued at the bid rate and monetary liabilities at the ask rate: home = foreign * num / den rounded half-up per account. Non-monetary accounts keep their carried amount. Unrealized gain sums (new - carried) for assets and (carried - new) for liabilities. Return {'balances': [[name, home]], 'unrealized_gain'}.
Why this case matters
Ledger software must keep debits equal to credits and apply normal-balance, period and cutoff rules exactly; small sign or boundary slips silently misstate financial statements.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: bid and ask selection | {"balances": [["a0", 1499], ["a1", 3], ["a2", 8]], "unrealized_gain": -997} | {"balances": [["a0", 1998], ["a1", 3], ["a2", 10]], "unrealized_gain": -1498} | 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 ↗