Question about Balancing payments in foreign currencies

67 views
Skip to first unread message

Vedang Manerikar

unread,
Feb 5, 2024, 4:57:26 AMFeb 5
to Ledger
Hello All,

This is the first time I am posting, so if this question is already answered previously,  I'm sorry for the noise and please direct me to it. I did some searching but could not find it.

I live in India and the default currency I want to see reports in is Rs (Rupees). Payments to international service providers happens in $, and then on my credit card statement I see the actual amount I was charged in Rupees. Here are some example transactions:

2023/07/18 * OpenAI Invoice
    liabilities:vendors:openai              $ -14.83
    expenses:programming

2023/07/24 * OpenAI Payment Receipt
    liabilities:card:icici                  $ -14.83 @@ Rs 1267.82
    liabilities:vendors:openai

2023/08/08 * OpenAI Invoice
    liabilities:vendors:openai               $ -0.79
    expenses:programming

2023/08/15 * OpenAI Payment Receipt
    liabilities:card:icici                   $ -0.79 @@ Rs 68.36
    liabilities:vendors:openai

2023/09/13 * OpenAI Invoice
    liabilities:vendors:openai              $ -10.67
    expenses:programming

2023/10/03 * OpenAI Payment Receipt
    liabilities:card:icici                  $ -10.67 @@ Rs 924.11
    liabilities:vendors:openai

Here, OpenAI sends me an invoice in $, I make the payment on my credit card in $, and then I look at the credit card statement to see how much I was actually charged in Rs by the bank and note that amount down. 

The problem is that I'd like `ledger -X Rs bal liabilities:vendors:openai` to show that I owe 0 Rs to pay back to OpenAI, but it does not do so due to the fluctuating $ price. 

How do I do this? 

I've read the commodities and lot-prices sections of the manual, but perhaps I didn't understand them correctly. The changing rate of the $ is important information that I want to capture, but it's equally important that the liabilities:vendors account be balanced properly.

Thanks,
Vedang

psionl0

unread,
Feb 5, 2024, 7:41:58 PMFeb 5
to Ledger
How about modifying the transactions this way?
2023/07/18 * OpenAI Invoice
    liabilities:vendors:openai              $ -14.83
    expenses:programming

2023/07/24 * OpenAI Payment Receipt
    liabilities:card:icici                  Rs -1267.82
    liabilities:vendors:openai              $ 14.83


2023/08/08 * OpenAI Invoice
    liabilities:vendors:openai               $ -0.79
    expenses:programming

2023/08/15 * OpenAI Payment Receipt
    liabilities:card:icici                   Rs -68.36
    liabilities:vendors:openai               $  0.79


2023/09/13 * OpenAI Invoice
    liabilities:vendors:openai              $ -10.67
    expenses:programming

2023/10/03 * OpenAI Payment Receipt
    liabilities:card:icici                  Rs -924.11
    liabilities:vendors:openai              $ 10.67

Then when you run a balance report you get the following:
$ ledger -f vedang.txt bal | cat
             $ 26.29  expenses:programming
         Rs -2260.29  liabilities:card:icici
--------------------
             $ 26.29
         Rs -2260.29

You can also keep the currency conversions in-card (handy if the clearance date is different to the payment date)
2023/07/18 * OpenAI Invoice
    liabilities:vendors:openai              $ -14.83
    expenses:programming

2023/07/24 * OpenAI Payment Receipt
    liabilities:card:icici                  $ -14.83
    liabilities:vendors:openai

2023/07/24 * Currency Conversion
    liabilities:card:icici                  Rs -1267.82
    liabilities:card:icici                  $ 14.83


2023/08/08 * OpenAI Invoice
    liabilities:vendors:openai               $ -0.79
    expenses:programming

2023/08/15 * OpenAI Payment Receipt
    liabilities:card:icici                   $ -0.79
    liabilities:vendors:openai

2023/08/15 * Currency Conversion
    liabilities:card:icici                  Rs -68.36
    liabilities:card:icici                  $ 0.79


2023/09/13 * OpenAI Invoice
    liabilities:vendors:openai              $ -10.67
    expenses:programming

2023/10/03 * OpenAI Payment Receipt
    liabilities:card:icici                  $ -10.67
    liabilities:vendors:openai

2023/10/03 * Currency Conversion
    liabilities:card:icici                  Rs -924.11
    liabilities:card:icici                  $ 10.67


$ ledger -f vedang2.txt bal | cat
             $ 26.29  expenses:programming
         Rs -2260.29  liabilities:card:icici
--------------------
             $ 26.29
         Rs -2260.29

Vedang

unread,
Feb 5, 2024, 9:22:20 PMFeb 5
to ledge...@googlegroups.com
Thank you! The second approach works for me! I can only see the
clearance information in the credit card statement, so I don't have
that data immediately after making the payment.

Can you also please explain why the change in representation fixes the
problem? Running `ledger -X Rs reg` shows me that Commodity
Revaluation is still happening, but I guess the new style of writing
transactions pushed the revaluation data to the
`liabilities:card:icici` account instead?
> --
>
> ---
> You received this message because you are subscribed to a topic in the Google Groups "Ledger" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/ledger-cli/PjqvqTL52s0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to ledger-cli+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ledger-cli/abddc688-26e7-406c-ab9f-869161d04fccn%40googlegroups.com.



--
Cheers,
Vedang

https://vedang.me
@vedang on fosstodon.org

psionl0

