simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
2.91k stars 315 forks source link

Stock shows up in reports even with --value flag #1131

Closed Timonsc closed 4 years ago

Timonsc commented 4 years ago

After entering the following entry to my ledger am still seeing the IMEU in the reports even when i'm using the --value flag. Other stocks that I bought do not show up in these reports even though I added in the same entry format. The entry that's causing problems:

2019/10/28 buy iShares MSCI Europe UCITS ETF (Dist)
    Assets:Investments:Degiro     IMEU 33 @ EUR 24.84
    Assets:Investments:Degiro     EUR819.72

The report shows:

hledger balance -f 2019.j Assets:Investments --value
       EUR2000.00
             IMEU 33  Assets:Investments:Degiro
--------------------
       EUR22930.8300
             IMEU 33
simonmichael commented 4 years ago

You probably don't have an applicable P directive. Try adding one, something like:

P 2019-10-15 IMEU  EUR 24
simonmichael commented 4 years ago

-V's docs are also relevant here. If they're unclear, suggestions for alternate wording are appreciated.

adept commented 4 years ago

Couple of things that i find weird here:

  1. --value requires argument (even in 1.15, right?), so it should be --value=cost

  2. Both postings are positive - this transaction is not balanceable. Indeed, binary from master says:

    could not balance this transaction (real postings are off by EUR 1639.44)
    2019/10/28 buy iShares MSCI Europe UCITS ETF (Dist)
    Assets:Investments:Degiro    IMEU 33 @ EUR 24.84
    Assets:Investments:Degiro              EUR819.72
  3. If you change second posting to be negative, then master gets you this:

    
    $ hledger balance -f /tmp/12 Assets:Investments
          EUR-819.72                           
             IMEU 33  Assets:Investments:Degiro
    --------------------
          EUR-819.72
             IMEU 33

$ hledger balance -f /tmp/12 Assets:Investments --value=cost

               0
Timonsc commented 4 years ago

Thanks for replying

@simonmichael I think the P directive was the problem. Didn't know that that is necessary to get the --value.

@adept Thanks, I messed up after trying to censor the actual amount of money. And the entry was faulty indeed after trying many things to solve the problem.