Understanding primary commodities

54 views
Skip to first unread message

POliveira

unread,
Dec 7, 2021, 1:52:46 PM12/7/21
to Ledger
Dear all,
I have been playing around with commodities because I frequently spend money in different currencies and I then settle it with an internal currency exchange within my own accounts.

I would like to understand if the following 2 samples are exactly equivalent or, otherwise, what distinguishes them.

Sample #1

2021/05/20=2021/05/22 * Starbucks
    Expenses:Food             100.00 USD {=0.8 GBP}
    Assets:Paypal                -90.00 EUR

2021/05/31 * Currency Exchange
    ; Starbucks payment settlement
    Assets:Paypal                 90.00 EUR
    Assets:Paypal                -80.00 GBP

Sample #2

2021/05/20=2021/05/22 * Starbucks
    Expenses:Food             100.00 USD @@ 80.00 GBP
    Assets:Paypal                -90.00 EUR
    Assets:Paypal                 90.00 EUR ; [=2021/05/31]
    Assets:Paypal                -80.00 GBP

What I am trying to record here is the following:
On May 21 I use my paypal card to pay a bill of 100 USD at Starbucks.
My paypal's default account is EUR, therefore it debits 90 EUR from my wallet (automatic conversion).
My income is in GBP so I rather settle my expenses in that same currency, therefore I do a currency conversion within my Paypall app, buying 90 EUR with 80 GBP. Because this is a manual process, sometimes it happens only a few days later (on May 31 in this example).

Would you agree with my way of recording these transaction or would you do it differently?

Many thanks, POliveira

POliveira

unread,
Dec 7, 2021, 2:40:03 PM12/7/21
to Ledger
Allow me to add some more complexity.
To test these samples when a sequence of transaction occurs, wherein the exchange rate might actually change over time, I've created a sample with 3 purchases in 3 different currencies (BRL, USD, and GBP). Default paypal account is EUR (all payments are automatically converted into EUR), but I want to settle in AED, locking the currency exchange rate in a way that does not expose me to that currency price anymore.
To be more realistic, let's say I do that sort of "hedging" for only 2 out of my 3 purchases (sometimes I forget to settle).
I found yet a 3rd possible way to represent this.

Option #1

2021/03/31 * KFC
    Expenses:Food             150.00 BRL {=0.6667 AED}
    Assets:Paypal                -25.00 EUR

2021/04/01 * Currency Exchange
    Assets:Paypal                 25.00 EUR
    Assets:Paypal             -100.00 AED

2021/04/20 * Starbucks
    Expenses:Food               30.00 USD
    Assets:Paypal                -20.00 EUR

2021/04/28 * McDonalds
    Expenses:Food               50.00 GBP {=5.4 AED}
    Assets:Paypal                -60.00 EUR

2021/04/29 * Currency Exchange
    Assets:Paypal                 60.00 EUR
    Assets:Paypal              -270.00 AED

Option #2

2021/03/31 * KFC
    Expenses:Food             150.00 BRL @@ 100 AED
    Assets:Paypal                -25.00 EUR
    Assets:Paypal                 25.00 EUR ; [=2021/04/01]
    Assets:Paypal              -100.00 AED ; [=2021/04/01]

2021/04/20 * Starbucks
    Expenses:Food               30.00 USD
    Assets:Paypal                -20.00 EUR

2021/04/28 *  McDonalds
    Expenses:Food               50.00 GBP @@ 270 AED
    Assets:Paypal                -60.00 EUR
    Assets:Paypal                 60.00 EUR ; [=2021/04/29]
    Assets:Paypal              -270.00 AED ; [=2021/04/29]

Option #3 (new)

2021/03/31 * KFC
    Expenses:Food             150.00 BRL {=0.6667 AED} @@ 25 EUR
    Assets:Paypal                -25.00 EUR
    Assets:Paypal                 25.00 EUR @@ 100 AED ; [=2021/04/01]
    Assets:Paypal              -100.00 AED ; [=2021/04/01]

2021/04/20 * Starbucks
    Expenses:Food               30.00 USD
    Assets:Paypal                -20.00 EUR

2021/04/28 *  McDonalds
    Expenses:Food               50.00 GBP {=5.4 AED} @@ 60 EUR
    Assets:Paypal                -60.00 EUR
    Assets:Paypal                 60.00 EUR @@ 270 AED ; [=2021/04/29]
    Assets:Paypal             -270.00 AED ; [=2021/04/29]

