Best practice for managing ledger data?

1,303 views
Skip to first unread message

ed

unread,
Jun 22, 2010, 4:58:06 PM6/22/10
to Ledger
Working towards establishing my first ledger system and wondering how
to go about version control, backups, security etc.

How do people enter and manage their data? emacs, gnucash, other? I
want to check out gnucash and am wondering about maintaining a
database in mysql/sqlite/postgres so I can get some form of integrity
checking and audit trail.

Just curious what other people are using.

Ed

John Wiegley

unread,
Jun 22, 2010, 4:59:18 PM6/22/10
to ledge...@googlegroups.com
On Jun 22, 2010, at 4:58 PM, ed wrote:

> Just curious what other people are using.

I use Emacs, Git and Dropbox.

John

Zack Williams

unread,
Jun 22, 2010, 5:04:43 PM6/22/10
to ledge...@googlegroups.com
> How do people enter and manage their data? emacs, gnucash, other? I
> want to check out gnucash and am wondering about maintaining a
> database in mysql/sqlite/postgres so I can get some form of integrity
> checking and audit trail.

I use git for storage and offsite backup, with multiple files included
into the master file. About 90% of my ledger files are generated from
scripts (PHP and perl).

- Zack

Thomas Bikeev

unread,
Jun 22, 2010, 5:08:27 PM6/22/10
to Ledger
Perl and python scripts, vim, git, dropbox. Trying to put together a
web-interface though to make it all work together.

Thomas

Peter Keen

unread,
Jun 22, 2010, 5:09:16 PM6/22/10
to ledge...@googlegroups.com
I also use emacs and dropbox. The built-in versioning in dropbox is
good enough for my purposes. I also rsync to another local machine by
hand. If you're worried about keeping an audit trail you can't do much
better than git, which can record the user name and exact time of
every change you make, along with a cryptographically secure integrity
check (the internal identifier for every commit is the SHA1 of the
contents of the file, the header information, and the parent commit's
SHA1). Git also makes it really easy to push those changes out to
another place for backup purposes.

Leandro Henrique Oliveira Fernandes

unread,
Jun 22, 2010, 7:26:29 PM6/22/10
to ledge...@googlegroups.com

I use emacs, unison (sync) and rsync.net. The last is very interest
paid service.
Unison does not do control version but it can save backup history that
is enough for me. I am thinking in using (emacs + unison + rsync ) on
maemo OS (smartphone N900). But I generate my ledger file by hand
using ledger-mode in emacs. I am interest to know what other people
are doing with those perl and python scripts.

Felipe Magno de Almeida

unread,
Jun 22, 2010, 7:38:11 PM6/22/10
to ledge...@googlegroups.com
On Tue, Jun 22, 2010 at 8:26 PM, Leandro Henrique Oliveira Fernandes
<leand...@gmail.com> wrote:
>
> I use emacs, unison (sync) and rsync.net. The last is very interest
> paid service.
> Unison does not do control version but it can save backup history that
> is enough for me. I am thinking in using (emacs + unison + rsync ) on
> maemo OS (smartphone N900). But I generate my ledger file by hand
> using ledger-mode in emacs. I am interest to know what other people
> are doing with those perl and python scripts.

It would be nice if there were some HOWTO and php/python source-code
for setting up a HTTP server(apache) for entering data on ledger file
and getting reports.
And it would be *really* cool if it were integrated with gnuplot for
generating on-the-fly graphs.

Regards,
--
Felipe Magno de Almeida

Thierry Volpiatto

unread,
Jun 23, 2010, 1:48:51 AM6/23/10
to ledge...@googlegroups.com
ed <ed.te...@gmail.com> writes:

I use emacs and mercurial.
To reconcile,
i convert the csv file of my bank to an org table, then i split window
in three, one with org table, one with ledger file, and one with the
reconcile buffer.
To add entries to ledger file, i use some functions in addition
ledger.el.
You can find these tools here:
http://mercurial.intuxication.org/hg/emacs-utils
They are for my personal use, so they may not work for you, just adapt
for yourself.(specially csv2org).

--
Thierry Volpiatto
Gpg key: http://pgp.mit.edu/

John Wiegley

unread,
Jun 23, 2010, 2:43:26 AM6/23/10
to ledge...@googlegroups.com
On Jun 23, 2010, at 1:48 AM, Thierry Volpiatto wrote:

> To reconcile,
> i convert the csv file of my bank to an org table, then i split window
> in three, one with org table, one with ledger file, and one with the
> reconcile buffer.

Just so you know, Ledger 3.0 has a new command: convert.

Give convert a pathname to a CSV file, where the columns are identified
(with names like Payee, Amount, Total (optional), etc), and it will attempt
to identify the target accounts based on historical usage in your journal
file. It only gets things partly right, but for me it's enough to make
quick headway.

Use it with the --account=NAME option, and --invert, to set the source
account name and whether it's an asset or liability type account.

John

Thierry Volpiatto

unread,
Jun 23, 2010, 4:32:57 AM6/23/10
to ledge...@googlegroups.com
John Wiegley <jo...@newartisans.com> writes:

