A beancount plugin that adds checks for balance expressions

116 views
Skip to first unread message

Di Weng

unread,
Mar 18, 2021, 3:49:23 PM3/18/21
to Beancount
Hi everyone!

I made a small plugin for checking balances against the simple expressions combining multiple accounts. Here are a few examples:

```
plugin "beancount_balexpr.balexpr"

1990-01-01 open Assets:A USD
1990-01-01 open Assets:B USD
1990-01-01 open Equity:OpenBalance USD
1991-01-01 pad Assets:A Equity:OpenBalance
1991-01-01 pad Assets:B Equity:OpenBalance
1991-01-02 balance Assets:A 213.00 USD
1991-01-02 balance Assets:B 264.00 USD

1991-01-03 custom "balexpr" "Assets:A+Assets:B"               477.00 USD
1991-01-03 custom "balexpr" "Assets:A+200.00"                 413.00 USD
1991-01-03 custom "balexpr" "Assets:B*(Assets:A+200.00)"   109032.00 USD
1991-01-03 custom "balexpr" "Assets:A-Assets:B"               -51.00 USD
1991-01-03 custom "balexpr" "Assets:A*Assets:B"             56232.00 USD
1991-01-03 custom "balexpr" "Assets:A/Assets:B"                 0.81 USD
1991-01-03 custom "balexpr" "Assets:A+Assets:A*Assets:B"    56445.00 USD
1991-01-03 custom "balexpr" "(Assets:A+Assets:A)*Assets:B" 112464.00 USD
```

I found it particularly useful when a credit card is separated into multiple accounts: `Liabilities:CreditCard`, `Liabilities:Due:CreditCard`, and `Liabilities:Installment:CreditCard`. In this way I can quickly tell how much is due for all credit cards in this month by checking `Liabilities:Due` in Fava. However, obtaining the value of `Liabilities:CreditCard` from my bank apps requires some manual calculation, so with this plugin I can easily accumulate these three accounts and check against the total credit card debt.

In case you're interested, here is the project homepage: https://github.com/w1ndy/beancount_balexpr

Cheers,
Di

Martin Blais

unread,
Mar 18, 2021, 5:32:05 PM3/18/21
to Beancount
I love it!

--
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+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/cdcf2cc7-8061-4f69-ae6a-c82564463652n%40googlegroups.com.

Ben Blount

unread,
Mar 18, 2021, 7:20:35 PM3/18/21
to Beancount
+1, great use of plugins + custom directives!

Martin Blais

unread,
Mar 20, 2021, 2:43:37 PM3/20/21
to Beancount

Di Weng

unread,
Mar 20, 2021, 2:51:23 PM3/20/21
to bean...@googlegroups.com
Thanks!
> You received this message because you are subscribed to a topic in the Google Groups "Beancount" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/beancount/fVeovrFZN2g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to beancount+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhMcwJWSQYY-jp0yrMJeMdz8QLXkrT_mzH%3Dsaany75PsvQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages