Discussion:
Strange behaviour on multi-commodity accounts
Sergey Volkov
2018-11-10 22:53:06 UTC
Permalink
Hi

I wrote simple journal file:



2018-10-01 *

Assets:Cash 3000 RUB

Income:Begin


2018/10/01 *

Assets:Cash 200 USD

Income:Begin

The balance command shows me zero balance on these transactions. It's ok:

3000 RUB

200 USD Assets:Cash

-3000 RUB

-200 USD Income:Begin

--------------------

0


Then I transfered some roubles to the deposit:


2018/10/01 *

Assets:Cash -1000 RUB

Assets:Deposit


The balance is still ok:


3000 RUB

200 USD Assets

2000 RUB

200 USD Cash

1000 RUB Deposit

-3000 RUB

-200 USD Income:Begin

--------------------

0



But when I tried to convert rouble cash to usd cash I got non-zero balance:


2018/10/01 *

Assets:Cash -1000 RUB

Assets:Cash 15.38 USD




2000 RUB

215.38 USD Assets:Cash

-3000 RUB

-200.00 USD Income:Begin

--------------------

-1000 RUB

15.38 USD



It it a bug or expected behaviour? If it's expected, how can I properly
write convertation operation?
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Simon Michael
2018-11-11 18:54:28 UTC
Permalink
Post by Sergey Volkov
Hi
2018-10-01 *
Assets:Cash 3000 RUB
Income:Begin
2018/10/01 *
Assets:Cash 200 USD
Income:Begin
3000 RUB
200 USD Assets:Cash
-3000 RUB
-200 USD Income:Begin
--------------------
0
2018/10/01 *
Assets:Cash -1000 RUB
Assets:Deposit
3000 RUB
200 USD Assets
2000 RUB
200 USD Cash
1000 RUB Deposit
-3000 RUB
-200 USD Income:Begin
--------------------
0
2018/10/01 *
Assets:Cash -1000 RUB
Assets:Cash 15.38 USD
2000 RUB
215.38 USD Assets:Cash
-3000 RUB
-200.00 USD Income:Begin
--------------------
-1000 RUB
15.38 USD
It it a bug or expected behaviour? If it's expected, how can I properly write convertation operation?
Hi.. it's expected. hledger sums currencies separately unless you tell it to convert.

Usually the quick fix is to use -B. And if you need more conversion than that can do, you define market prices and use -V. More about these at http://hledger.org/manual.html#cost <http://hledger.org/manual.html#cost> .

Best,
-SImon
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Simon Michael
2018-11-11 19:33:24 UTC
Permalink
Post by Simon Michael
Post by Sergey Volkov
Hi
2018-10-01 *
Assets:Cash 3000 RUB
Income:Begin
2018/10/01 *
Assets:Cash 200 USD
Income:Begin
3000 RUB
200 USD Assets:Cash
-3000 RUB
-200 USD Income:Begin
--------------------
0
2018/10/01 *
Assets:Cash -1000 RUB
Assets:Deposit
3000 RUB
200 USD Assets
2000 RUB
200 USD Cash
1000 RUB Deposit
-3000 RUB
-200 USD Income:Begin
--------------------
0
2018/10/01 *
Assets:Cash -1000 RUB
Assets:Cash 15.38 USD
2000 RUB
215.38 USD Assets:Cash
-3000 RUB
-200.00 USD Income:Begin
--------------------
-1000 RUB
15.38 USD
It it a bug or expected behaviour? If it's expected, how can I properly write convertation operation?
Hi.. it's expected. hledger sums currencies separately unless you tell it to convert.
Usually the quick fix is to use -B. And if you need more conversion than that can do, you define market prices and use -V. More about these at http://hledger.org/manual.html#cost <http://hledger.org/manual.html#cost> .
PS we want hledger to be intuitive, and it feels like the behaviour and
this answer might not be. If anyone thinks so, let me know and let's
discuss further.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sergey Volkov
2018-11-12 09:00:01 UTC
Permalink
Yeap, It's not intuitive, at least for me. The `-B` flag is not work for
the case:

Journal:

2018-10-01 *

Assets:Cash 3000 RUB

Income:Begin


2018/10/01 *

Assets:Cash 200 USD

Income:Begin


2018/10/01 *

Assets:Cash -1000 RUB

Assets:Cash 15.38 USD



Output:

hledger -f ~/test bal -B

3000 RUB

200.00 USD Assets:Cash

-3000 RUB

-200.00 USD Income:Begin

--------------------

0


Expected output:

hledger -f ~/test bal -B

2000 RUB

215.38 USD Assets:Cash

-3000 RUB

-200.00 USD Income:Begin

