The balance of assets:AR:customer will be non-0 using --value=then,CAD as long as the exchange rate changes between 2023-11-01 and 2023-12-01 (and it almost always does). The foreign exchange difference accumulates indefinitely.
If I want a 0 balance in both EUR and CAD, it seems I have to specify the exchange rate on the payment posting to match the exchange rate in effect when the invoice was issued.P 2023-11-01 EUR 1.45 CADP 2023-12-01 EUR 1.47 CAD2023-11-01 Invoiceassets:AR:customer 1000 EURrevenue:sales2023-12-01 Invoice paidassets:bank 1000 EURassets:AR:customer -1000 EUR @ 1.45 CADexpenses:exchange gain or lossNow the balance in assets:AR:customer would be 0 EUR and 0 CAD; however, now I run the risk of mistyping the exchange rate and I have virtually no way to check it with any kind of lint/test.
On Fri, Feb 23, 2024, at 05:36, J. B. Rainsberger wrote:The balance of assets:AR:customer will be non-0 using --value=then,CAD as long as the exchange rate changes between 2023-11-01 and 2023-12-01 (and it almost always does). The foreign exchange difference accumulates indefinitely.That's right - the settlement delay allows a foreign exchange gain or loss for you (and the inverse for the customer) to accumulate. It's correct to record that as an extra revenue or expense. Eg as you do here, giving the customer a fixed exchange rate and taking the gain/loss risk yourself:
If I want a 0 balance in both EUR and CAD, it seems I have to specify the exchange rate on the payment posting to match the exchange rate in effect when the invoice was issued.P 2023-11-01 EUR 1.45 CADP 2023-12-01 EUR 1.47 CAD2023-11-01 Invoiceassets:AR:customer 1000 EURrevenue:sales2023-12-01 Invoice paidassets:bank 1000 EURassets:AR:customer -1000 EUR @ 1.45 CADexpenses:exchange gain or lossNow the balance in assets:AR:customer would be 0 EUR and 0 CAD; however, now I run the risk of mistyping the exchange rate and I have virtually no way to check it with any kind of lint/test.Is it a significant risk ? A "; today's market rate" comment would help a little. You could also move or copy the P record so that it appears next to the transaction. And I suppose you could write some tool to check these agree, or to add the @ cost automatically based on today's price.
On Fri, Feb 23, 2024 at 6:22 PM Simon Michael <si...@joyful.com> wrote:On Fri, Feb 23, 2024, at 05:36, J. B. Rainsberger wrote:The balance of assets:AR:customer will be non-0 using --value=then,CAD as long as the exchange rate changes between 2023-11-01 and 2023-12-01 (and it almost always does). The foreign exchange difference accumulates indefinitely.That's right - the settlement delay allows a foreign exchange gain or loss for you (and the inverse for the customer) to accumulate. It's correct to record that as an extra revenue or expense. Eg as you do here, giving the customer a fixed exchange rate and taking the gain/loss risk yourself:
On Fri, Feb 23, 2024 at 6:22 PM Simon Michael <si...@joyful.com> wrote:
A helpful feature would be something like "-1000 EUR @ EURCAD rate as of 2022-12-01". I don't know anything about hledger's internal structure. How feasible a feature would this be? I assume it's already in the inbox somewhere. :)
$ hledger --file ledger/main.journal --value=then,CAD --end="2023-11-01" balance | tail -n 10.01 CADI presume the customer balances look like 0, but are instead not quite 0 CAD. I infer this comes from hledger not rounding the exchange difference when posting the payment for each invoice.Can I force hledger to round when it computes the exchange difference or did you very expressly decide not to allow that for good reasons? I tried to find the relevant section in the guide, but failed.
On Sun, Feb 25, 2024, at 04:56, J. B. Rainsberger wrote:On Fri, Feb 23, 2024 at 6:22 PM Simon Michael <si...@joyful.com> wrote:A helpful feature would be something like "-1000 EUR @ EURCAD rate as of 2022-12-01". I don't know anything about hledger's internal structure. How feasible a feature would this be? I assume it's already in the inbox somewhere. :)Just a simple matter of programming I'm sure. It's not in my queue. In one sense it would be less explicit, causing that entry to rely (more strongly than before) on something unseen. A variation could be to write the cost but add a tag (call it a price assertion) requiring hledger to check that it matches the contemporaneous market price. Though in practice I think it's pretty rare that the transacted price exactly matches the market price (and real world market price is a somewhat fluid idea already).
$ hledger --file ledger/main.journal --value=then,CAD --end="2023-11-01" balance | tail -n 10.01 CADI presume the customer balances look like 0, but are instead not quite 0 CAD. I infer this comes from hledger not rounding the exchange difference when posting the payment for each invoice.Can I force hledger to round when it computes the exchange difference or did you very expressly decide not to allow that for good reasons? I tried to find the relevant section in the guide, but failed.A minimal repro would be helpful. I think most likely your entries need to be more precise.
There'll be a simple solution - you'll probably see one yourself - but I can't say what it is at the moment, I'd have to see what's going on.
--You received this message because you are subscribed to the Google Groups "hledger" group.To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/hledger/CAA85kdVwZSgDdc0qsbX-qjNtgp%2BovEQsB2TkRNGpTTt7DJj%2B3w%40mail.gmail.com.
Brilliantly pragmatic and what all sensible people would do!
Meanwhile... :) I'm still happy to explain and discuss the behaviour in any complete example.
1.32 introduced more careful precision preserving in a number of places.
--You received this message because you are subscribed to the Google Groups "hledger" group.To unsubscribe from this group and stop receiving emails from it, send an email to hledger+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hledger/CAA85kdWLDv6su3Tage0xqtmcq6gT3w-SGJ4NAFu5NUmNkgaChg%40mail.gmail.com.
I'm willing, I always like to investigate anomalies and see if there's a good explanation. Feel free to email me or open an encrypted chat with me eg from the hledger room on matrix.