Link-attached balances

77 views
Skip to first unread message

Martin Blais

unread,
Feb 24, 2018, 12:17:50 AM2/24/18
to Beancount
I had an idea tonight while attempting to reconcile some missing amounts over a credit card account where my last balance was last year September.

The problem is this: Beancount does not include time nor care about ordering in the file. This is a really important property and I don't want to ever change that. However, this means that it's impossible to create balance checks in between transactions that occur on the same day. However, this type of thing happens all the time with credit cards. There's no solution at the moment, other than fudging the amounts, which is really super annoying.

I thought about this: How about I'd add an OPTIONAL link to balance checks, or create a new type of balance directive. If the link is present, the semantics would be: check the balance that occurs just before the transaction which occurs on that same day, and which is the only one with that link. (If there are more than one transaction on that day with the link an error should be issued, IOW, it should be unambiguous.)

Now, this seems straightforward to implement - and I was just about to pounce! - but it's not: there's a whole lot of sorting going on, and it might affect display as well. I'm not sure yet how to it.

Ideas welcome.

Martin Michlmayr

unread,
Feb 24, 2018, 6:01:25 PM2/24/18
to bean...@googlegroups.com
* Martin Blais <bl...@furius.ca> [2018-02-24 00:17]:
> Now, this seems straightforward to implement - and I was just about
> to pounce! - but it's not: there's a whole lot of sorting going on,
> and it might affect display as well. I'm not sure yet how to it.

I have a related use case that came to my mind when you described your
issue: would it be possible to somehow indicate the order of
transactions, e.g. ^link:number

When putting transactions in different files, you often get the wrong
order if a transaction happens on the same day, e.g. you get cash from
the ATM (recorded in the file for your current account) and then spend
the cash (recorded in some general journal) -- but it's shown the
other way around.

This would also help with the balance issue since you can say the
balance should be X after ^link:number

--
Martin Michlmayr
http://www.cyrius.com/

blue...@gmail.com

unread,
Mar 6, 2018, 6:30:22 AM3/6/18
to Beancount
Slightly unrelated: I would love to be able to link note, document and balance directives to transactions.  Currently adding ^link after any of those doesn't parse.

Matthew Harris

unread,
Mar 10, 2018, 12:39:29 PM3/10/18
to Beancount
Well, it happens with credit card accounts because credit card transactions have two dates -- the sale date and the posting date. We've discussed this in the past. I make balance assertions work by changing a transaction to use the posting date rather than the sale date when the sale lands on the last day of a billing cycle.

Metin Akat

unread,
Mar 12, 2018, 12:20:52 PM3/12/18
to bean...@googlegroups.com
How bad would it be if you allow optional time (HH:MM) in the transactions? This would allow for solving a huge amount of this-kind-of problems that I have.


On Sat, Mar 10, 2018 at 7:39 PM, Matthew Harris <mharr...@gmail.com> wrote:
Well, it happens with credit card accounts because credit card transactions have two dates -- the sale date and the posting date. We've discussed this in the past. I make balance assertions work by changing a transaction to use the posting date rather than the sale date when the sale lands on the last day of a billing cycle.

--
You received this message because you are subscribed to the Google Groups "Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscribe@googlegroups.com.
To post to this group, send email to bean...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/cd87d26e-48d9-47d5-8a4b-b05c6477aeaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Blais

unread,
Mar 27, 2018, 10:19:55 PM3/27/18
to Beancount
On Sat, Mar 10, 2018 at 12:39 PM, Matthew Harris <mharr...@gmail.com> wrote:
Well, it happens with credit card accounts because credit card transactions have two dates -- the sale date and the posting date. We've discussed this in the past. I make balance assertions work by changing a transaction to use the posting date rather than the sale date when the sale lands on the last day of a billing cycle.

Yep.
For newer users, this is discussed here:

Martin Blais

unread,
Mar 27, 2018, 10:20:41 PM3/27/18
to Beancount
I'd rather support the settlement proposal to fix the problem properly than hack a secondary sort key which we then would become dependent on (but it would work in the short term).

Reply all
Reply to author
Forward
0 new messages