Re: Two questions about budgeting

2023-02-03 Thread John Wiegley
> "MB" == Marcin Borkowski  writes:

MB> 1. I can do
MB> ~ Daily from 2022-01-01 to 2023-01-01
MB> ~ Daily from 2023-01-01
MB> (the intervals are closed-open, like with -b/-e).  Right?

Yes, intervals should always be closed-open, everywhere.

MB> 2. The --invert option does nothing for the `budget` report. Correct?

I wouldn't be surprised at all if that were the case.

MB> 3. If I don't provide -b, the default for the budget seems to be what was
MB> in `~ Daily from`, but the transactions from before that date also count
MB> towards the actual expenses. That probably means that I should /always/
MB> provide -b to the `budget` report. Is that right?

I would, yes.

MB> 4. If I don't provide -e, the default (for the `budget` report) is
MB> --current. Is that correct?

That sounds right.

MB> 5. If I don't provide `from` in `~ Daily`, the default seems to be the
MB> date if the /first/ transaction on a given account. Right?

Correct.

MB> 6. (Almost) last but not least -- the `budget` report gives me a table
MB> with 5 columns: - actual expenses - budgeted expenses - the difference
MB> (negative means I spent less than the budget -- a bit counterintuitive,
MB> but makes sense given the order of the previous two) - what percentage of
MB> the budget was spent - name of the account

MB> Using classical spreadsheet column names: C = A - B and D = A/B (as
MB> percentage). Do I guess correctly?

I think so?

MB> If so, this means that the web app I wrote to present this exact
MB> information is mostly irrelevant. %-P Still, it draws a nice chart which
MB> is accessible from a smartphone. I have a post-commit hook which scp's the
MB> file to my VPS, and the web app there serves the chart - that's a very
MB> useful arrangement I plan to blog about one day.

I'm glad it's useful, but definitely, custom code can always go further.

MB> Now, my final question is this. Much of what we discuss here is apparently
MB> undocumented in the Ledger manual. My book is my book, and it contains
MB> examples and such, but I think it is fair to have these options at least
MB> mentioned in the manual. I have just fetched the ledger repo, and I can
MB> see that the last commit in `ledger/doc/ledger3.texi` was 7 years ago...
MB> Would you accept a PR with a small manual update? (One minor issue with
MB> that idea is that I don't speak texinfo, so you'd have to check every my
MB> edit very carefully.)

Absolutely! I'd be honored to accept your PR.

John

-- 

--- 
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/m2bkmamw2k.fsf%40newartisans.com.


Re: Two questions about budgeting

2023-01-29 Thread Marcin Borkowski


On 2023-01-27, at 22:39, John Wiegley  wrote:

>> "MB" == Marcin Borkowski  writes:
>
>> 1. Why is there no "budget transaction" for groceries for 2022-01-01?
>
> Use this:
>
> ~ Daily from 2022-01-01

Great, thanks!

>> 2. I would assume that after these three days my "books" budget should
>>allow me to spend 155 PLN more on books and my "food" budget would
>>be short of 30 PLN.  Yet I can see neither of these amounts in the
>>report.  How to make Ledger compute them?
>
> Did you try the "budget" report?

No, it looks /very/ good!

I did some experiments, and here is what I came up with.  Can you
confirm that I guessed correctly?

1. I can do

~ Daily from 2022-01-01 to 2023-01-01

~ Daily from 2023-01-01

(the intervals are closed-open, like with -b/-e).  Right?

2. The --invert option does nothing for the `budget` report.  Correct?

3. If I don't provide -b, the default for the budget seems to be what
was in `~ Daily from`, but the transactions from before that date also
count towards the actual expenses.  That probably means that I should
/always/ provide -b to the `budget` report.  Is that right?

4. If I don't provide -e, the default (for the `budget` report) is
--current.  Is that correct?

5. If I don't provide `from` in `~ Daily`, the default seems to be the
date if the /first/ transaction on a given account.  Right?

6. (Almost) last but not least -- the `budget` report gives me a table
with 5 columns:
   - actual expenses
   - budgeted expenses
   - the difference (negative means I spent less than the budget --
 a bit counterintuitive, but makes sense given the order of the
 previous two)
   - what percentage of the budget was spent
   - name of the account

Using classical spreadsheet column names: C = A - B and D = A/B (as
percentage).  Do I guess correctly?

