Holding multi-currency balances introduces Foreign Exchange (FX) risk. If a platform holds 1M EUR but reports financials in USD, a 1% shift in the exchange rate alters the company's solvency without a single transaction occurring. Engineering a multi-currency ledger requires automated "Revaluation" jobs that adjust book values based on market rates, ensuring the balance sheet reflects reality.
Realized vs. Unrealized P&L
The ledger must distinguish between two types of FX impact:
Realized P&L: Occurs when a conversion happens (e.g., User swaps USD to GBP). The system records the spread revenue immediately.
Unrealized P&L: Occurs when holding foreign funds. The system snapshots the 1M EUR balance, applies the current USD rate, compares it to the "Weighted Average Cost" of that EUR, and books the difference to an Unrealized_FX_Gain_Loss equity account. This entry is often reversed and recalculated daily or monthly.
Programmatic Hedging Workflows
To mitigate risk, systems utilize automated hedging.
Micro-Hedging: Every user transaction triggers a back-to-back trade with a liquidity provider. This removes risk but adds latency and cost.
Batch/Net Hedging: The system aggregates the "Net Open Position" (e.g., Long 50k EUR) every hour and executes a single swap to neutralize exposure. This requires a robust event aggregator to calculate the net position accurately in real-time.