Setting default currency for a Ledger file

1,901 views
Skip to first unread message

Aggelos Orfanakos

unread,
Dec 8, 2010, 5:10:18 PM12/8/10
to Ledger
Hello.

Is there a way to set a default currency for transactions? So, instead
of typing €100, €23, etc in each transaction, you'd simply write 100,
23 etc and when something is not €, you'd explicitly write its symbol.

Thanks in advance.

John Wiegley

unread,
Dec 10, 2010, 3:02:12 PM12/10/10
to ledge...@googlegroups.com

There is no way to do this, since "commodityless" figures have their own
meaning to Ledger.

John

Simon Michael

unread,
Dec 10, 2010, 6:03:13 PM12/10/10
to ledge...@googlegroups.com
hledger allows it:

http://hledger.org/MANUAL.html#default-commodity

I guess ledger 2.x did ?

John Wiegley

unread,
Dec 10, 2010, 6:15:10 PM12/10/10
to ledge...@googlegroups.com

Nope, uncommoditized amounts have always been special. There has never.
been any "implied" commodity. The "D" directive is used to setup default
display characteristics, not a default commodity.

John

Simon Michael

unread,
Dec 10, 2010, 6:31:55 PM12/10/10
to ledge...@googlegroups.com
Interesting! I thought otherwise from "Specifies the default commodity to use, by specifying an amount in the expected
format. The entry command will use this commodity as the default when none other can be determined." in the 2.x manual.
Still, I'm happy with how I'm doing it.

John Wiegley

unread,
Dec 10, 2010, 6:35:40 PM12/10/10
to ledge...@googlegroups.com
On Dec 10, 2010, at 6:31 PM, Simon Michael wrote:

> Interesting! I thought otherwise from "Specifies the default commodity to use, by specifying an amount in the expected format. The entry command will use this commodity as the default when none other can be determined." in the 2.x manual. Still, I'm happy with how I'm doing it.

Ah, for the "entry" command, yes, it does do that. I'd forgotten. But never
for a Ledger data file.

John

Aggelos Orfanakos

unread,
Dec 14, 2010, 3:14:24 AM12/14/10
to Ledger
OK, thanks for the reply!

John Wiegley

unread,
Jan 12, 2013, 2:22:52 PM1/12/13
to ledge...@googlegroups.com
>>>>> Pavneet Arora <pavnee...@gmail.com> writes:

> John, even though you have mentioned that currency-less numbers in the
> ledger do not take on the default currency, is it possible to have generic
> commodities to be formatted with commas, and 2 decimals on the register
> report?

At present there is no support for this. Pure numbers are a special case
throughout the Ledger source code, and in fact are used in some places just
for this effect, so it wouldn't be such a simple matter to enable commodity
style formatting for them. At least not just yet.

John
Reply all
Reply to author
Forward
0 new messages