If so, this means that the web app I wrote to present this exact
information is mostly irrelevant. %-P  Still, it draws a nice chart
which is accessible from a smartphone.  I have a post-commit hook which
scp's the file to my VPS, and the web app there serves the chart -
that's a very useful arrangement I plan to blog about one day.

Now, my final question is this.  Much of what we discuss here is
apparently undocumented in the Ledger manual.  My book is my book, and
it contains examples and such, but I think it is fair to have these
options at least mentioned in the manual.  I have just fetched the
ledger repo, and I can see that the last commit in
`ledger/doc/ledger3.texi` was 7 years ago...  Would you accept a PR with
a small manual update?  (One minor issue with that idea is that I don't
speak texinfo, so you'd have to check every my edit very carefully.)

Best,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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/877cx4ef47.fsf%40mbork.pl.


Re: Two questions about budgeting

2023-01-27 Thread John Wiegley
> "MB" == Marcin Borkowski  writes:

> 1. Why is there no "budget transaction" for groceries for 2022-01-01?

Use this:

~ Daily from 2022-01-01

> 2. I would assume that after these three days my "books" budget should
>allow me to spend 155 PLN more on books and my "food" budget would
>be short of 30 PLN.  Yet I can see neither of these amounts in the
>report.  How to make Ledger compute them?

Did you try the "budget" report?

John

-- 

--- 
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/m2357vmzbx.fsf%40newartisans.com.


Re: Two questions about budgeting

2023-01-25 Thread Ihor Radchenko
Marcin Borkowski  writes:

>> I see. Why don't just use daily budget then?
>> The daily budget gets applied progressively, and I know how much I can
>> spend each day.
>
> That's what I wanted to do.  But since the daily budget apparently does
> not kick in on days when I spent nothing on e.g. food, this is of little
> use for me...  If my daily budget is 20 PLN and I spend nothing on
> a particular day, I expect to be "allowed" to spend 40 PLN on the next
> day.

Sorry, I think you missed my first reply.

Try

~ Daily from 2022
Expenses:Food  30.00 PLN
Assets

2022-01-02 Groceries
Expenses:Food  20.00 PLN
Assets:Cash

2022-01-03 C.S.Lewis "That hideous strength"
Expenses:Books 45.00 PLN
Assets:Cash

2022-01-03 Groceries
Expenses:Food  100.00 PLN
Assets:Cash


> ledger reg -f /tmp/test.dat ^expenses -b 2022-01-01 -e 2022-01-04 -y %Y-%m-%d 
> --invert --budget
2022-01-01 Budget transactionExpenses:Food  
30.00 PLN30.00 PLN
2022-01-02 Budget transactionExpenses:Food  
30.00 PLN60.00 PLN
2022-01-02 Groceries Expenses:Food  
   -20.00 PLN40.00 PLN
2022-01-03 Budget transactionExpenses:Food  
30.00 PLN70.00 PLN
2022-01-03 Groceries Expenses:Food  
  -100.00 PLN   -30.00 PLN

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 

-- 

--- 
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/87wn59kerr.fsf%40localhost.


Re: Two questions about budgeting

2023-01-25 Thread Marcin Borkowski


On 2023-01-25, at 21:14, Ihor Radchenko  wrote:

> Marcin Borkowski  writes:
>
>>> But isn't it already the case? The balance with budget already provides
>>> this info.
>>
>> What it doesn't do (or at least I can't do it) is to tell me that
>> (sticking to the example above) my food budget /for Jan 25/ is ~484 PLN,
>> so if I already spent 480 PLN, I'm good.  Ledger can only tell me that
>> I can still spend 120 PLN /until the end of the month/, which is the
>> same mathematically -- but doing these calculations in your head is not
>> always easy.
>
> I see. Why don't just use daily budget then?
> The daily budget gets applied progressively, and I know how much I can
> spend each day.

That's what I wanted to do.  But since the daily budget apparently does
not kick in on days when I spent nothing on e.g. food, this is of little
use for me...  If my daily budget is 20 PLN and I spend nothing on
a particular day, I expect to be "allowed" to spend 40 PLN on the next
day.

Best,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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/87cz71onpl.fsf%40mbork.pl.


Re: Two questions about budgeting

2023-01-25 Thread Ihor Radchenko
Marcin Borkowski  writes:

