Commodity vs currency

82 views
Skip to first unread message

Martin Michlmayr

unread,
Mar 16, 2018, 12:59:19 PM3/16/18
to bean...@googlegroups.com
I believe I read that beancount uses "commodity" and "currency"
interchangeably.

But then I see:

'COMMODITY_META(str)': Get the metadata dict of the commodity directive of the currency.

'CURRENCY(Amount)': Extract the currency from an Amount.

Why are different terms used?

--
Martin Michlmayr
http://www.cyrius.com/

Martin Blais

unread,
Mar 17, 2018, 5:50:54 PM3/17/18
to Beancount
Yes, the terms have been used interchangeably, I believe, as in Ledger (historical reasons).
There's no particular reason.
Perhaps in the very beginning it wasn't clear whether those two subsets of "commodities" should be differentiated (they don't have to).
In the source code I'm /mostly/ using "currency" but it's not a nice choice, as it's not common usage for other types of commodities, e.g. stocks.
I should use "commodity" everywhere, at least in the shell and in the docs.


--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/20180316165911.uexuoie2zkyfvq2s%40jirafa.cyrius.com.
For more options, visit https://groups.google.com/d/optout.

Martin Blais

unread,
Mar 22, 2018, 8:10:25 PM3/22/18
to Martin Blais, Beancount
Actually, if I remember now, the term "commodity" was intended to be used for currencies which have at least one instance of being held at cost.
In practice this distinction never made a difference and we can treat those interchangeably.


Martin Blais

unread,
Mar 22, 2018, 8:27:47 PM3/22/18
to Martin Blais, Beancount
Here, I added aliases, you can use either:
https://bitbucket.org/blais/beancount/commits/217359e73290e957b7f36ad370e8005771f4b7d2

(In the next version of the shell, I'll clean up all the function list, the next shell version will be a major shakeup, beyond Beancount. I'll fork out the shell so it can work on other (non-Beancount) datasets, and applying it to Beancount will provide virtual tables per directive type, e.g., SELECT ... FROM transactions ...., SELECT ... FROM price ...., etc. The current shell version was always intended to be experimental - it's fairly undertested - the purpose was to find out what people find necessary and I've already been had a very liberal attitude about adding new stuff to it. Its list of functions and design is therefore somewhat less than ideal.)


Martin Michlmayr

unread,
Mar 23, 2018, 5:41:09 AM3/23/18
to bean...@googlegroups.com, Martin Blais
* Martin Blais <bl...@furius.ca> [2018-03-22 20:10]:
> Actually, if I remember now, the term "commodity" was intended to be used
> for currencies which have at least one instance of being held at cost.

That actually makes a lot of sense to me.

> In practice this distinction never made a difference and we can treat those
> interchangeably.

Reply all
Reply to author
Forward
0 new messages