Re: Query Help

2023-02-07 Thread Randy Josleyn

On 2/8/23 06:18, Jasel17212 wrote:

Two questions:

Is there a shorthand way to write the following query?

ledger reg ^exp and expr "has_meta('tag1')" or ^exp and expr 
"has_meta('tag2')"


This seems to work for me:

ledger reg ^exp and expr "has_meta('tag1') | has_meta('tag2')"

Sorry I don't have an answer to the second question. —Randy

--

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/82c982c0-0f38-8e9c-1709-368f2b54ccea%40gmail.com.


Re: handling multiple currencies

2020-07-24 Thread Randy Josleyn



On July 17, 2020 11:42:46 AM GMT+08:00, Martin Michlmayr  
wrote:
>BTW, I use ledger2beancount to convert my ledger file to beancount
>and then use the web UI fava to look at transactions.  I find that
>to be a very powerful combination.  Fava lets you define multiple
>operating currencies and will show them in different columns (with one
>column for all other currencies).  So for example I have columns
>EUR, GBP, USD, Other.
>
>(As a command line type person, I can't stress how useful I find
>the web UI fava.)

I'm traveling at the moment, but I'll definitely check this out when I get back 
to my computer. I do like myself a good web UI!
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/3EC03FE9-7C61-413D-9563-0C60A174B309%40gmail.com.


Re: handling multiple currencies

2020-07-24 Thread Randy Josleyn
Hi Fergus,

Thanks for sharing your experience with me. Yes, I can see how multiple 
jurisdictions would end up being a hassle, especially in your case! I'll take 
your advice and and let ledger do the heavy lifting if I need it. Luckily in my 
case I'm not trying to run a business or anything, so it's a lot more 
straightforward.

I'd be interested in reading about your experience using ledger for your 
business if you've put anything on the internet about it.

On July 15, 2020 2:00:59 AM GMT+08:00, Fergus Cameron  
wrote:
>Agree with Martin, do not try to organize accounts in relation to how
>you understand them but how they are; idea being that ledger does the
>processing to produce what you need; this is not to trivialize the
>difficulties of course but generally, what you want to see at any
>particular time changes more than things that tie into the external
>view (i.e. tax and bank).
>
>Ran small consulting business across Europe and the US using ledger
>(i.e.
>6 currencies) and made the mistake you are thinking about (at least it
>turned out to be a mistake for me).  It resulted in complex reports to
>accommodate a single, simplified view which tried to keep currencies
>separate, but in the long-run I ended up with very awkward 3 or 4 stage
>reports instead of slightly more complex 1 or 2 stage reports.  And,
>once I was that deep in, the initial desire for "can I just run
>'ledger bal' and see this", was long gone.
>
>All the best though, multiple currencies are not easy in my experience
>and multiple jurisdictions are a nightmare.
>
>On 13/07/2020, Martin Michlmayr  wrote:
>> * Randy Josleyn  [2020-07-09 22:21]:
>>> > I have 3 main currencies plus some more when I travel and I have
>no
>>> > problem.
>>>
>>> Do you mind if I ask about how you've got your accounts structured?
>>
>> I do not add the currency to my account names.  There are different
>> philosophies regarding account names and I lean towards simple
>account
>> names.
>>
>> Many accounts only have one currency in them (e.g. a bank in one
>> country), but others have several currencies and I have not had any
>> problems with this.  Something I limit the reg output to a specific
>> currency, but otherwise I don't think I use any "advanced" tricks.
>>
>> What issues do you run into specifically?
>>
>> --
>> Martin Michlmayr
>> https://www.cyrius.com/
>>
>> --
>>
>> ---
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>>
>https://groups.google.com/d/msgid/ledger-cli/20200713052832.GD8469%40jirafa.cyrius.com.
>>
>
>-- 
>
>--- 
>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+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/ledger-cli/CAHCf7OFzejAN7coBp%2BdfrY4BYbLT7rQ5H_7ywDEcMbmtq6oovA%40mail.gmail.com.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/9A345752-8E52-47CE-B412-D9F766849DB3%40gmail.com.


Re: handling multiple currencies

2020-07-16 Thread Randy Josleyn
Sorry I didn't see your reply as it got lost in a sea of new email in my inbox. 
My reply is below.