>... Still, it looks like
> there's a bug with ~Daily~ periodic transactions: if I have a ~Daily~
> ~Food~ expense of 30 PLN, it is only counted towards my budget on days
> an actual ~Food~ expense was made.

I think that ~ Daily alone is ambiguous. When should it start? Infinite
years back? You need to specify at least "from" in addition. Otherwise,
what ledger does kind of makes sense - budget only when you actually
spend. Anything else would be insane.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 

-- 

--- 
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/87sffylp2u.fsf%40localhost.


Re: Two questions about budgeting

2023-01-25 Thread Ihor Radchenko
Marcin Borkowski  writes:

>> I think that ~ Daily alone is ambiguous. When should it start? Infinite
>> years back? You need to specify at least "from" in addition. Otherwise,
>> what ledger does kind of makes sense - budget only when you actually
>> spend. Anything else would be insane.
>
> Well, yes and no -- I took care to supply `--begin` in my Ledger
> invocation.

> By the way, is there a way to supply a starting date /in the Ledger file
> itself/?

I meant

~ Daily from 2023/01/01
Expenses:Food  ...
Assets:Checking

Not sure about global "from".

> Also, daily budget makes /a lot/ of practical sense.  If my monthly food
> budget is, say, 600 PLN, it's Jan 25 and I've spent 480 PLN on food,
> I can't immediately tell if I'm overspending or not.  For the record,
> I wrote myself a very simple web app which gets data from Ledger and
> displays my spending this month against budget computed /for today/ (so
> in the above case it would tell me that I'm ahead of my budget).

Yup, I totally agree that it is useful. I have such thing too :)
https://github.com/yantar92/emacs-config/blob/master/system-config.org#continuous-monitoring-of-budget
Displayed right at my status bar.

> It
> would be cool if Ledger could provide such information, too...

But isn't it already the case? The balance with budget already provides
this info.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 

-- 

--- 
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/878rhqlcmd.fsf%40localhost.


Re: Two questions about budgeting

2023-01-25 Thread Ihor Radchenko
Marcin Borkowski  writes:

>> But isn't it already the case? The balance with budget already provides
>> this info.
>
> What it doesn't do (or at least I can't do it) is to tell me that
> (sticking to the example above) my food budget /for Jan 25/ is ~484 PLN,
> so if I already spent 480 PLN, I'm good.  Ledger can only tell me that
> I can still spend 120 PLN /until the end of the month/, which is the
> same mathematically -- but doing these calculations in your head is not
> always easy.

I see. Why don't just use daily budget then?
The daily budget gets applied progressively, and I know how much I can
spend each day.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 

-- 

--- 
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/87zga6jrr9.fsf%40localhost.


Re: Two questions about budgeting

2023-01-25 Thread Marcin Borkowski


On 2023-01-25, at 18:58, Ihor Radchenko  wrote:

> I meant
>
> ~ Daily from 2023/01/01
> Expenses:Food  ...
> Assets:Checking
>
> Not sure about global "from".

Ah, I see.

>> Also, daily budget makes /a lot/ of practical sense.  If my monthly food
>> budget is, say, 600 PLN, it's Jan 25 and I've spent 480 PLN on food,
>> I can't immediately tell if I'm overspending or not.  For the record,
>> I wrote myself a very simple web app which gets data from Ledger and
>> displays my spending this month against budget computed /for today/ (so
>> in the above case it would tell me that I'm ahead of my budget).
>
> Yup, I totally agree that it is useful. I have such thing too :)
> https://github.com/yantar92/emacs-config/blob/master/system-config.org#continuous-monitoring-of-budget
> Displayed right at my status bar.
>
>> It
>> would be cool if Ledger could provide such information, too...
>
> But isn't it already the case? The balance with budget already provides
> this info.

What it doesn't do (or at least I can't do it) is to tell me that
(sticking to the example above) my food budget /for Jan 25/ is ~484 PLN,
so if I already spent 480 PLN, I'm good.  Ledger can only tell me that
I can still spend 120 PLN /until the end of the month/, which is the
same mathematically -- but doing these calculations in your head is not
always easy.

Best,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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/87h6weo0jw.fsf%40mbork.pl.


Re: Two questions about budgeting

2023-01-25 Thread Marcin Borkowski


On 2023-01-25, at 14:29, Ihor Radchenko  wrote:

