Lesson 21Advanced and capstonesAdvanced

Multi-currency FX swap

Each currency is its own balanced book. Conversions take two entries.

By Solomon Ajayi · Free to read, no signup

A user has ₦20,000 in their NGN wallet and wants to convert ₦15,000 of it to USD. Your quoted rate is ₦1,500 per USD ($10 gross). You charge a 1% FX margin: user receives $9.90, you keep $0.10. The lesson: you CANNOT put both sides of this in one journal entry, debits in NGN and credits in USD don't sum to anything meaningful. Each currency is its own balanced book, linked by FX Clearing accounts.

Double-entry's core invariant is that debits equal credits, but that only means something when both sides are measured in the same unit. Fifteen thousand naira and ten dollars are different units; subtracting one from the other gives you a number with no meaning. So the rule that has carried every lesson so far quietly assumes a single currency, and a conversion is precisely where that assumption breaks.

The fix is to treat each currency as its own self-contained book that must balance on its own. A conversion becomes two entries, not one. The NGN side debits the user's naira wallet and credits an FX Clearing NGN account, balanced entirely in naira. The USD side debits an FX Clearing USD account and credits the user's dollar wallet plus your margin revenue, balanced entirely in dollars. The two clearing accounts are the bridge that links the books without ever mixing currencies inside a single entry.

Splitting at the clearing accounts also gives FX risk somewhere to live. Between booking the conversion and actually sourcing the dollars, the spot rate moves, so the NGN and USD clearing balances drift apart in value. At end of day you revalue them at the current rate, and the gap becomes an FX gain or loss on your P&L. Without the clearing accounts there is nowhere for that drift to surface, so it hides inside your wallets.

Worked example, step by step

Seed: user has ₦20,000 in their NGN wallet

Before any FX activity, the user already has ₦20,000 of NGN balance. We seed it from your NGN Treasury.

Seed NGN wallet ₦20,000
AccountDebitCredit
NGN Treasury (1200)₦20,000.00
User NGN Wallet (2010)₦20,000.00

Standard NGN funding entry. NGN Treasury (asset, NGN) UP. User NGN Wallet (liability, NGN) UP. Both sides in NGN. Internally balanced.

NGN side of the conversion (user gives up ₦15,000)

User clicks Convert. ₦15,000 leaves their NGN wallet. We're holding it on the NGN side of an FX bridge until the USD side settles.

FX swap: NGN side ₦15,000
AccountDebitCredit
User NGN Wallet (2010)₦15,000.00
FX Clearing NGN (2900)₦15,000.00

User NGN Wallet (liability) DOWN ₦15,000. FX Clearing NGN (liability) UP ₦15,000, we now owe the conversion equivalent in USD. Notice: this entry is internally balanced in NGN. It does NOT touch any USD account. The USD side is a SEPARATE entry.

USD side of the conversion (user receives $9.90, you keep $0.10)

The USD side settles. At the gross conversion rate, ₦15,000 = $10. You credit $9.90 to the user and keep $0.10 as FX margin revenue.

FX swap: USD side $10.00
AccountDebitCredit
FX Clearing USD (2910)$10.00
User USD Wallet (2020)$9.90
FX Margin Revenue (4200)$0.10

FX Clearing USD (asset) UP $10 (cents: 1,000). User USD Wallet (liability) UP $9.90 (cents: 990). FX Margin Revenue (income) UP $0.10 (cents: 10). All three lines in USD. Internally balanced in USD. The two FX Clearing accounts (NGN and USD) now hold the conversion bridge, at end of day they get revalued at the spot rate, and any drift becomes FX gain or loss.

Takeaway

Each currency lives in its own balanced book. A cross-currency transaction requires TWO journal entries: one per currency, linked by FX Clearing accounts that act as a bridge. Engineers who try to mix currencies in a single entry violate the foundational invariant, debits and credits in different currencies don't sum. FX Clearing accounts get revalued daily; any drift from the original rate becomes FX gain or loss on your P&L.

Practice this on a real ledger

Reading is half of it. Open this lesson in the lab to post the entries yourself against a real Postgres-backed double-entry ledger, with the validation on. Free, your sandbox is yours.

More in this section

Search lessons

Type to find any of the 85 lessons. Press Enter to open.