On July 13, 2020 1:28:32 PM GMT+08:00, Martin Michlmayr  wrote:
>* Randy Josleyn  [2020-07-09 22:21]:
>> > I have 3 main currencies plus some more when I travel and I have no
>> > problem.
>> 
>> Do you mind if I ask about how you've got your accounts structured?
>
>I do not add the currency to my account names. There are different
>philosophies regarding account names and I lean towards simple account
>names.
>
>Many accounts only have one currency in them (e.g. a bank in one
>country), but others have several currencies and I have not had any
>problems with this. Something I limit the reg output to a specific
>currency, but otherwise I don't think I use any "advanced" tricks.
>
>What issues do you run into specifically?

My expense accounts are already fairly numerous, and if each had two or more 
currencies in them, I felt it would be harder to read the balance and register 
reports. I've seen some sites with advice about expense categories, but the 
expense accounts still feel "messy" to me. I should probably start by 
simplifying them.

Luckily my finances are version controlled, so I feel free to experiment.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/7F3542E6-86FC-4252-B67A-D11A80EB7B1C%40gmail.com.


Re: handling multiple currencies

2020-07-09 Thread Randy Josleyn
On Thu, Jul 9, 2020 at 10:45 PM Martin Michlmayr  wrote:

>
> The syntax above is for *h*ledger.  The syntax I provided was for
> ledger.
>

Yes, I understand. Sorry if what I wrote was unclear or sounded like
judgment. I was just remarking that hledger's `cur:USD` is more concise
than ledger's `-l "commodity == 'USD'"`. Not passing judgment or anything
on either of the projects. I'm very grateful to the developers of both
projects for creating such great software—and all they get in return for
their hard work is people like me who don't know what they're doing asking
silly questions in the mailing list. ;-)

-- 
> Martin Michlmayr
> https://www.cyrius.com/
>
> --
>
> ---
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ledger-cli/20200709144532.GA28488%40jirafa.cyrius.com
> .
>

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPYN8sN1AoJL-DPxtEge76S1AGt-jC0Q37i%3Dg1EVFx-u4Q9R2Q%40mail.gmail.com.


Re: handling multiple currencies

2020-07-09 Thread Randy Josleyn
On Thu, Jul 9, 2020 at 4:51 PM Andreas Pauley  wrote:

>
>
> On Wednesday, 8 July 2020 16:45:45 UTC+2, Randy wrote:
>>
>> I’ve rolled my own version of the full-fledged hledger noted in the
>> hledger docs, where I’m mainly just using hledger to process the CSVs and
>> ledger for the rest.
>>
>
> Sounds interesting, if you've written something about your setup please
> share a link.
>
> I do happen to have a blog, but I haven't updated it in awhile. If I do
write something about this, I'll definitely let you know.

>
>
>> I was considering splitting assets and expenses by currency like below,
>> but that could also make things a bit harder to read.
>>
>
> I've found the Beancount account naming conventions useful, it suggests
> adding a country code to each account:
>
> https://beancount.github.io/docs/18_command_line_accounting_cookbook.html#account-naming-conventions
>
>
Thanks for the link, I'd never thought to look at the beancount
documentation, this was helpful.


> And to limit transactions I just use the cur filter in hledger, e.g:
> hledger bal cur:USD
>

Thanks also for this. This happens to be a lot more concise than the -l
option from ledger which Martin mentioned earlier in the thread. It's good
to know different ways to achieve a goal.


> Kind regards,
> Andreas
>
> --
>
> ---
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ledger-cli/9e3d67d2-fb40-4278-ae62-75481b286671o%40googlegroups.com
> 
> .
>

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPYN8sPTrdZw_cMN51aG9QOLLf-UzGUqJMwaOH-ruCZO_bAkOw%40mail.gmail.com.


Re: handling multiple currencies

2020-07-09 Thread Randy Josleyn
On Thu, Jul 9, 2020 at 9:09 AM Martin Michlmayr  wrote:

> * Randy Josleyn  [2020-07-08 22:45]:
> > Does anyone have any experience with tracking multiple currencies?
>
> I have 3 main currencies plus some more when I travel and I have no
> problem.
>

Do you mind if I ask about how you've got your accounts structured?


> > Perhaps there’s a simple query I could do that would limit
> > transactions to only ones with a particular currency/commodity?
>
> -l "commodity == 'USD'"
>

Thanks for this, I knew there had to be an option for it somewhere.


> --
> Martin Michlmayr
> https://www.cyrius.com/
>
> --
>
> ---
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ledger-cli/20200709010904.GB28036%40jirafa.cyrius.com
> .
>

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPYN8sPxTraszJAoN66DN6K6_dxBNxzOW92riUUTty1MqcaxUQ%40mail.gmail.com.


