Currency Designator/Reporting Issues

70 views
Skip to first unread message

Jasel17212

unread,
Nov 6, 2021, 7:25:34 PM11/6/21
to Ledger
When I started using ledger a few years ago, I defaulted to using the dollar symbol ($) in my journal files. This, of course, works just fine.  If I want a balance sheet report, I run the following command:

ledger -f 1.ldg --price-db price_db.txt -V --strict –explicit ^Ass ^Lia --depth 2

This produces the following output:

             $xxx.xx  Assets
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
            $-xxx.xx  Liabilities
            $-xxx.xx    yyyyy
            $-xxx.xx    yyyyy
            $-xxx.xx    yyyyy
--------------------
          $xx,xxx.xx

I decided to switch to using USD instead of the dollar symbol. To do this I removed all of the dollar symbols from my journal files and price database and added USD. Following is the format I used:

xxx.xx USD

Now when I run the exact same balance sheet report, I see commodities that I didn’t see before I made my changes.

         -5.37578 KO
       xx,xxx.xx USD
    -2,139.718 VTHRX  Assets
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
         -5.37578 KO
          xxx.xx USD
    -2,139.718 VTHRX    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
         -xxx.xx USD  Liabilities
         -xxx.xx USD    yyyyy
         -xxx.xx USD    yyyyy
         -xxx.xx USD    yyyyy
--------------------
         -5.37578 KO
       xx,xxx.xx USD
    -2,139.718 VTHRX

What’s interesting here is that the non-USD commodities appear to be commodities that I’ve previously sold.  In other words, I no longer hold VTHRX, and while I do hold some KO, it’s a fraction of a share.

If I run the same command WITHOUT the -V option, I get a report that accurately reflects my current holdings:

ledger -f 1.ldg --price-db price_db.txt --strict –explicit ^Ass ^Lia --depth 2

      0.00263224 ABC
          0.04860 KO
       xx,xxx.xx USD  Assets
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
      0.00263224 ABC    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          0.04860 KO
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
         -xxx.xx USD  Liabilities
         -xxx.xx USD    yyyyy
         -xxx.xx USD    yyyyy
         -xxx.xx USD    yyyyy
--------------------
      0.00263224 ABC
          0.04860 KO
       xx,xxx.xx USD

Running the original command with -X USD produces the output I expected to get in the first place. In other words, the same output I received before changing $ to USD, but with the new commodity designator.

ledger -f 1.ldg --price-db price_db.txt -V --strict –explicit ^Ass ^Lia --depth 2 -X USD

       xx,xxx.xx USD  Assets
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
         -xxx.xx USD Liabilities
         -xxx.xx USD   yyyyy
         -xxx.xx USD   yyyyy
         -xxx.xx USD   yyyyy
--------------------
       xx,xxx.xx USD

Any ideas on what’s happening here?

o1bigtenor

unread,
Nov 7, 2021, 7:26:22 AM11/7/21
to Ledger
On Sat, Nov 6, 2021 at 6:15 PM Jasel17212 <ja...@thelittonfamily.com> wrote:
When I started using ledger a few years ago, I defaulted to using the dollar symbol ($) in my journal files. This, of course, works just fine.  If I want a balance sheet report, I run the following command:

ledger -f 1.ldg --price-db price_db.txt -V --strict –explicit ^Ass ^Lia --depth 2

This produces the following output:

             $xxx.xx  Assets
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
             $xxx.xx    yyyyy
            $-xxx.xx  Liabilities
            $-xxx.xx    yyyyy
            $-xxx.xx    yyyyy
            $-xxx.xx    yyyyy
--------------------
         $xxx,xxx.xx

I decided to switch to using USD instead of the dollar symbol. To do this I removed all of the dollar symbols from my journal files and price database and added USD. Following is the format I used:

xxx.xx USD

Now when I run the exact same balance sheet report, I see commodities that I didn’t see before I made my changes.

         -5.37578 KO
          xxx.xx USD
    -2,139.718 VTHRX  Assets
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    Crypto
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
         -5.37578 KO
          xxx.xx USD
    -2,139.718 VTHRX    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
         -xxx.xx USD  Liabilities
         -xxx.xx USD    yyyyy
         -xxx.xx USD    yyyyy
         -xxx.xx USD    yyyyy
