Converting Currency

41 views
Skip to first unread message

Tavis Ormandy

unread,
Sep 5, 2025, 12:01:38 PMSep 5
to ledge...@googlegroups.com
There was an interesting conversation on the subreddit yesterday about
currency conversion, but I don't really know if there is a good
answer.

I spend money in two currencies and sometimes have to convert between
them, I think there are two basic ways to record this.

This is the way I usually do it:

2025/09/04 * Convert Currency
Assets:Bank $135 @@ £100
Assets:Bank

You just converted £100 to $135, easy. IIUC, hledger users
prefer something like this because there are built-in tools to handle
it:

2025/09/04 * Convert Currency
Assets:Bank $135
Assets:Bank -£100
Equity:Conversion

There are problems with both solutions. The problem with the @@ syntax
is that there is no way to mark a commodity as fungible, so each
conversion will create new lots.

Example:

$ cat test.ldg
2025/09/04 * Convert Currency
Assets:Bank $135.00 @@ £100
Assets:Bank
2025/09/04 * Baker
Expenses:Food $5 ; Sandwich
Assets:Bank

$ ledger --file test.ldg bal --lots ^Assets:Bank
$-5.00
$135.00 {£0.74074074} [04-Sep-2025] Assets:Bank

Nobody records which lot they used to buy a sandwich, so you get stuck
with these useless lots that mess up various reports.

I know one workaround, you can strip lot annotations and make them
fungible like this:

$ cat test.ldg
2025/09/04 * Convert Currency
Assets:Bank $135.00 @@ £100
Assets:Bank -$135.00 {{£100}} [2025-09-04] @ $1
Assets:Bank
2025/09/04 * Baker
Expenses:Food $5 ; Sandwich
Assets:Bank

$ ledger --file test.ldg bal --lots ^Assets:Bank
$130.00 Assets:Bank


It's kinda ugly though, I wish there was a commodity option! Maybe
something like this?

commodity $
format $1,000.00
alias USD
default
fungible

I guess someone might actually trade currencies *and* spend them... so
you want some lots to be non-fungible for tax purposes. I guess you
could use seperate commodities, like USD and FOREX.USD?

I'm not a fan of the Equity:Conversion solution, the conversion isn't
recorded, it's just stuffed in there out of the way... it doesn't
feel correct to me and I think probably breaks basis/historical/gain
reports?

I don't know, what do other people do?

Tavis.


--
_o) $ lynx lock.cmpxchg8b.com
/\\ _o) _o) $ finger tav...@sdf.org
_\_V _( ) _( ) @taviso

John Wiegley

unread,
Sep 6, 2025, 10:11:35 PMSep 6
to Tavis Ormandy, ledge...@googlegroups.com
>>>>> "TO" == Tavis Ormandy <tav...@gmail.com> writes:

TO> $ ledger --file test.ldg bal --lots ^Assets:Bank
TO> $-5.00
TO> $135.00 {£0.74074074} [04-Sep-2025] Assets:Bank

Hmm… interesting question. Parts of the idea behind --lots is that you can use
--lot-notes if you only want the notes, or --lot-dates, etc. If you don’t care
about lot data, you shouldn’t need to see it. It IS, however, a fact that you
exchanged assets at a cost basis, which could have tax implications, etc. So
Ledger just tracks all the data, and leaves it up to you to craft the report
you want.

Mainly lots are being recorded so that when you convert back, it can
auto-generate a capital gain/loss transaction for you. But if you *never* want
that, I’m not quite sure what Ledger should do. This is the most basic form of
“I don’t track costs”:

2025/09/04 * Convert Currency
Assets:Bank £100.00
Assets:Bank -$135.00

But it sounds like what you want is for one quantity to “transform” into the
other, without recording the details of the transformation. The main problem
here is that this will allow assets to “come into being from the aether” if
the value of pounds goes up and you transfer back to the tune of $145… This is
never allowed by double-entry, and would need a balancing transaction from
Equity to be lawful, hence the hledger approach…

John

Tavis Ormandy

unread,
Sep 6, 2025, 11:02:16 PMSep 6
to ledge...@googlegroups.com
Thanks for taking the time to think about it John!! I appreciate it :)

On 2025-09-07, John Wiegley wrote:
>>>>>> "TO" == Tavis Ormandy <tav...@gmail.com> writes:
>
>TO> $ ledger --file test.ldg bal --lots ^Assets:Bank
>TO> $-5.00
>TO> $135.00 {£0.74074074} [04-Sep-2025] Assets:Bank
>
> Hmm… interesting question. Parts of the idea behind --lots is that you can use
> --lot-notes if you only want the notes, or --lot-dates, etc. If you don’t care
> about lot data, you shouldn’t need to see it. It IS, however, a fact that you
> exchanged assets at a cost basis, which could have tax implications, etc. So
> Ledger just tracks all the data, and leaves it up to you to craft the report
> you want.
>

