Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for accounts with multiple currencies #1

Open
alexjj opened this issue Feb 7, 2016 · 8 comments
Open

Support for accounts with multiple currencies #1

alexjj opened this issue Feb 7, 2016 · 8 comments

Comments

@alexjj
Copy link

alexjj commented Feb 7, 2016

I realize this may be a long shot, as probably you made this for yourself and have no need for it, but it would be great if this supported multiple currencies/commodities for the same account.

Or perhaps an option to convert everything just to one currency to view it.

@Ikke
Copy link
Owner

Ikke commented Feb 9, 2016

Thanks, I was planning to make this more general indeed. Any idea how I could support multiple currencies / commodities?

@alexjj
Copy link
Author

alexjj commented Feb 10, 2016

You asked for an example ledger, two transactions can demonstrate it:

commodity USD
commodity GBP

2015/12/05 * Party City
    Expenses:Gift                     7.01 USD
    Assets:US:Checking

2015/12/06 * Amazon.co.uk
    Expenses:Gift                    26.28 GBP
    Liabilities:UK:BoE

The issue is when one account (Expenses:Gift) has transactions in multiple commodities.

Depending on the query, particularly with the csv command (and custom formats), I have to limit my queries with -l "commodity=~/GBP/"

edit: personally I'd be happy having everything converted to one currency, so maybe a setting to do so, but again if you're making it general others might not want that.

@adamgibbins
Copy link

+1 currently out of the box I cannot use ledger-dashboard at all, as the minute I start it it blows up with Error: Cannot convert a balance with multiple commodities to an amount I had to create a trivial wrapper forcing -X GBP on ledger and pass that to ledger-dashboard which is fine for my use case.

@Ikke
Copy link
Owner

Ikke commented Feb 15, 2016

I'm working on a fix for this.

@Ikke
Copy link
Owner

Ikke commented Feb 15, 2016

Can you try the feature/multiple-currencies branch?

@alexjj
Copy link
Author

alexjj commented Feb 16, 2016

I could only get it to work by enabling the limit_currency setting.

Although the headings: Accounts, Expenses previous month, and Expenses this month all showed no information.

Without the currency limit the error is as before. I'm not sure why the -X isn't working though.

sh.ErrorReturnCode_1
sh.ErrorReturnCode_1: 

  RAN: '/usr/bin/ledger --no-color --file=/home/alex/money/money.ledger csv  ^Income -X GBP'

  STDOUT:
"2015/10/31","","Interest","Income:Interest","GBP","-0.0065","*",""
"2015/11/30","","Interest","<Adjustment>","","0","",""


  STDERR:
While evaluating value expression:
  quoted(commodity(scrub(display_amount)))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
While converting 0.08 GBP
-0.12 USD to an amount:
While calling function 'commodity 0.08 GBP
-0.12 USD':
While calling function 'quoted <#EXPR commodity(scrub(display_amount))>':
While handling posting from "/home/alex/money/assets.us.checking.ledger", line 18:
>     
Error: Cannot convert a balance with multiple commodities to an amount

@Ikke
Copy link
Owner

Ikke commented Feb 16, 2016

-X is only working when you specify the conversion rate somewhere (pricedb, or inline). Something like this worked for me:

2015/12/05 * Party City
    Expenses:Gift                     7.01 USD @0.69GBP
    Assets:US:Checking

@blessedbiped
Copy link
Contributor

-X? What are the command switches, I'll add them to the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants