Open roylez opened 6 years ago
There is partial multi currency support ATM, you can select a base currency/commodity using the dropdown menu:
What kind of multi-currency support are you envisioning?
I do not see that currency selection dropdown. I am using the version from npm.
I split my ledger file by year by the way. This is how it looks like.
!include ./prices.db
!include ./data/*
and the command line I use to start ledger-analytics
ledger-analytics -f accounting --price-db ~/workspace/doc/finance/prices.db --date-format %Y-%m-%d
What does ledger -f accounting commodities
return you?
capitan roy ~/workspace/doc/finance M > ledger -f accounting commodities
$
CNY
ETH
HKD
USD
Thats weird, it should pop up. What version of ledger-analytics
are you using? And have you tried using a different browser?
It is 0.1.9-a
. Chrome/Firefox/Safari, they all show the same thing.
My ledger version is 3.1.1-20160111
, but I do not think it could be critical.
I meant the version of ledger-analytics
, not ledger-cli
Hey the app seems really cool but I have the same problem. I can make it work by going the deepest in the account structure, for example: Expenses <- doesn't work Expenses:Food <- doesn't work Expenses:Food:Work <- does work but takes all of the transactions no matter the currency (treates them as a currency set in the drop down menu)
@MrOneTwo I think its something to do with the mutli-currency thingo. I'm sure there's a way to add in extra args into ledger to fix that
If you get error like Unable to fetch timeline data (try changing your base currency/commodity)
try seeing in console why the journal file is not loading properly.
In my case I tried to feed ledger-analytics
with file located inside Dropbox, and due to the nested structures. It somehow was not loading correctly.
./node_modules/.bin/ledger-analytics -f ~/Dropbox/deeplynested/journal.dat
Then I cp
ed original file to the directory and everything worked correctly via
./node_modules/.bin/ledger-analytics -f journal.dat
.
Probably the problem is not multicurrency related for my case.
Because ledger-analytics
even would refuse to render example.ledger
for me as I run it from another machine.
I updated ledger-analytics
binary to make it listen at 0.0.0.0
however it did not solve the problem because in ledger-api.js
api calls were hardwired to be made to 127.0.0.1:3000
as well.
Running it locally
Error: Command failed: ledger reg -f accounting Assets:Cash -X $ -j -D --price-db prices.db --collapse --plot-total-format="%(format_date(date, "%Y-%m-%d")) %(abs(quantity(scrub(display_total))))"
While evaluating value expression:
quantity(scrub(display_amount))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
While converting CNY 382.00
USD 30000.00 to an amount:
While calling function 'quantity CNY 382.00
USD 30000.00':
Error: Cannot convert a balance with multiple commodities to an amount
at ChildProcess.exithandler (child_process.js:297:12)
at ChildProcess.emit (events.js:197:13)
at maybeClose (internal/child_process.js:978:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
Error: Command failed: ledger reg -f accounting Assets:CMB -X $ -j -D --price-db prices.db --collapse --plot-total-format="%(format_date(date, "%Y-%m-%d")) %(abs(quantity(scrub(display_total))))"
While evaluating value expression:
quantity(scrub(display_amount))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
While converting CNY 695.58
USD 14858.87 to an amount:
While calling function 'quantity CNY 695.58
USD 14858.87':
Error: Cannot convert a balance with multiple commodities to an amount
at ChildProcess.exithandler (child_process.js:297:12)
at ChildProcess.emit (events.js:197:13)
at maybeClose (internal/child_process.js:978:16)
at Socket.stream.socket.on (internal/child_process.js:395:11)
at Socket.emit (events.js:197:13)
at Pipe._handle.close (net.js:611:12)
Error: Command failed: ledger reg -f accounting Assets:Cash -X $ -J -M --price-db prices.db --collapse
While evaluating value expression:
quantity(scrub(display_total))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
While converting $ 14844.72
HKD 47.00 to an amount:
While calling function 'quantity $ 14844.72
HKD 47.00':
Error: Cannot convert a balance with multiple commodities to an amount
I have found that trying to --collapse
on a daily query that has multiple commodities fails in ledger cli.
To circumvent this, I skip collapsing the totals and pipe the output to awk, and sum the totals for each date manually:
ledger -f $LEDGER_FILE -X $COMMODITY -j -D reg $REPORT-QUERY | awk -F' ' '{a[$1]+=$2}END{for(x in a)print x" "a[x]}' | sort
It's far from perfect, and it's yet not well tested (which is the reason why I haven't yet submitted a pull request), but it does the job for me. Here's a diff patch: https://gist.github.com/ArtBIT/b280081cdc3fac3496464d4346525767
try ledger-analytics -f journal.dat -X INR
I have been using ledger for more than 4 years now. Although I only have AUD accounts at this moment, I have a few other currencies in older transactions. I have tried passing
--price-db
in command line, but this does not make any difference. It always gives me the followingI know it could be a little tricky to have multi-currency supported, but as years go by, you always find at some point need to keep records for transactions in other currencies.