Yes agreed, but when you swap $ for € at the airport on vacation, it feels
like there should be a way to encode what you're doing.

I just looked up the tax rules, in the UK the rule is:

> A gain on the disposal of foreign currency acquired by an
> individual for the personal expenditure outside the United Kingdom of
> themselves and their family or dependents is not a chargeable gain

The rules are similar in the US, except there is a cap of $200 gain per
transaction before it's reportable.

I think this matches how people intuitively treat currency conversion:
unless you're a forex trader, it's not a commodity sale.

> Mainly lots are being recorded so that when you convert back, it can
> auto-generate a capital gain/loss transaction for you. But if you *never* want
> that, I’m not quite sure what Ledger should do. This is the most basic form of
> “I don’t track costs”:
>
> 2025/09/04 * Convert Currency
> Assets:Bank £100.00
> Assets:Bank -$135.00
>

Hmm, but this will implicitly create lots too, no? This seems
funtionally identical to £100 @@ $135.

> But it sounds like what you want is for one quantity to “transform” into the
> other, without recording the details of the transformation.

I don't know. When you sell a share of APPL stock, you don't record
that the $10 you receive from your broker came from that sale -- it's
the same as every dollar.

Why when you sell $1 for a £1 is that different?

I think the answer is that fungible currencies are special here, the tax
code recognizes this with special treatment, and people consider them
different to commodities.

I'm not a finance guy, maybe I don't have the right language to articulate this :)

> The main problem
> here is that this will allow assets to “come into being from the aether” if
> the value of pounds goes up and you transfer back to the tune of $145… This is
> never allowed by double-entry, and would need a balancing transaction from
> Equity to be lawful, hence the hledger approach…
>
> John
>

Not sure this is true... isn't the hledger approach worse? It just
stuffs them into a hidden account so you can't see them... it just hides
the messy problem under a rug :)

Tavis Ormandy

unread,
Sep 6, 2025, 11:24:26 PMSep 6
to ledge...@googlegroups.com
> On 2025-09-07, John Wiegley wrote:
>> The main problem
>> here is that this will allow assets to “come into being from the aether” if
>> the value of pounds goes up and you transfer back to the tune of $145… This is
>> never allowed by double-entry, and would need a balancing transaction from
>> Equity to be lawful, hence the hledger approach…

I just realized... I can demonstrate that this doesn't violate any double-entry rules.

You can launder commodities through two currencies, e.g.

2025/09/04 * Convert Currency
Assets:Broker 1 APPL @ £100.00
Assets:Bank

2025/09/05 * Convert Currency
Assets:Broker -1 APPL {£100} [2025-09-04] @ $100
Assets:Bank

Now you have $100 dollars with no lot annotation, this will pass all checks.

This is basically just a messier way of doing the workaround I mentioned earlier.

I don't think this is a bug, it just would be nice to do it without the extra step :)

John Wiegley

unread,
Sep 7, 2025, 5:08:30 PMSep 7
to Tavis Ormandy, ledge...@googlegroups.com
>>>>> "TO" == Tavis Ormandy <tav...@gmail.com> writes:

TO> You can launder commodities through two currencies, e.g.

TO> 2025/09/04 * Convert Currency
TO> Assets:Broker 1 APPL @ £100.00
TO> Assets:Bank

TO> 2025/09/05 * Convert Currency
TO> Assets:Broker -1 APPL {£100} [2025-09-04] @ $100
TO> Assets:Bank

Ah, maybe we could add a feature to do some auto-laundering for you? Would you
mind creating a GitHub issue with your expected input and output, and include
this example as a means of manual implementation?

Thank you!

John

Simon Michael

unread,
Sep 21, 2025, 1:27:58 PM (11 days ago) Sep 21
to ledge...@googlegroups.com
On 2025-09-06 20:02, Tavis Ormandy wrote:
> I think the answer is that fungible currencies are special here, the tax
> code recognizes this with special treatment, and people consider them
> different to commodities.

I often wonder if the tracking of lots should be enabled by

1. Special syntax in each entry (as in Beancount and Ledger)
2. A setting on the commodity
3. A setting on the account(s) involved
4. A combination of these..



Reply all
Reply to author
Forward
0 new messages