Discussion:
Commodity Directive Problem
Klauss Hass
2018-04-18 15:03:09 UTC
Permalink
Hi,

I’m trying to parse my ledger files with hledger and it seems that there is a problem with the commodity directive.

I have the following commodity directive in the beginning of the that reads my *.ledger files:

commodity R$ 1.000,00

On 2017/05/16 I have the following transaction that is a mutual fund investment:

2017/05/16 * Aplicação ItauMaximeRF
Assets:Investments:Funds:ItauMaximeRF 57,07913 ItauMaximeRF @ R$ 80,5898850
Assets:Checking:Itaú

Though when I process the register reports of my checking account (hledger r assets:checking:itaú) the following value appears:

2017/05/16 Aplicação ItauMaximeRF Assets:Checking:Itaú R$ -4600,0005226

The same files of ledger-cli return the value R$ 4.600,00 for this transaction.

All the transactions for this account after this date have 7 decimal cases on hledger.

Is it a bug or am I doing anything wrong?

Thanks
--
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-04-18 15:32:37 UTC
Permalink
Hi,
I’m trying to parse my ledger files with hledger and it seems that there is a problem with the commodity directive.
commodity R$ 1.000,00
2017/05/16 * Aplicação ItauMaximeRF
Assets:Checking:Itaú
2017/05/16 Aplicação ItauMaximeRF Assets:Checking:Itaú R$ -4600,0005226
The same files of ledger-cli return the value R$ 4.600,00 for this transaction.
All the transactions for this account after this date have 7 decimal cases on hledger.
Is it a bug or am I doing anything wrong?
Hi Klaus,

that's interesting.. thanks for the report. I think it is a bug, indeed.

Because you left the second amount blank, hledger infers it thus (converting to the cost as usual), giving this:

2017/05/16 * Aplicação ItauMaximeRF
Assets:Investments:Funds:ItauMaximeRF 57,07913 ItauMaximeRF @ R$ 80,5898850
Assets:Checking:Itaú R$ -4600,0005226

After that, the R$ commodity directive should take effect, and we should see:

$ hledger print -x
2017/05/16 * Aplicação ItauMaximeRF
Assets:Investments:Funds:ItauMaximeRF 57,07913 ItauMaximeRF @ R$ 80,5898850
Assets:Checking:Itaú R$ -4.600,00

but instead we get:

2017/05/16 * Aplicação ItauMaximeRF
Assets:Investments:Funds:ItauMaximeRF 57,07913 ItauMaximeRF @ R$ 80,5898850
Assets:Checking:Itaú R$ -4600,0005226

As a workaround, it displays correctly if you write the second amount explicitly. Piping your entry through "hledger -f- print -x" is a way to add the second amount. I've opened https://github.com/simonmichael/hledger/issues/737 <https://github.com/simonmichael/hledger/issues/737> .
--
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-04-20 20:43:28 UTC
Permalink
Post by Simon Michael
Hi,
I’m trying to parse my ledger files with hledger and it seems that there is a problem with the commodity directive.
commodity R$ 1.000,00
2017/05/16 * Aplicação ItauMaximeRF
Assets:Checking:Itaú
2017/05/16 Aplicação ItauMaximeRF Assets:Checking:Itaú R$ -4600,0005226
The same files of ledger-cli return the value R$ 4.600,00 for this transaction.
All the transactions for this account after this date have 7 decimal cases on hledger.
Is it a bug or am I doing anything wrong?
Hi Klaus,
that's interesting.. thanks for the report. I think it is a bug, indeed.
Now fixed in master.
--
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.
Klauss Hass
2018-04-21 12:01:37 UTC
Permalink
Thanks Simon.

Would you know how long it takes to be updated on arch?
Post by Simon Michael
Post by Simon Michael
Hi,
I’m trying to parse my ledger files with hledger and it seems that there is a problem with the commodity directive.
commodity R$ 1.000,00
2017/05/16 * Aplicação ItauMaximeRF
Assets:Checking:Itaú
2017/05/16 Aplicação ItauMaximeRF Assets:Checking:Itaú R$ -4600,0005226
The same files of ledger-cli return the value R$ 4.600,00 for this transaction.
All the transactions for this account after this date have 7 decimal cases on hledger.
Is it a bug or am I doing anything wrong?
Hi Klaus,
that's interesting.. thanks for the report. I think it is a bug, indeed.
Now fixed in master.
--
You received this message because you are subscribed to the Google Groups "hledger" group.
For more options, visit https://groups.google.com/d/optout.
--
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-04-21 16:33:01 UTC
Permalink
Post by Klauss Hass
Would you know how long it takes to be updated on arch?
They might update soon after I make a minor release. I'll be doing that soonish.
--
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...