Scheduling transactions in ledger-mode

930 views
Skip to first unread message

Alan Schmitt

unread,
Mar 10, 2014, 2:32:29 PM3/10/14
to ledger-cli
Hello,

I'm migrating my finance tracking from MoneyWell to ledger, and after
reading the documentation on ledger-mode, I still have one question.

According to the documentation
(http://ledger-cli.org/3.0/doc/ledger-mode.html#Scheduling-Transactions),
it is possible to schedule occurrences of repeating transactions in
a separate file using a special format. However there are not many
details in the documentation. Could someone show me how to do it?

Thanks a lot,

Alan

Craig Earls

unread,
Mar 10, 2014, 6:09:16 PM3/10/14
to ledge...@googlegroups.com
Here is a sample:

[*/*/10] (POS) Commissary
; :Expected:
Expenses:Groceries $300.00
Assets:VWCU:Joint

[*/*/11] (DIR) CUNA
; :Expected:
Expenses:Insurance:Life $27.50
Assets:NFCU:Checking

[*/*/12] (DIR) USAA Life
; :Expected:
; Payment: Direct
Expenses:Insurance:Life $200.00
Assets:VWCU:Joint

[*/*/13] (DEB) Trico Electric
; :Expected:
; Payment: Direct
Expenses:Utilities:Electric $150.00
Assets:VWCU:Joint


[*/*/14] (DEB) Netflix
; :Expected:
; Payment: Direct
Expenses:Entertainment $35.00
Assets:VWCU:Joint

[*/02/15 */04/15 */06/15 */08/15 */10/15 */12/15] (DEB) Orkin
; Even Months
; :Expected:
; Payment: Direct
Expenses:Home $90.00
Assets:VWCU:Joint
> --
>
> ---
> 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.



--
Craig, Corona De Tucson, AZ
enderw88.wordpress.com

Craig Earls

unread,
Mar 10, 2014, 6:10:34 PM3/10/14
to ledge...@googlegroups.com
BTW this is a part of ledger-mode in emacs it is not part of
ledger-cly if you are not using emacs it won't help you.

Alan Schmitt

unread,
Mar 11, 2014, 8:52:58 AM3/11/14
to ledge...@googlegroups.com
Hello Craig,

> BTW this is a part of ledger-mode in emacs it is not part of
> ledger-cly if you are not using emacs it won't help you.

Yes, I'm looking at how to do this within emacs.

Craig Earls <ende...@gmail.com> writes:

> Here is a sample:
>
> [*/*/10] (POS) Commissary
> ; :Expected:
> Expenses:Groceries $300.00
> Assets:VWCU:Joint

How do I generate a real transaction from this? The doc says "Ledger
mode provides a way to schedule upcoming transaction with a flexible
scheduler that allows you to specify the transactions in a separate
ledger file and calculate the upcoming occurences of those transactions.
You can then copy the transactions into your live data file." but
I don't know what command to use.

I tried to copy and paste your example in ledger-mode, and I don't see
anything in the menu. Is there a default command / keyboard shortcut?

Thanks,

Alan

Alan Schmitt

unread,
Mar 13, 2014, 7:29:15 AM3/13/14
to ledge...@googlegroups.com
Alan Schmitt <alan.s...@polytechnique.org> writes:

> Hello Craig,
>
>> BTW this is a part of ledger-mode in emacs it is not part of
>> ledger-cly if you are not using emacs it won't help you.
>
> Yes, I'm looking at how to do this within emacs.
>
> Craig Earls <ende...@gmail.com> writes:
>
>> Here is a sample:
>>
>> [*/*/10] (POS) Commissary
>> ; :Expected:
>> Expenses:Groceries $300.00
>> Assets:VWCU:Joint
>
> How do I generate a real transaction from this? The doc says "Ledger
> mode provides a way to schedule upcoming transaction with a flexible
> scheduler that allows you to specify the transactions in a separate
> ledger file and calculate the upcoming occurences of those transactions.
> You can then copy the transactions into your live data file." but
> I don't know what command to use.

I've figured this out, so here it is if it can help others.

- customize the ledger-schedule-file variable to point to the file where
you want to put the upcoming transactions (default value is ...)
- create this file, and add a transaction there:
#+begin_src ledger
[*-*-15] Test
Expenses:Quotidien 10 €
Assets:SG Alan
#+end_src
- in your main ledger file, choose menu item "Ledger" then "Show
Upcoming Transactions", bound to "C-c C-u", bound to the function
"ledger-schedule-upcoming". By default it will look at 7 days in the
past and 14 days in the future to propose transactions (see customize
group ledger-schedule to change these values)
- copy and paste the transactions you want to your main ledger file

Best,

Alan

Craig Earls

unread,
Mar 13, 2014, 7:58:37 AM3/13/14
to ledge...@googlegroups.com, ledge...@googlegroups.com
Thanks for the write-up. I am not completely finished with the scheduling engine yet. I want to add day names rather than simple dates (like "every fourth Friday"). I am also not completely happy with the user interface so suggestions for usability would be most welcome. 
--
Craig


Alan Schmitt

unread,
Mar 13, 2014, 8:51:41 AM3/13/14
to ledge...@googlegroups.com
"Craig Earls" <ende...@gmail.com> writes:

> Thanks for the write-up. I am not completely finished with the
> scheduling engine yet. I want to add day names rather than simple dates
> (like "every fourth Friday").

Is it possible to have something like "every 10th of the month until
such date"? If so, I could definitely use it.

> I am also not completely happy with the user interface so suggestions
> for usability would be most welcome.

Two things that would be most useful:
- hide transactions already entered (I see there is a function that
should do that in the future, but whose body is empty at the moment);
- use a key-combination to send the transaction to the main file. This
would require specifying the file to send it to (it could be some
information at the top of the file). Without thinking about it, I hit
"C-c C-c" on a transaction expecting it to be copied to the main ledger
file.

Having the main ledger file location could also help with tab-completion
of names when creating scheduled transactions, if there was a way to
look up the names there.

Finally, it would be nice to have the syntax highlighting for the date
(right now the square brackets are not highlighted). As a great bonus,
a tool tip displaying the next occurrence(s) of a transaction would be
wonderful.

I guess I'll stop here with the suggestions ;-) Thank you for this
scheduling support, I find it very helpful.

Alan

Craig Earls

unread,
Mar 13, 2014, 9:47:16 AM3/13/14
to ledge...@googlegroups.com
Great suggestions. I will add those to the TODO list. Right now I
have no limiting (the "until" clause you mention) function in the date
engine. I am not sure if it could be done without major rework.
> --
>
> ---
> 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.



flyingk...@gmail.com

unread,
Aug 12, 2020, 11:03:06 AM8/12/20
to Ledger
Hi Alan,

great, your instructions helped a lot!
I really wish something like this would be included in the official docs.


On Thursday, March 13, 2014 at 7:29:15 AM UTC-4, Alan Schmitt wrote:
By default it will look at 7 days in the
  past and 14 days in the future to propose transactions (see customize
  group ledger-schedule to change these values)


Could you post an example?
Tried to find any documentation about that but came up empty :-(

Thanks!! 

flyingk...@gmail.com

unread,
Aug 12, 2020, 1:41:16 PM8/12/20
to Ledger
On Thursday, March 13, 2014 at 7:29:15 AM UTC-4, Alan Schmitt wrote:
By default it will look at 7 days in the
  past and 14 days in the future to propose transactions (see customize
  group ledger-schedule to change these values)


Could you post an example?
Tried to find any documentation about that but came up empty :-(

I figured it out, in case anybody comes across this discussion:

  (setq ledger-schedule-look-forward 30)
  (setq ledger-schedule-look-backward 14)
 
Still think it would be good if that could be documented somewhere....

Scott Carpenter

unread,
Aug 12, 2020, 1:47:56 PM8/12/20
to Ledger
For future searchers of scheduling options, I'll put a pitch in for my ledgerbil scheduler. 😀

Felipe Mica

unread,
Sep 23, 2021, 3:12:06 PM9/23/21
to Ledger
Thank you! It works. That was hard to find. The doc is really poor explained.

But I didn't need to put the #+begin_src ledger / #+end_src part. It's optional. And my default file is ~/.ledger-schedule.ledger.
Reply all
Reply to author
Forward
0 new messages