currencies

Dave Peticolas dave@krondo.com
Mon, 25 Sep 2000 13:49:17 -0700


This document presents some issues with respect to GnuCash and
currency handling. A few solutions are sketched, but mainly the
purpose of this document is to elicit feedback.

For the remainder of the document, I will use 'commodity' as a
general term to refer to both currencies and securities and the
like, i.e., any unit for which accounting might be done.


The Current State of Things
===========================

Every Account in GnuCash has two commodities - the security and the
currency. The security is the basic commodity of an account or, in
other words, the quantity that is being 'counted'. The currency is the
unit used for measuring the value of the account. By convention, the
security of an account with no explicitly set security field is taken
to be the Account's currency.

An Account contains a list of Splits - the list of debits and credits
to the Account. A Split contains a share quantity - the number of
units of the security which were added or subtracted from the
Account's total. Currently, a Split also contains a price which will
convert the share quantity into units of the Account's currency.
However, GnuCash will soon stop recording prices in Splits and instead
record 'values', i.e., quantities in the Account's currency. Below, we
will assume that Splits contain share quantities and value quantities.

Examples, for typical accounts in the US:

Bank account
------------
 Currency: USD
 Security: blank (USD)

 This is the most typical currency/security configuration, in which
 the basic commodity of the account and the unit of valuation are the
 same.

 Typical Split: Add 50 USD shares worth 50 USD.

Stock account
-------------
 Currency: USD
 Security: IBM

 This is the typical configuration of a stock account. The basic commodity
 is the stock shares being held, while the currency is the commodity used
 in buying and selling the stock.

 Typical Split: Add 3 IBM shares worth 300 USD.


Currency account
----------------
 Currency: USD
 Security: DEM

 This is a configuration of a currency account used to convert between USD
 and DEM. There is no real difference between Currency accounts and Stock
 accounts.

 Typical Split: Add 3 DEM worth 6.70 USD.

Gnucash allows you to pick any currency you want for an Account and,
for Stock and Currency accounts, any security you want.

For transactions, GnuCash requires that every transaction has a
'common commodity', which means that there is a commodity (either the
currency or security) which every split in a transaction possesses.
Transactions must be balanced using the common commodity.


Problems
========

Currency Accounts
-----------------

Currency Accounts are annoying. Users don't understand them and they
force a cumbersome 'extra step' in multi-currency transactions. We
would like to dispense with the need for currency accounts.


Balancing Issues
----------------

A possibly more serious problem has to do with maintaining balanced
accounts. When users have accounts in different currencies, it is
not at all clear how to maintain the accounting equation A = L + E.

For example, suppose you start out with the following:

Account  Type     Currency   Security
-------  ----     --------   --------
A        Bank     USD        USD
B        Equity   USD        USD

And you have the following transaction:

Transaction 0:    A   50USD (50USD)
                  C                  50USD (50USD)

Thus, A = L + E --> 50 USD = 50 USD.

Now suppose you add:

Account  Type      Currency   Security
-------  ----      --------   --------
C        Currency  USD        DEM
D        Bank      DEM        DEM
E        Cash      DEM        DEM

And you create the following Transactions, where X (Y), means share
quantity X and value Y.

Transaction 1:    A                 25USD (25USD)
                  C   11DEM (25USD)

Transaction 1 has a common commodity of USD, and is balanced according
to that commodity. Account C contains 11 DEM.

Transaction 2:    C                 11DEM (25USD)
                  D   11DEM (11DEM)

Transaction 2 has a common commodity of DEM, and is balanced according
to that commodity. Account C is now empty and Account D has 11 DEM.

Transaction 3:    D                 11DEM (11DEM)
                  E   11DEM (11DEM)

Now Account D is empty and Account E has 11 DEM.

Every transaction was balanced according to GnuCash's convention, but
now the accounting equation is:

A = L + E --> (25 USD, 11 DEM) = 50 USD

Thus, the balance sheet no longer 'adds up' in the sense that both
sides are expressed in the same unit(s). Further, it is not possible
using the information provided to convert the DEM to USD, since there
is no link between Transaction 3 and Transaction 2, i.e. between the
number of USD that were paid for the 11DEM.


What to Do?
===========

Common Commodity
----------------

One solution would be to require that every GnuCash data file
use a single user-selected commodity for valuation purposes.
Thus, Accounts could still have any security the user wanted,
but every Account would have the same currency, i.e., the same
unit for valuation purposes.


Currencies in Splits
--------------------

If we associated currencies (values) with Splits, instead of
Accounts, then the need for Currency accounts would disappear.
In that case, Accounts would only have one commodity, the
commodity being counted. In this scheme, Transactions 1 & 2
would be replaced by:

Transaction: A                 25USD (25USD)
             D  11DEM (25USD)


Some Super-General Solution That Solves Everything
--------------------------------------------------

I don't know what this would be, but maybe there is one :)


Just Improve the UI
-------------------

Another solution would be to keep the model explained above, but
improve the interface so that users would not have to work with
currency accounts directly.

We would appreciate any comments you have.

dave