Re: handling multiple currencies

2020-07-09 Thread Randy Josleyn
On Thu, Jul 9, 2020 at 12:13 AM o1bigtenor  wrote:

>
>
> On Wed, Jul 8, 2020 at 9:45 AM Randy Josleyn 
> wrote:
>
>> Hi list,
>>
>> I’ve rolled my own version of the full-fledged hledger noted in the
>> hledger docs, where I’m mainly just using hledger to process the CSVs and
>> ledger for the rest.
>>
>> I live in China, but I’m American. I’m at the point where I’ve started
>> adding my American accounts and that’s all fine and dandy. However, as my
>> current tree of accounts gets more and more accounts with USD in them, it
>> gets hard to read. Does anyone have any suggestions for how to manage this
>> issue?
>>
>> I was considering splitting assets and expenses by currency like below,
>> but that could also make things a bit harder to read.
>>
>> assets
>>   cash (usd/cny)
>>   CNY
>> alipay
>> icbc
>>   USD
>> wells fargo...
>> expenses
>>   CNY
>> entertainment
>> food
>> ...
>>   USD
>> entertainment
>> food
>> ...
>>
>> Does anyone have any experience with tracking multiple currencies?
>> Perhaps there’s a simple query I could do that would limit transactions to
>> only ones with a particular currency/commodity?
>>
>> Thanks for your help!
>>
> Dealing with multiple currencies is a challenge (period full stop!!).
>
> The official line is this (AIUI).
> Your ledger is in the denomination of the country you pay taxes in.
>

(If you pay personal taxes in multiple jurisdictions - - - will that's
> massively beyond my pay grade or experience!!!.)
> Practically that means that if you reside in the USA your recordkeeping
> files should be in USD. Transactions in any other currency are converted
> into USD.
>
> I haven't even gotten to thinking about taxes, because taxes in China are
pretty much non-interactive (no tax return or the like). I'm getting ready
to move back to the US, though, and I want to be prepared with good
bookkeeping habits by the time that actually happens. It's definitely also
well beyond my own experience, as well!


Multi-national companies somehow do things a little different
> than that - - - - but in a different country - - - - they pay taxes there
> - - - -
> the books for that division are in 'that' currency  (whatever that is).
> How that
> exactly gets rolled into the 'parent' company's book - - - - dunno.
> That level of taxation I don't know and don't really want to know about.
> AIUI it would mean complying with every country's taxation codes for that
> division's ledgers (and taxation) and my guess would be that the parent
> company uses sub-journals but please note - - - - - that is a GUESS!
> (Just want to keep that clear!!).
>
> Re-reading your message - - - - you are an American living and working
> abroad.
> This, IMO, is a somewhat special case.
> I would suggest you contact the IRS for guidance because they are going to
> have a mountain of demands for you and either you're going to get ahead of
> that falling mountain or it will crush you when it gets to you!
>

Right now I've got my fingers crossed that repatriating myself and my
assets will be relatively straightforward. (I'm pretty sure it won't work
out so well, though.) Having good records will definitely help in that
regard, though. Thanks for your suggestions.

>
> Regards
>
> HTH
>
> --
>
> ---
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ledger-cli/CAPpdf58jqJqa5-4OLnrj4ecVnsufDcD0Di03K1VMA7d14e5Dyw%40mail.gmail.com
> <https://groups.google.com/d/msgid/ledger-cli/CAPpdf58jqJqa5-4OLnrj4ecVnsufDcD0Di03K1VMA7d14e5Dyw%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPYN8sP90JyYJHYfQRENR%2Buk6pm_GikEmHTG6JyFVPW3Jreu7g%40mail.gmail.com.


handling multiple currencies

2020-07-08 Thread Randy Josleyn
Hi list,

I’ve rolled my own version of the full-fledged hledger noted in the hledger
docs, where I’m mainly just using hledger to process the CSVs and ledger
for the rest.

I live in China, but I’m American. I’m at the point where I’ve started
adding my American accounts and that’s all fine and dandy. However, as my
current tree of accounts gets more and more accounts with USD in them, it
gets hard to read. Does anyone have any suggestions for how to manage this
issue?

I was considering splitting assets and expenses by currency like below, but
that could also make things a bit harder to read.

assets
  cash (usd/cny)
  CNY
alipay
icbc
  USD
wells fargo...
expenses
  CNY
entertainment
food
...
  USD