> On Jun 23, 2010, at 1:48 AM, Thierry Volpiatto wrote:
>
>> To reconcile,
>> i convert the csv file of my bank to an org table, then i split window
>> in three, one with org table, one with ledger file, and one with the
>> reconcile buffer.
>
> Just so you know, Ledger 3.0 has a new command: convert.

Nice, i am using 2.6.2 at the moment, i tried to build 3.0 whithout
success some months ago, i guess it is stable now, i will try again.

> Give convert a pathname to a CSV file, where the columns are identified
> (with names like Payee, Amount, Total (optional), etc), and it will attempt
> to identify the target accounts based on historical usage in your journal
> file. It only gets things partly right, but for me it's enough to make
> quick headway.

It seem what you describe convert a ledger file to a CSV one no?
What i need is convert CSV file to something readable.
The best i found to use with emacs is org table.

> Use it with the --account=NAME option, and --invert, to set the source
> account name and whether it's an asset or liability type account.

Simon Michael

unread,
Jun 23, 2010, 12:35:25 PM6/23/10
to ledge...@googlegroups.com
I keep my data files in darcs (the simplest vcs I know). It helps me see what's recently changed and also to track down
the cause when some error disrupts my reconciled balances. Committing is a bit tedious, I do it infrequently and use
unison to sync my working directory between home and road machines (everything except _darcs directory). I run unison
before and after heading out on the road, or if I forget unison helps me reconcile the copies. This works pretty well
(after some unison learning curve). Two copies provides some reliability, also the home machine, a mac, is backed up by
Time Machine.

I keep most frequent options and scripts in a makefile, see part of it at http://gist.github.com/447724 .

