convert command: output in USD automatically?

191 views
Skip to first unread message

acobster

unread,
Jan 20, 2018, 2:13:31 PM1/20/18
to Ledger
Hi legderers,

When I run `ledger convert` on CSV files with no currency symbol in the amounts, it outputs the entries without currency symbols as well. I'd like the entries to default to USD. I can of course run an intermediate script to add these to the CSV before converting, but it's annoying to do this every time. Is there an option for the convert command to do this? Alternatively, is there a global configuration/option to tell ledger to interpret amounts w/o currencies as USD?

Thanks,
Coby

Dániel Fancsali

unread,
Jan 22, 2018, 10:25:25 AM1/22/18
to ledge...@googlegroups.com
Hello,

I think there's no straightforward way of doing that. Ledger is rather agnostic of currencies anyway. It'll happily handle as many as you wish, unlike others similar tools, where you need to have an internal/default currency.

So I myself just add another rule to the sed script that I need to process my banks rather odd looking CSV files anyway.

Hope that helps.

Regards,
Dan

--

---
You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ledger-cli+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ismael Bouya

unread,
Jan 22, 2018, 10:37:56 AM1/22/18
to ledge...@googlegroups.com
Hello,
Being agnostic to currencies is not a good reason to prevent you from
having default values :)

To answer the initial question, you could add:
------✂--------
commodity EUR
default
------✂--------
at the top of your ledger file, and thus any report with no commodity
will have EUR as commodity (chose your value of EUR of course). This
works for ledger convert in particular


(Mon, Jan 22, 2018 at 03:25:13PM +0000) Dániel Fancsali :
> On Sat, 20 Jan 2018 at 19:13 acobster <[1]acob...@gmail.com> wrote:
>
> Hi legderers,
>
> When I run `ledger convert` on CSV files with no currency symbol in the
> amounts, it outputs the entries without currency symbols as well. I'd
> like the entries to default to USD. I can of course run an intermediate
> script to add these to the CSV before converting, but it's annoying to
> do this every time. Is there an option for the convert command to do
> this? Alternatively, is there a global configuration/option to tell
> ledger to interpret amounts w/o currencies as USD?
>
> Thanks,
> Coby
>
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to [2]ledger-cli+...@googlegroups.com.
> For more options, visit [3]https://groups.google.com/d/optout.
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [4]ledger-cli+...@googlegroups.com.
> For more options, visit [5]https://groups.google.com/d/optout.
>
> References
>
> Visible links
> 1. mailto:acob...@gmail.com
> 2. mailto:ledger-cli+...@googlegroups.com
> 3. https://groups.google.com/d/optout
> 4. mailto:ledger-cli+...@googlegroups.com
> 5. https://groups.google.com/d/optout


--
Ismael
signature.asc

o1bigtenor

unread,
Jan 22, 2018, 11:59:25 AM1/22/18
to ledge...@googlegroups.com

On Mon, Jan 22, 2018 at 9:37 AM, Ismael Bouya <ismael....@normalesup.org> wrote:
Hello,
Being agnostic to currencies is not a good reason to prevent you from
having default values :)

To answer the initial question, you could add:
------✂--------
commodity EUR
  default
------✂--------
at the top of your ledger file, and thus any report with no commodity
will have EUR as commodity (chose your value of EUR of course). This
works for ledger convert in particular


Greetings

Well - - - in North America at least, you are already deemed to have a default. Your
default is you local currency and all other currencies are converted into that one. You
can report whatever in any foreign currency but any formal entries are always in relation-
ship to your default. (You're going to pay tax in relation to whatever in your local
currency!)

Not sure about the rules in other jurisdictions but if they are similar then why would you
state explicitly what is already implicitly acknowledged?

Regards

Dee

Dániel Fancsali

unread,
Jan 22, 2018, 12:21:02 PM1/22/18
to ledge...@googlegroups.com
Greetings,

On one hand, you are absolutely right. Even if I buy something from the US, I'll end up paying in my local currency. (Including paying any taxes/duties and banking fees too)

However, if you have ever lived abroad or moved across country borders, you'll most probably have holdings in more than one currencies, and – in the case of the EU for example – you'll pay taxes locally; as in where the money is. So essentially you have several parallel ledgers. In such cases, it's super useful, that everything is done in the appropriate currency, and only converted to your chosen default whenever explicitly requested. (Thus I'll see the actual balances OR the value it represents at a certain moment in my day-to-day currency)

I was referring to this in my previous message. And the fact, that all the other systems I've tried, made you think the other way around.

Regards,
Dan

--

o1bigtenor

unread,
Jan 22, 2018, 4:42:57 PM1/22/18
to ledge...@googlegroups.com
On Mon, Jan 22, 2018 at 11:20 AM, Dániel Fancsali <fanc...@gmail.com> wrote:
Greetings,

On one hand, you are absolutely right. Even if I buy something from the US, I'll end up paying in my local currency. (Including paying any taxes/duties and banking fees too)

However, if you have ever lived abroad or moved across country borders, you'll most probably have holdings in more than one currencies, and – in the case of the EU for example – you'll pay taxes locally; as in where the money is. So essentially you have several parallel ledgers. In such cases, it's super useful, that everything is done in the appropriate currency, and only converted to your chosen default whenever explicitly requested. (Thus I'll see the actual balances OR the value it represents at a certain moment in my day-to-day currency)

I was referring to this in my previous message. And the fact, that all the other systems I've tried, made you think the other way around.


Greetings

Grinning - - - as I have both lived and studied in other countries (yes - - - plural) I have run into this a wee bit.

My solution for myself is probably not at all elegant but its how I am doing things and, I think, is not too painful.

some.date       Business selling widgets
#  booked as 54.23 currency value
Expense: item name: item gifi code                           $  23.57
Expense: same as previous but different                    $  45.89
Asset: particular payment account: item gifi code       $   69.46


What this means is that on my invoice (when I enter my costs)
there were 2 items - - - their value in the 'other currency' is listed as if it were in my 'default' currency.
Then when I get my credit card statement I see and exchange rate that was used for that particular transaction.
That 'rate' is entered in the 'booked as' phrase as the number. The exchange rate is used as a multiplier to change the values in the 'other currency' to my 'default' currency.

To date I haven't ever used this as two separate statements just updating the one statement so that the values are reflected in my 'default' currency.
I have been thinking of rolling an awk (or some such) program to automate this but for now the calculator and I make quite short work of things.
The 'awk' program would be useful for when I get someone else to do my record keeping that isn't quite as facile at the math and would rather just do things rather than also know about the whys behind the doing.

This work flow enables me to use any number of different currencies and still have a 'default' one which is a requirement, in a legal sense, in my taxation jurisdiction and it also enables me to track things, which I haven't included here, like the cost of currency transactions.

Regards

Dee

acobster

unread,
Jan 22, 2018, 10:54:43 PM1/22/18
to Ledger
This works quite well for me. Thanks!
Reply all
Reply to author
Forward
0 new messages