About the <trn:currency> tag in the GnuCash file

Derek Atkins warlord at MIT.EDU
Tue Mar 5 12:41:34 EST 2013


rhill <rhill at raymondhill.net> writes:

> I am trying to understand as best as I can the exact meaning of all the
> fields in the GnuCash file, so I can use the content of the file into an
> (experimental so far) app.
> I see that each transaction is set into a specific currency, this can be
> seen through the <trn:currency> XML field. I would like to understand
> why the field has been named "currency" as opposed to "commodity". My
> understanding was that the field *had* to be set to a value which is a
> subset of the commodities set, the "currency" commodities specifically
> (the ones which space is "ISO4217")

Yes, it is supposed to be an actual "common currency", which binds each
of the "Split Values".  The transaction does its double-entry balancing
using the Split Value in the transaction currency.  The exchange-rate
dialog also uses the transaction currency to map from the "Split Amount"
(which is denoted in the Split Account's Commodity) to the Split Value.

> However, looking at a particular file, which contains over 14,000
> transactions, I noticed there are two exceptions: there are two
> transactions (which were entered very recently) where the currency is
> not really an ISO4217 commodity, but are a STOCK commodity. So that kind
> of invalidate my prior understanding, as it appears that the field
> <trn:currency> can refer to any commodity, not just the ones from the
> ISO4217 space.

This is a bug.  How were these transactions created?  You should never
have a transaction with a non-currency "common currency".

> This puzzles me, especially that one of the two transactions has a split
> which describes the movement of an amount in a specific ISO4217 currency
> (I would have expected the <trn:currency> to be set to that currency),
> and I would like for someone to really confirm that indeed, the
> <trn:currency> field can refer to more than just an ISO4217 commodity,
> or whether it is unexpected that it does so in only two transactions out
> of over 14,000 in this particular file.

Indeed.  How were these transactions created?


       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available

More information about the gnucash-devel mailing list