Re: balance currency

13 views
Skip to first unread message

Simon Michael

unread,
Sep 1, 2022, 7:41:53 AM9/1/22
to hledger
I think you have EUR appearing somewhere in your files - perhaps in a P record ? You could find it with grep. 

Also try adding --debug=1 to your bal -V command. The manual for -V will explain more about how it works.

Also try minimising your data while still reproducing the problem - that will reveal it.




On Aug 31, 2022, at 18:13, lipp f <flip...@gmail.com> wrote:

I am running this balance report and, although I do not have any EUR valued assets, the balance for  account:Cash shows up in EUR (I hold CAD and USD in Cash)

$ hledger -f file.j bal -V  account
CAD-86488.4776330690132500000000000000
                            EUR41.1042
 USD83419.5800000000000000000000000000   account
CAD-86488.4776330690132500000000000000
                            EUR41.1042    Cash
USD83419.5800000000000000000000000000    OPT
--------------------
CAD-86488.4776330690132500000000000000
                            EUR41.1042
 USD83419.5800000000000000000000000000

How do I fix this? How do I get a total in a specified currency, either  CAD or USD? 

TIA.

--
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/29058edc-3586-4995-a2eb-0a35a9c61ea8n%40googlegroups.com.

lipp f

unread,
Sep 1, 2022, 9:06:52 AM9/1/22
to hledger
I do have  P records for 5 currencies including EUR indeed but no EUR valued assets in this specific account. Here is the debug output with account / file names masked:

$ hledger  -f .......j bal -V  account  --debug=1
trying reader: "journal"
reader result: "Journal ............ with 108 transactions, 19 accounts"
trying reader: "journal"
reader result: "Journal .......... with 0 transactions, 0 accounts"
balanceReport accts:
 [ Account
     account
     ( boring : n
     , postings : 0
     , ebalance : 0
     , ibalance :
         CAD (-86746.1177845870807500000000000000) EUR41 .
         1042 USD81530 .
         6700000000000000000000000000
     )
 , Account
     account_OPT
     ( boring : n
     , postings : 67
     , ebalance : USD81530 . 6700000000000000000000000000
     , ibalance : USD81530 . 6700000000000000000000000000
     )
 , Account
     account_Cash
     ( boring : n
     , postings : 107
     , ebalance : CAD (-86746.1177845870807500000000000000) EUR41 . 1042
     , ibalance : CAD (-86746.1177845870807500000000000000) EUR41 . 1042
     )
 ]
balanceReport items:
 [ ( "account"
   , "account"
   , 0
   , Mixed
       [ Amount
           { acommodity = "CAD"
           , aquantity = -86746.11778458708075
           , aprice = NoPrice
           , astyle = AmountStylePP "L False 28 Just '.' Nothing.."
           , amultiplier = False
           }
       , Amount
           { acommodity = "EUR"
           , aquantity = 41.104211329
           , aprice = NoPrice
           , astyle = AmountStylePP "L False 4 Just '.' Nothing.."
           , amultiplier = False
           }
       , Amount
           { acommodity = "USD"
           , aquantity = 81530.67
           , aprice = NoPrice
           , astyle = AmountStylePP "L False 28 Just '.' Nothing.."
           , amultiplier = False
           }
       ]
   )
 , ( "account:OPT"
   , "OPT"
   , 1
   , Mixed
       [ Amount
           { acommodity = "USD"
           , aquantity = 81530.67
           , aprice = NoPrice
           , astyle = AmountStylePP "L False 28 Just '.' Nothing.."
           , amultiplier = False
           }
       ]
   )
 , ( "account:Cash"
   , "Cash"
   , 1
   , Mixed
       [ Amount
           { acommodity = "CAD"
           , aquantity = -86746.11778458708075
           , aprice = NoPrice
           , astyle = AmountStylePP "L False 28 Just '.' Nothing.."
           , amultiplier = False
           }
       , Amount
           { acommodity = "EUR"
           , aquantity = 41.104211329
           , aprice = NoPrice
           , astyle = AmountStylePP "L False 4 Just '.' Nothing.."
           , amultiplier = False
           }
       ]
   )
 ]
CAD-86746.1177845870807500000000000000
                            EUR41.1042
 USD81530.6700000000000000000000000000  account
CAD-86746.1177845870807500000000000000
                            EUR41.1042    Cash
USD81530.6700000000000000000000000000    OPT
--------------------
balanceReport total:
 Mixed
   [ Amount
       { acommodity = "CAD"
       , aquantity = -86746.11778458708075
       , aprice = NoPrice
       , astyle = AmountStylePP "L False 28 Just '.' Nothing.."
       , amultiplier = False
       }
   , Amount
       { acommodity = "EUR"
       , aquantity = 41.104211329
       , aprice = NoPrice
       , astyle = AmountStylePP "L False 4 Just '.' Nothing.."
       , amultiplier = False
       }
   , Amount
       { acommodity = "USD"
       , aquantity = 81530.67
       , aprice = NoPrice
       , astyle = AmountStylePP "L False 28 Just '.' Nothing.."
       , amultiplier = False
       }
   ]
CAD-86746.1177845870807500000000000000
                            EUR41.1042
 USD81530.6700000000000000000000000000

Simon Michael

unread,
Sep 1, 2022, 9:11:40 AM9/1/22
to hledger
Alas, I think your hledger version is too old to give the debug output I was hoping for (information about how -V is working).

You can find the cause by minimising your data. The comment / end comment directives can be helpful. Also try using -X COMM instead of -V, to remove some unknowns.
Reply all
Reply to author
Forward
0 new messages