unread,
Feb 6, 2024, 3:58:25 AMFeb 6
to Ledger
All of the transactions to openai are now priced in $ only. How many Rs you used to pay them is irrelevant to them.
$ ledger -f vedang2.txt reg "openai" | cat
23-Jul-18 OpenAI Invoice        liabili:vendors:openai     $ -14.83     $ -14.83
23-Jul-24 OpenAI Payment Rece.. liabili:vendors:openai      $ 14.83            0
23-Aug-08 OpenAI Invoice        liabili:vendors:openai      $ -0.79      $ -0.79
23-Aug-15 OpenAI Payment Rece.. liabili:vendors:openai       $ 0.79            0
23-Sep-13 OpenAI Invoice        liabili:vendors:openai     $ -10.67     $ -10.67
23-Oct-03 OpenAI Payment Rece.. liabili:vendors:openai      $ 10.67            0

All of the currency conversions now take place in the credit card.
$ ledger -f vedang2.txt reg icici | cat
23-Jul-24 OpenAI Payment Rece.. liabilities:card:icici     $ -14.83     $ -14.83
23-Jul-24 Currency Conversion   liabilities:card:icici  Rs -1267.82     $ -14.83
                                                                     Rs -1267.82
                                liabilities:card:icici      $ 14.83  Rs -1267.82
23-Aug-15 OpenAI Payment Rece.. liabilities:card:icici      $ -0.79      $ -0.79
                                                                     Rs -1267.82
23-Aug-15 Currency Conversion   liabilities:card:icici    Rs -68.36      $ -0.79
                                                                     Rs -1336.18
                                liabilities:card:icici       $ 0.79  Rs -1336.18
23-Oct-03 OpenAI Payment Rece.. liabilities:card:icici     $ -10.67     $ -10.67
                                                                     Rs -1336.18
23-Oct-03 Currency Conversion   liabilities:card:icici   Rs -924.11     $ -10.67
                                                                     Rs -2260.29
                                liabilities:card:icici      $ 10.67  Rs -2260.29
(this report shows the balances in the icici card after each transaction in both currencies).

Running `ledger -X Rs reg` shows that commodity revaluations still occur because it is trying to convert everything into Rs but the exchange rates are different each time you make a payment. I personally stick with the simpler reports because the more complicated a report, the more unpredictable it is.

o1bigtenor

unread,
Feb 6, 2024, 8:08:16 AMFeb 6
to ledge...@googlegroups.com
2022.06.18        vendor
    ; online + xxxxxxx cable
    ; booked as 16.50 GBP
    ; 1.649090909
    Expense: item description: item code                    $   14.02
    Expense: shipping: item code                        $   13.19
    Asset: credit card info: item code                           $   -27.21


I picked a somewhat recent transaction to show you a simple system.
Dunno what your particular regulations are but here I am allowed to use either a base currency
or I get to have a ledger in each currency and then reconcile the various ledgers (I'm not doing
that many transactions in that many differenc currencies so option #2 isn't going to be used - - yet)/

I can enter all this from an invoice except the exchange rate.
That means that I have to update all the numbers into my base currency when I get the
credit card statement. I do find it a nuisance when there are lots of line items but oh well
bookkeeping is a royal pita and this is just part of getting the job done. As there are different exchange
rates even with purchases within an hour this is the only way that I have found that I can keep things
sorta straight.

HTH

psionl0

unread,
Feb 6, 2024, 10:53:51 AMFeb 6
to Ledger
If you need your expenses denominated in Rs (eg for tax purposes) then you can expand the currency conversions as shown:

2023/07/18 * OpenAI Invoice
    liabilities:vendors:openai              $ -14.83
    expenses:programming

2023/07/24 * OpenAI Payment Receipt
    liabilities:card:icici                  $ -14.83
    liabilities:vendors:openai

2023/07/24 * Currency Conversion
    liabilities:card:icici                  Rs -1267.82
    liabilities:card:icici                  $ 14.83
    expenses:programming                    $ -14.83
    expenses:programming                    Rs 1267.82


2023/08/08 * OpenAI Invoice
    liabilities:vendors:openai               $ -0.79
    expenses:programming

2023/08/15 * OpenAI Payment Receipt
    liabilities:card:icici                   $ -0.79
    liabilities:vendors:openai

2023/08/15 * Currency Conversion
    liabilities:card:icici                  Rs -68.36
    liabilities:card:icici                  $ 0.79
    expenses:programming                    $ -0.79
    expenses:programming                    Rs 68.36


2023/09/13 * OpenAI Invoice
    liabilities:vendors:openai              $ -10.67
    expenses:programming

2023/10/03 * OpenAI Payment Receipt
    liabilities:card:icici                  $ -10.67
    liabilities:vendors:openai

2023/10/03 * Currency Conversion
    liabilities:card:icici                  Rs -924.11
    liabilities:card:icici                  $ 10.67
    expenses:programming                    $ -10.67
    expenses:programming                    Rs 924.11

$ ledger -f vedang3.txt bal | cat
          Rs 2260.29  expenses:programming

         Rs -2260.29  liabilities:card:icici
--------------------
                   0

You can also add in any fees that icici charged you for the conversions. You can still get the total amount spent in $ and the Rs that it cost you by running a balance filtering on expenses (or icici card) AND Currency Conversion:

$ ledger -f vedang3.txt bal expenses and @currency | cat
            $ -26.29
          Rs 2260.29  expenses:programming


On Tuesday, February 6, 2024 at 10:22:20 AM UTC+8 Vedang wrote:
Reply all
Reply to author
Forward
0 new messages