entertainment
food
...

Does anyone have any experience with tracking multiple currencies? Perhaps
there’s a simple query I could do that would limit transactions to only
ones with a particular currency/commodity?

Thanks for your help!


Randy

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPYN8sNQqZtuzTSLq9-KQbF9%3DQgs3RjD3FKYrihQBXQO%2BkO68A%40mail.gmail.com.


Re: assert an account's amount

2020-04-06 Thread Randy Josleyn
Thanks, Martin. That works exactly as I wanted it to.


Randy

On April 7, 2020 12:59:13 PM GMT+08:00, Martin Michlmayr  
wrote:
>* Randy Josleyn  [2020-04-07 12:47]:
>> I'd like to use the `assert` directive to do a balance assertion of
>> an account after `include`ing a journal file. I can't add the
>> balance assertion to the included journal itself. I tried something
>> like this:
>> 
>> assert amount account(assets:checking) == 27585.33 CNY
>
>Try:
>
>assert account("assets:checking").amount == 27585.33 CNY
>
>-- 
>Martin Michlmayr
>https://www.cyrius.com/
>
>-- 
>
>--- 
>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+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/ledger-cli/20200407045913.GG21495%40jirafa.cyrius.com.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/2A0040FB-CB24-427F-8622-019065A5D7A9%40gmail.com.


Re: assert an account's amount

2020-04-06 Thread Randy Josleyn
Hi Taylor,

I knew someone one say this as soon as I hit send :)

It does seem a little simpler than what I was trying to do. My beef with that 
is that it's not *really* a transaction, so I don't want to write it as one. 
That's really a minor reason.

What I did find is that if you have a default account set and the balance 
assignment is incorrect, the difference will end up in the default account 
instead of causing an error. That might actually be a useful side affect if you 
set the default account as something noticeable like "FAILED ASSERTION" or 
something. It would show up in your balance report and so on and still let you 
see the current state of your accounts.

Thanks for your response!

On April 7, 2020 12:51:33 PM GMT+08:00, Taylor R Campbell 
 wrote:
>> Date: Tue, 07 Apr 2020 12:47:37 +0800
>> From: Randy Josleyn 
>> 
>> I realized I could just add a transaction that assigns the balance
>> of assets:checking, but that doesn't seem like the best way to do
>> it.
>
>This is exactly what I do.  Why wouldn't it be the best way?
>
>2020-04-01 Balance assertion
>Assets:Checking   = 123.00 USD
>
>-- 
>
>--- 
>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+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/ledger-cli/20200407045133.ACA4C60A44%40jupiter.mumble.net.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/64C852DB-2DB8-4C1B-8BF8-49907395A212%40gmail.com.


assert an account's amount

2020-04-06 Thread Randy Josleyn
Hi list!

I'd like to use the `assert` directive to do a balance assertion of an account 
after `include`ing a journal file. I can't add the balance assertion to the 
included journal itself. I tried something like this:

assert amount account(assets:checking) == 27585.33 CNY

It just says that the assertion failed, which I'm sure is because I haven't 
understood how to use value expressions.

I read the documentation and noted that in section 11.1.1, there's a variable 
labelled "a" which says "... the balance of an account, without considering 
children". I tried to use that, but ledger returned "unknown identifier".

I realized I could just add a transaction that assigns the balance of 
assets:checking, but that doesn't seem like the best way to do it.

Does anyone have any suggestions on how to assert an account's balance with 
`assert` or in some other way?

Thanks!


Randy
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/4B03C9DF-8BC5-42C9-8471-26ACAAC93F87%40gmail.com.


assert an account's amount

2020-04-06 Thread Randy Josleyn
Hi list!

I'd like to use the `assert` directive to do a balance assertion of an account 
after `include`ing a journal file. I can't add the balance assertion to the 
included journal itself. I tried something like this:

assert amount account(assets:checking) == 27585.33 CNY

It just says that the assertion failed, which I'm sure is because I haven't 
understood how to use value expressions.

I read the documentation and noted that in section 11.1.1, there's a variable 
labelled "a" which says "... the balance of an account, without considering 
children". I tried to use that, but ledger returned "unknown identifier".

I realized I could just add a transaction that assigns the balance of 
assets:checking, but that doesn't seem like the best way to do it.

Does anyone have any suggestions on how to assert an account's balance with 
`assert` or in some other way?

Thanks!


Randy
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 

--- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/92C416B7-9C09-47B4-8DE2-6E7856C04C07%40gmail.com.