--------------------
         -5.37578 KO
      xxx,xxx.xx USD
    -2,139.718 VTHRX

What’s interesting here is that the non-USD commodities appear to be commodities that I’ve previously sold.  In other words, I no longer hold VTHRX, and while I do hold some KO, it’s a fraction of a share (see below).

If I run the same command WITHOUT the -V option, I get a report that accurately reflects my current holdings:

ledger -f 1.ldg --price-db price_db.txt --strict –explicit ^Ass ^Lia --depth 2

      x.xxxxxxxx ABC
          0.04860 KO
          xxx.xx USD  Assets
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
      x.xxxxxxxx ABC    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          0.04860 KO
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
          xxx.xx USD    yyyyy
         -xxx.xx USD  Liabilities
         -xxx.xx USD    yyyyy
         -xxx.xx USD    yyyyy
         -xxx.xx USD    yyyyy
--------------------
      x.xxxxxxxx ABC
          0.04860 KO
      xxx,xxx.xx USD

Running the original command with -X USD produces the output I expected to get in the first place. In other words, the same output I received before changing $ to USD, but with the new commodity designator.

ledger -f 1.ldg --price-db price_db.txt -V --strict –explicit ^Ass ^Lia --depth 2 -X USD

      xxx,xxx.xx USD  Assets
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
          xxx.xx USD   yyyyy
         -xxx.xx USD Liabilities
         -xxx.xx USD   yyyyy
         -xxx.xx USD   yyyyy
         -xxx.xx USD   yyyyy
--------------------
      xxx,xxx.xx USD

Any ideas on what’s happening here?


Totally can't speak to what's happening in 'ledger' - - - but - - - I'm wondering why 
you would want the change?

For business - - - - one is expected to run the journal in one's main currency. 
Other currencies are all handled in the main currency. 
I think that if there is enough usage of any other currency one could use a 
sub-journal for any such but imo that would be a fairly high volume of activity 
and also involve the use of other currency accounts. 

Regards 

Jasel17212

unread,
Nov 7, 2021, 6:51:47 PM11/7/21
to Ledger
Ajoeibin - I want to make the change for consistency.  Running a report that shows commodities and currencies using the same format just looks better to my eye.

John / Martin - either of you have any ideas as to what might be causing this issue?

Thanks!
JL

John Wiegley

unread,
Nov 8, 2021, 2:02:54 AM11/8/21
to o1bigtenor, Ledger
>>>>> "o" == o1bigtenor <o1big...@gmail.com> writes:

o> Any ideas on what’s happening here?

I'm not sure what's going on, but -V tries to be smart and maybe it's failing
in your case. What happens if you use "-X USD" instead?

John

Jasel17212

unread,
Nov 8, 2021, 8:04:39 AM11/8/21
to Ledger
John,

As mentioned in my original post, running the report with -X USD produces the expected output. It sounds like I've stumbled upon a bug related to the -V option.

BTW, I've been meaning to ask, are you still personally using PTA? If so, are you still using Ledger, or are you using Hledger?

Thanks!
JL

John Wiegley

unread,
Nov 8, 2021, 2:33:46 PM11/8/21
to Jasel17212, Ledger
>>>>> "J" == Jasel17212 <ja...@thelittonfamily.com> writes:

J> As mentioned in my original post, running the report with -X USD produces
J> the expected output. It sounds like I've stumbled upon a bug related to the
J> -V option.

Yes, could very well be. Really the -V should be removed, I think, but it's
been relatively harmless until now.

J> BTW, I've been meaning to ask, are you still personally using PTA? If so,
J> are you still using Ledger, or are you using Hledger?

I use Ledger every week, lately to track crypto transactions. I also use it
for time reporting when applicable, and for tracking investments, progress on
loans, and a "yearly income report" where I basically enter in the data from
my tax return every year.

John
Reply all
Reply to author
Forward
0 new messages