My question remains:
1) What is the difference between the above options?
2) What is the best way to record these transactions?

Many thanks, Paulo

Martin Michlmayr

unread,
Dec 8, 2021, 7:27:53 PM12/8/21
to ledge...@googlegroups.com
I don't have time to think through your samples right now and I hope
someone else will respond.

However, I wanted to mention Peter Selinger's tutorial on multiple
currency accounting:
https://www.mathstat.dal.ca/~selinger/accounting/tutorial.html

Reading/applying this has been on my TODO list for years, but I'm
being told it's a good way to handle transactions with multiple
currencies.

(If anyone uses this and wants to comment, I'd appreciate it.)

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

psionl0

unread,
Dec 9, 2021, 2:42:03 AM12/9/21
to Ledger
For my 2 cents, I prefer method 1 since it correctly records the day the paypal account is settled. Note that the Currency Exchange transaction is wrong because it suggests that Paypal provided the AED for you to settle the Paypal account. It is more likely that you got the AED from your bank account to settle the paypal account.
So the transaction should look like
2021/04/01 * Currency Exchange
    Assets:Paypal         25.00 EUR @@ 100.00 AED
    Assets:Bank

Paulo Oliveira

unread,
Dec 9, 2021, 1:40:21 PM12/9/21
to ledge...@googlegroups.com
Thanks.

"[...] I prefer method 1 since it correctly records the day the paypal account is settled"
I thought that by adding the ; [=DATE] in methods 2 and 3 I was recording the day the paypal account was settled, am I wrong?

"Note that the Currency Exchange transaction is wrong because it suggests that Paypal provided the AED for you to settle the Paypal account. It is more likely that you got the AED from your bank account to settle the paypal account."
In fact I meant the Paypal account because in this scenario I actually have an AED account in my Paypal wallet that I periodically top-up. Therefore, when I want to settle the transaction, I basically do an internal exchange conversion within my Paypal wallet.

--

---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/cf24589d-6e0a-4289-a1a4-c140ea60f12dn%40googlegroups.com.

Stanko Trček

unread,
Dec 9, 2021, 4:57:29 PM12/9/21
to Ledger
Thanks, for Peter Selinger's tutorial link.

četrtek, 9. december 2021 ob 01:27:53 UTC+1 je oseba Martin Michlmayr napisala:

psionl0

unread,
Dec 10, 2021, 3:32:48 AM12/10/21
to Ledger
"I thought that by adding the ; [=DATE] in methods 2 and 3 I was recording the day the paypal account was settled, am I wrong?"
You are putting the date in a comment which means it has no effect on the reports that Ledger generates. It is not necessarily wrong but I prefer to see a one to one correspondence between Ledger transactions and entries in external (bank) accounts. It makes reconciliation much easier.

"In fact I meant the Paypal account because in this scenario I actually have an AED account in my Paypal wallet that I periodically top-up. Therefore, when I want to settle the transaction, I basically do an internal exchange conversion within my Paypal wallet"
Maybe you should do your transaction like this?:
2021/04/01 * Currency Exchange
    Assets:Paypal:EUR      25.00 EUR @@ 100.00 AED
    Assets:Paypal:AED

Martin Michlmayr

unread,
Dec 10, 2021, 8:57:25 AM12/10/21
to ledge...@googlegroups.com
* psionl0 <gsc...@iinet.net.au> [2021-12-10 00:32]:
> "I thought that by adding the ; [=DATE] in methods 2 and 3 I was recording
> the day the paypal account was settled, am I wrong?"
> You are putting the date in a comment which means it has no effect on the
> reports that Ledger generates.

It's actually valid syntax for an aux date on a posting; you have to
use --effective to use the aux date.

# ledger -f e reg payp
2021-05-20 Starbucks Assets:Paypal -90.00 EUR -90.00 EUR
Assets:Paypal 90.00 EUR 0
Assets:Paypal -80.00 GBP -80.00 GBP
# ledger -f e reg payp --effective
2021-05-22 Starbucks Assets:Paypal -90.00 EUR -90.00 EUR
2021-05-31 Starbucks Assets:Paypal 90.00 EUR 0
^^^^^^^^^^^^^^
2021-05-22 Starbucks Assets:Paypal -80.00 GBP -80.00 GBP
Reply all
Reply to author
Forward
0 new messages