tutorial on multi-currency accounting

Peter Selinger selinger at mathstat.dal.ca
Tue Mar 6 23:29:04 EST 2007


Mike Alexander wrote:
> 
> --On March 6, 2007 4:10:33 PM -0500 Chris Shoemaker 
> <c.shoemaker at cox.net> wrote:
> 
> >> Here's a brief summary of what I've done so far (all of these
> >> changes  are under control of a new preference and things work as
> >> before if it  is off):
> >>
> >> - Changed xaccTransGetImbalance to return a list of all the
> >> imbalances  in the transaction.  The list will contain an entry for
> >> each commodity  that is not balanced or for the transaction value if
> >> the new preference  is off and it is unbalanced.  This required
> >> adding a new data type (or  at least I couldn't find an existing
> >> data type for it) similar to the  commodity-collector used in Scheme
> >> code.  The old version is now called  xaccTransGetImbalanceValue and
> >> is still used in a few places.
> >>
> >> - xaccTransScrubImbalance now scrubs the transaction two ways.  It
> >> makes sure the value is balanced, and it makes sure that the amounts
> >> balance separately for each commodity in the transaction.  This
> >> makes  capital gain splits as created by scrubbing lots unnecessary,
> >> although  existing capital gains splits won't hurt anything.
> >
> > I assume this is done by auto-creating currency-accounts?
> 
> You mean the old 1.8 currency accounts?  No, I don't use them.  I don't 
> recall what they were like and I'm not sure if it's a good idea to 
> recycle them for this purpose or not.  Right now it creates top level 
> Imbalance-xxx accounts for this just like it does for value imbalances. 
> I will probably change this to look for a Currency place-holder account 
> and find (or create) an income account below this as suggested in 
> Peter's document.

I wonder whether, in this particular instance, an Imbalance account or
a Currency account (as defined in my document) is more appropriate. 

Is the purpose to "fix" a transaction that is not balanced? By putting
it into a Currency account, you would be effectively inventing an
exchange that may not have actually have taken place, and an (implied)
exchange rate. By putting it under Imbalance, you are asking the user
to fix it.

On the other hand, if the purpose is to "convert" a set of accounts
that used to use the old currency method, and that was already
balanced under the old system, then putting these as Imbalances would
create a huge mess for the user to clean up by hand.  In this case, it
would be better to create the correct splits into Currency accounts,
perhaps using the exchange rate info that was saved with the
transaction.

-- Peter


More information about the gnucash-devel mailing list