I download csv data from banks and use hledger convert (ledger's convert is similar) to convert these to .journal files
(make move-csv convert-csv). When I see postings that weren't automatically categorised to the right account, I add a
suitable regexp to the appropriate .rules file so that next time the conversion will be better. Then I copy/paste new
transactions from the converted journals into my main journal using emacs and ledger-mode.

Other miscellaneous data entry (cash transactions) and edits are also done with emacs and ledger-mode, either by copying
& editing a similar transaction or entering a new one in which case ledger-mode's account name completion is very
useful. I don't use hledger's web ui for data entry, but I'm about to set it up for my girlfriend.

As for security/privacy, all the above is kept in ~/finance/, a separate directory to remind me to keep it more private.
make fixperms sets some restrictive file permissions, for what that's worth. I didn't find a way to keep it encrypted
and still easy to work with. I don't put this data on any permanently-connected server machine.

John Wiegley

unread,
Jun 23, 2010, 3:48:20 PM6/23/10
to ledge...@googlegroups.com
Thierry Volpiatto <thierry....@gmail.com> writes:

> It seem what you describe convert a ledger file to a CSV one no?
> What i need is convert CSV file to something readable.
> The best i found to use with emacs is org table.

The "convert" command prints a CSV file as a Ledger file. The "csv" command
prints a Ledger file as a CSV file.

John

Thierry Volpiatto

unread,
Jun 23, 2010, 4:09:20 PM6/23/10
to ledge...@googlegroups.com
John Wiegley <jwie...@gmail.com> writes:

Ah! yes very nice.

ed

unread,
Jun 24, 2010, 5:49:32 AM6/24/10
to Ledger
Another question: How about validating transactions? I can think of 2
or 3 things I'd like to manage.

Firstly ensuring that account names are spelt correctly (pre-declaring
valid account names I guess).

Second is declaring pairs of accounts between which transfers could
validly occur, so that e.g money could not be transferred from a
contingency account to the director's loan account.

Third the imposition of sanity limits on transaction amounts, e.g.
flag anything > £5000

I realise this is pushing the boundaries of ledger somewhat (though
the first I'd argue is necessary) What I'm wondering if there was some
way of providing user-defined constraints, against which transactions
were checked, this could be done as a 'plugin' or some form of pre-
processor. Easy enough to write but how could it be incorporated into
the workflow?

Simon Michael

unread,
Jun 24, 2010, 10:20:34 AM6/24/10
to ledge...@googlegroups.com
I think you could write those sort of constraints using ledger's advanced matching expressions. Then have an external
script which verifies those reports are empty. shelltestrunner (based on ledger's test harness) is one tool that could
help. Or, this might work as a built-in "ledger check" command.

John Wiegley

unread,
Jun 24, 2010, 3:09:03 PM6/24/10
to ledge...@googlegroups.com
On Jun 24, 2010, at 5:49 AM, ed wrote:

> Firstly ensuring that account names are spelt correctly (pre-declaring
> valid account names I guess).

The --strict option will warn you if an uncleared transaction contains a
never-before-seen account name. Cleared transactions are assumed to be
correct -- since you cleared them.

> Second is declaring pairs of accounts between which transfers could
> validly occur, so that e.g money could not be transferred from a
> contingency account to the director's loan account.

You can do this with the "check" keyword and an automated transaction:

= /Checking/
check account =~ /Expense/

2010-06-24 Sample
Expenses:Food $100
Assets:Checking

Use "assert" instead of "check" if you want it to be an error.

> Third the imposition of sanity limits on transaction amounts, e.g.
> flag anything > £5000

Again, using an automated check:

= true
check abs(amount) < 5000

By comparing the amount to an integer, it ignores the commodity and only
compares the magnitude.

NOTE: Be sparing with how many automated transactions you create. Each one
must be evaluated for every posting in your file, so the amount of time required
is N*Y, where N is the number of postings and Y is the number of automated
transactions.

John

John Wiegley

unread,
Jun 24, 2010, 8:39:14 PM6/24/10
to ledge...@googlegroups.com
On Jun 24, 2010, at 3:09 PM, John Wiegley wrote:

>> Second is declaring pairs of accounts between which transfers could
>> validly occur, so that e.g money could not be transferred from a
>> contingency account to the director's loan account.
>
> You can do this with the "check" keyword and an automated transaction:
>
> = /Checking/
> check account =~ /Expense/
>
> 2010-06-24 Sample
> Expenses:Food $100
> Assets:Checking
>
> Use "assert" instead of "check" if you want it to be an error.

Just as a side-note: You can still confirm this at the end of the file
using:

check account("Assets:Checking").all(account =~ /Expense/)

However, this will not tell you where the problem came from. That's OK
if you are actively using version control and can identify which set of
changes introduced the problem, but otherwise automated transactions are
the surest way to find the cause.

John

Xavier Shay

unread,
Jun 25, 2010, 7:30:28 PM6/25/10
to Ledger
> Just curious what other people are using.
Ruby to download and transform OFX files from my bank and collating
reports, VIM to edit (emacs is probably better for ledger, I haven't
tried yet), git for source control. I store each account in its own
file and have my own script to call ledger at bin/ledger that includes
all files.

Roel Vanhout

unread,
Jun 26, 2010, 7:54:52 AM6/26/10
to ledge...@googlegroups.com
On Tue, Jun 22, 2010 at 10:58 PM, ed <ed.te...@gmail.com> wrote:
> Working towards establishing my first ledger system and wondering how
> to go about version control, backups, security etc.
> How do people enter and manage their data?

I'm on Windows and I've got a setup of editing with Vim, store data
file + documentation (various accounts etc.) in a Truecrypt volume on
Dropbox. I've got a bunch of batch files that make for a rudimentary
menu system with the most common queries/reports, and do automatic
mounting of the truecrypt volume. Only been doing it for a few weeks
and I don't sync automatically with bank accts (prefer manual for the
extra checking) but it's working great so far. I love Dropbox.

Apart from this, yesterday I found a great resource with free books
about accounting (requires email address to download + books have some
ads, but the site is legit, i.e. from a mainstream newspaper here in
the Netherlands). It's very nice to get a basis in the fundamentals of
accounting, or refresh things you don't quite remember from your
business accounting classes :) They have books in both Dutch &
English, check out http://www.depers.nl/studieboeken/


cheers,

roel

Eric Betts

unread,
Jun 29, 2010, 5:13:21 PM6/29/10
to Ledger
I keep my ledger files in a directory that is backed up, although I've
been tempted to put them into git or Dropbox. I have a file for each
month, plus one for my budget, my planned purchases (future
transactions) and one for expected income (future rebates, etc). Each
month file has an !include of the previous, with the first month file !
including the budget/planned purchases/expected income. I wrap it all
up with a symlink file to the current month, and a edit is using VIM.
I have also written some web based charts, one set using open flash
charts, the other using jquery and flot. Anyone interested in seeing
a live copy can contact me in #ledger, and the source for both are at
github under my account: http://github.com/bettse/

~Eric

On Jun 22, 4:38 pm, Felipe Magno de Almeida
<felipe.m.alme...@gmail.com> wrote:
> On Tue, Jun 22, 2010 at 8:26 PM, Leandro Henrique Oliveira Fernandes
>

Russell Adams

unread,
Jun 29, 2010, 9:11:45 PM6/29/10
to Ledger

Alright, I'll weigh in.

The most complicated use of Ledger I have is my extensive expense
reporting. As I spend money on my client's behalf while traveling, I
have to create itemized reports to seek reimbursement. While it sounds
simple, having different clients, sources of money, classifications,
the complexity adds up.

I have a single directory tree which is stored in Bazaar.

I use CSV2Ledger to process my incoming CSV data from my credit card
into Ledger entries, which are written to Queue.dat in my base
directory.

My main ledger file ".ledger" contains nothing but "!include" lines
for each subsequent file.

I assign transactions to expense reports (ie: AISER0000) using
metadata in the Queue file. Once the pending transactions are tagged,
I run a shell script which relocates any transactions from Queue.dat
to Reports/AISER0000.dat, adds any new report files to Bazaar, and
updates the include list in the main file.

I have additional data files in my Data/ directory by year, bin/ for
scripts, Archive/ for previously imported CSV files, and PDF/ for the
resulting PDF expense reports from the ledger data.

The workflow goes pretty smoothly nowadays, I'm happy with it.

I know my data is a specific use case, but it works great!


------------------------------------------------------------------
Russell Adams RLA...@AdamsInfoServ.com

PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/

Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3

Reply all
Reply to author
Forward
0 new messages