Skip to content

Multiple currencies with currency trading accounts

Pranesh Prakash edited this page Apr 14, 2024 · 8 revisions

Currency trading accounts allows one to keep track of currency gains and losses at any instant of time.
This means that for any given period, the balance sheet will change by the profit earned during that period.
For a fuller description of currency trading accounts and their motivation see here. Do note that though we talk about "currency" trading accounts here, this same technique works for all commodities, not just currencies.

We'll start by banking 10,000 Australian dollars.

2009/01/01 First sale
    Assets:Bank                              10000.00 AUD
    Income:Sales                            -10000.00 AUD


Now on the first of February we'll receive a bill 1,000 euros for Marketing.
The key point is that we route all of our currency trades through the currency trading accounts, and record them in sub-accounts like "AUD-EUR:EUR" and "AUD-EUR:AUD" to denote which currency pair are being converted from and to.

P 2009/02/01 EUR 2.00 AUD
2009/02/01 Marketing (1 EUR = 2.00 AUD)
    Expenses:Marketing                            2000.00 AUD
    Equity:Trading:Currency:AUD-EUR:AUD          -2000.00 AUD
    Equity:Trading:Currency:AUD-EUR:EUR           1000.00 EUR
    Liabilities:Accounts-Payable:EUR             -1000.00 EUR


Now on the 15th of February the Euro will only be worth $1.90.

P 2009/02/15 EUR 1.90 AUD


Now let's look at our balance sheet with the Euro liability transformed into Australian dollars.
Note that "-X" is only supported in ledger 3 or later.

$ ledger -X AUD -f invoice.dat bal assets liabilities
        10000.00 AUD  Assets:Bank
        -1900.00 AUD  Liabilities:Accounts-Payable:EUR
--------------------
         8100.00 AUD


and the income statement

$ ledger -X AUD -f /tmp/temp.j bal income expenses currency
         -100.00 AUD  Equity:Trading:Currency:AUD-EUR
         1900.00 AUD    AUD
        -2000.00 AUD    EUR
         2000.00 AUD  Expenses:Marketing
       -10000.00 AUD  Income:Sales
--------------------
        -8100.00 AUD


The key point to note is that our "Equity:Trading:Currency:AUD-EUR" account has a profit of 100.00 AUD in it.
Note that this currency gain is currently an unrealized gain.

On the 1st of March we'll pay this invoice, except the Euro will now be worth 1.95 AUD.
Again note that route all of our currency conversions through our trading account.

P 2009/03/01 EUR 1.95 AUD
2009/03/01 Pay Marketing Invoice (1 EUR = 1.95 AUD)
    Liabilities:Accounts-Payable:EUR          1000.00 EUR
    Equity:Trading:Currency:AUD-EUR:AUD      -1000.00 EUR
    Equity:Trading:Currency:AUD-EUR:EUR       1950.00 AUD
    Assets:Bank                              -1950.00 AUD

Here is the balance sheet

$ ledger -X AUD -f invoice.dat bal assets liabilities
         8050.00 AUD  Assets:Bank


and the income statement

$ ledger -X AUD -f invoice.dat bal income expenses currency
          -50.00 AUD  Equity:Trading:Currency:AUD-EUR:EUR
         2000.00 AUD  Expenses:Marketing
       -10000.00 AUD  Income:Sales
--------------------
        -8050.00 AUD

As you can see our currency gain (unrealized) has fallen from 100.00 AUD to 50.00 AUD as the exchange rate has moved again.
However at all times our balance sheet matched our income statement.

Note that the currency "gain" is denoted by a negative number, since it is a kind of income, and increases in income are negative. If you want to report the gain in the income statement as a positive number, then use the --invert option:

$ ledger -X AUD -f invoice.dat bal income expenses currency --invert
           50.00 AUD  Equity:Trading:Currency:AUD-EUR:EUR
        -2000.00 AUD  Expenses:Marketing
        10000.00 AUD  Income:Sales
--------------------
         8050.00 AUD

Clone this wiki locally