--------------------

0
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Sergey Volkov
2018-11-12 09:03:47 UTC
Permalink
P.S Prices in journal does not affect on the behaviour

P 2018/11/01 00:00:00 USD 65.20

P 2018/11/01 00:00:00 EUR 74.20

P 2018/11/07 00:00:00 USD 65.20

P 2018/11/07 00:00:00 EUR 74.20


пПМеЎельМОк, 12 МПября 2018 г., 12:00:02 UTC+3 пПльзПватель Sergey Volkov
Post by Sergey Volkov
Yeap, It's not intuitive, at least for me. The `-B` flag is not work for
2018-10-01 *
Assets:Cash 3000 RUB
Income:Begin
2018/10/01 *
Assets:Cash 200 USD
Income:Begin
2018/10/01 *
Assets:Cash -1000 RUB
Assets:Cash 15.38 USD
hledger -f ~/test bal -B
3000 RUB
200.00 USD Assets:Cash
-3000 RUB
-200.00 USD Income:Begin
--------------------
0
hledger -f ~/test bal -B
2000 RUB
215.38 USD Assets:Cash
-3000 RUB
-200.00 USD Income:Begin
--------------------
0
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Simon Michael
2018-11-12 17:20:55 UTC
Permalink
Post by Sergey Volkov
2018-10-01 *
Assets:Cash 3000 RUB
Income:Begin
2018/10/01 *
Assets:Cash 200 USD
Income:Begin
2018/10/01 *
Assets:Cash -1000 RUB
Assets:Cash 15.38 USD
hledger -f ~/test bal -B
3000 RUB
200.00 USD Assets:Cash
-3000 RUB
-200.00 USD Income:Begin
--------------------
0
hledger -f ~/test bal -B
2000 RUB
215.38 USD Assets:Cash
-3000 RUB
-200.00 USD Income:Begin
--------------------
0
But your expected output would be weird, right ? We don't want to show users a total that isn't the sum of the numbers above it.

To show a total that looks correct, we must consistently use either the posting amounts or the cost amounts, both above and below the line.
Post by Sergey Volkov
P.S Prices in journal does not affect on the behaviour
P 2018/11/01 00:00:00 USD 65.20
P 2018/11/01 00:00:00 EUR 74.20
P 2018/11/07 00:00:00 USD 65.20
P 2018/11/07 00:00:00 EUR 74.20
Correct. Market price declarations affect -V, not -B.


I think we need an introductory hledger multicurrency tutorial. Then, it may be easier to see issues and improvements. I'll post a draft soon.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Simon Michael
2018-11-13 01:37:18 UTC
Permalink
Post by Simon Michael
But your expected output would be weird, right ? We don't want to show users a total that isn't the sum of the numbers above it.
To show a total that looks correct, we must consistently use either the posting amounts or the cost amounts, both above and below the line.
...
Post by Simon Michael
Correct. Market price declarations affect -V, not -B.
I think we need an introductory hledger multicurrency tutorial. Then, it may be easier to see issues and improvements. I'll post a draft soon.
Please see: https://github.com/simonmichael/hledger/wiki/hledger-multicurrency-tutorial <https://github.com/simonmichael/hledger/wiki/hledger-multicurrency-tutorial>

It explores the current behaviour, and hopefully at least explains that. Please give me feedback both on the current doc, and any ideas for changes to behaviour.

Best
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Simon Michael
2018-11-13 02:10:02 UTC
Permalink
Post by Simon Michael
Post by Simon Michael
But your expected output would be weird, right ? We don't want to show users a total that isn't the sum of the numbers above it.
To show a total that looks correct, we must consistently use either the posting amounts or the cost amounts, both above and below the line.
...
Post by Simon Michael
Correct. Market price declarations affect -V, not -B.
I think we need an introductory hledger multicurrency tutorial. Then, it may be easier to see issues and improvements. I'll post a draft soon.
Please see: https://github.com/simonmichael/hledger/wiki/hledger-multicurrency-tutorial <https://github.com/simonmichael/hledger/wiki/hledger-multicurrency-tutorial>
It explores the current behaviour, and hopefully at least explains that. Please give me feedback both on the current doc, and any ideas for changes to behaviour.
PS, sneak preview:

- declaring a market price corresponding to the price in the fourth transaction ( P 2018/11/01 E 75 R ) and adding -V will show everything completely in rubles (with or without -B, at least in this case), preserving the zero total

- declaring an accurate market price instead ( P 2018/11/01 E 74.91 R ), there will be a small non zero total, which corresponds to the gain/loss due to exchanging at a price slightly different from the above. After adding an explicit gain/loss transaction, the zero total is restored.
--
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+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...