> Marcin Borkowski  writes:
>
>>... Still, it looks like
>> there's a bug with ~Daily~ periodic transactions: if I have a ~Daily~
>> ~Food~ expense of 30 PLN, it is only counted towards my budget on days
>> an actual ~Food~ expense was made.
>
> I think that ~ Daily alone is ambiguous. When should it start? Infinite
> years back? You need to specify at least "from" in addition. Otherwise,
> what ledger does kind of makes sense - budget only when you actually
> spend. Anything else would be insane.

Well, yes and no -- I took care to supply `--begin` in my Ledger
invocation.

By the way, is there a way to supply a starting date /in the Ledger file
itself/?

Also, daily budget makes /a lot/ of practical sense.  If my monthly food
budget is, say, 600 PLN, it's Jan 25 and I've spent 480 PLN on food,
I can't immediately tell if I'm overspending or not.  For the record,
I wrote myself a very simple web app which gets data from Ledger and
displays my spending this month against budget computed /for today/ (so
in the above case it would tell me that I'm ahead of my budget).  It
would be cool if Ledger could provide such information, too...

Best,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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/87ilguo6gy.fsf%40mbork.pl.


Re: Two questions about budgeting

2023-01-24 Thread Marcin Borkowski


On 2023-01-24, at 08:52, Marcin Borkowski  wrote:

> Hi all,
>
> as I mentioned previously, I finally decided to finish my booklet about
> Ledger, and I really want to show how to do budgeting with it.
>
> However, I myself cannit grok it.  Please help.
>
> [...]

Hi all,

I figured out (a few) things.  First of all, using ~bal~ instead of
~reg~ helped (as did adding ~--monthly~).  Still, it looks like
there's a bug with ~Daily~ periodic transactions: if I have a ~Daily~
~Food~ expense of 30 PLN, it is only counted towards my budget on days
an actual ~Food~ expense was made.

Is this by design?  If so, how do I get the correct budget?  The
problem with using a ~Monthly~ budget amounts is that they don't tell
me /in the middle of the month/ if I'm ahead or behind -- I hoped
~Daily~ periodic transactions could help with that...

Best,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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/87k01bnsa5.fsf%40mbork.pl.


Two questions about budgeting

2023-01-23 Thread Marcin Borkowski
Hi all,

as I mentioned previously, I finally decided to finish my booklet about
Ledger, and I really want to show how to do budgeting with it.

However, I myself cannit grok it.  Please help.

Here is my example file (totally fake).

--8<---cut here---start->8---
~ Daily
Expenses:Food  30.00 PLN
Assets

~ Monthly
Expenses:Books200.00 PLN
Assets

2022-01-02 Groceries
Expenses:Food  20.00 PLN
Assets:Cash

2022-01-03 C.S.Lewis "That hideous strength"
Expenses:Books 45.00 PLN
Assets:Cash

2022-01-03 Groceries
Expenses:Food  100.00 PLN
Assets:Cash
--8<---cut here---end--->8---

I ran a budgeting command against this file, and I don't know how to
interpret its output.

--8<---cut here---start->8---
$ ledger reg -f budget-example.ledger ^expenses -b 2022-01-01 -e 2022-01-04 -y 
%Y-%m-%d --invert --budget
2022-01-02 Budget transaction  Expenses:Food30.00 PLN   30.00 PLN
2022-01-01 Budget transaction  Expenses:Books  200.00 PLN  230.00 PLN
2022-01-02 Groceries   Expenses:Food   -20.00 PLN  210.00 PLN
2022-01-03 Budget transaction  Expenses:Food30.00 PLN  240.00 PLN
2022-01-03 C.S.Lewis "..." Expenses:Books  -45.00 PLN  195.00 PLN
2022-01-03 Groceries   Expenses:Food  -100.00 PLN   95.00 PLN
--8<---cut here---end--->8---

1. Why is there no "budget transaction" for groceries for 2022-01-01?
2. I would assume that after these three days my "books" budget should
   allow me to spend 155 PLN more on books and my "food" budget would
   be short of 30 PLN.  Yet I can see neither of these amounts in the
   report.  How to make Ledger compute them?

TIA,

-- 
Marcin Borkowski
http://mbork.pl

-- 

--- 
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/87mt68nzd8.fsf%40mbork.pl.