Using notebooks to visualise beancount data

88 views
Skip to first unread message

Justus Pendleton

unread,
Mar 13, 2026, 3:10:55 AM (yesterday) Mar 13
to Beancount
In another thread Chary Ev2geny wrote about just using notebooks to help visualise beancount data:

"I know this is not exactly what you are looking for, but I was also looking for ways to better visualize beancount data. I just decided to do this in jupyter notebook,  thus having access to all the modern data processing and visualization tools, available there"

Someone else mentioned using Marimo instead which was new to me; as an excuse to learn Marimo I put together a quick proof of concept to demonstrate the power of this approach, with reactive UI, UI components like drop downs and sliders, and plotting of data, all in just a few lines of python.

I made a brief screen recording so you can see what it looks like:
The code is at
https://github.com/hoostus/marimobean

You should be able just clone the repo and then run it via:
uv run marimo run pnl.py

Chary Ev2geny

unread,
Mar 13, 2026, 7:32:28 AM (yesterday) Mar 13
to Beancount
Hi,

this is really great, thank you for brining this up!! 

I played with it locally, very impressive!

Marimo just seems to be hitting every issue I had with jupyter when trying to produce application-like notebooks:

  • it is reactive (you change input and then all related cells  re-run)
  • it has a view only mode
  • it exports easy to HTML
  • it is github friendly
  • it has plenty of native UI elements

For your demo, I was able to run it locally, following your instructions, but I am unable to run is using https://molab.marimo.io/github.com/hoostus/marimobean/blob/main/pnl.py (I get some strange errors)

Would be nice to allow people to run it without having to install anything for demo purposes

Also, if you use the example.beancount as a default file, then this would make it directly comparable with the Fava demo https://fava.pythonanywhere.com/example-beancount-file/

Regards.

Justus Pendleton

unread,
Mar 13, 2026, 7:46:02 AM (yesterday) Mar 13
to Beancount
I don't know anything about molab -- I learned about Marimo in the same thread you did :-) -- but a quick look at it (the error at the very bottom of the page) shows it can't find the beancount example file, so I guess they're doing something a bit weird with the git repository after checkout or something? I probably won't investigate much further but maybe someone else knows an easy fix, which I'd be happy to apply.

As you saw (and as you've posted on in the past) generating the net worth over time is extraordinarily painful, one wishes beancount had a simple, efficient built in way to do it. Looking at what I've done in the past, it isn't impossible or anything, but it seems like a LOT of people (not least of which if fava) end up reinventing the wheel of building up inventories in python code and reducing them with the price map in various different ways to try to be more efficient than calling BQL repeatedly.

Marimo looks really promising, especially the ability to run them as notebooks, scripts, or apps so I'm off to convert my collection of scripts & Google Sheet/beancount hybrids & jupyter notebooks to Marimo......

Chary Ev2geny

unread,
Mar 13, 2026, 9:49:28 AM (yesterday) Mar 13
to Beancount
On Friday, March 13, 2026 at 12:46:02 PM UTC+1 just...@gmail.com wrote:

 but it seems like a LOT of people (not least of which if fava) end up reinventing the wheel of building up inventories in python code and reducing them with the price map in various different ways to try to be more efficient than calling BQL repeatedly.

I was one of those people. I have this class:

class BeanSummator():
    """
       Simulates a beanquery SUM command for aggregating transaction amounts by account up to a specified
       date as used in the below beanquetry query:

        SELECT root(n, account) as shortened_acc, sum(position)
        WHERE date <= {date} AND account ~ "accounts_re"
        GROUP BY shortened_acc
       
        This class enhances efficiency by remembering the last sum calculated and the date for which it was calculated.
        It ensures that subsequent sums are requested for the same or later dates, allowing reuse of previous calculations.
        This approach speeds up the calculation process, especially beneficial when determining net worth across multiple dates
 

Marimo looks really promising, 

Indeed! 
 
so I'm off to convert my collection of scripts & Google Sheet/beancount hybrids & jupyter notebooks to Marimo......

Just out of curiosity, How did you use  Google Sheets in all of this?

Justus Pendleton

unread,
Mar 13, 2026, 5:40:29 PM (24 hours ago) Mar 13
to Beancount
Google Sheets provides a "good enough" UI/front-end with charts, stock prices & exchange rates (which update orders of magnitude faster than bean-price), and a convenient place to keep data that doesn't fit nicely into beancount itself (such as joint life expectancy). It is also easy to store historical information (like daily net worth or historical dividend rates) rather than try to pull it from beancount each time I need it (impractical for net worth, somewhat annoying for other things). It is easily accessible via mobile and is cloud hosted so I can see it anywhere. I've had the Google Sheet for over a decade and it has accumulated a lot of things I don't actually use anymore.

My primary use for it is to take our current net worth and run a PMT calculation on it using joint life expectancy and expected returns to calculate how much we can safely spend each year. It is nice that this happens "automatically" and I don't need to run some script to see it, I just open up the sheet on any device and there it is. (There is no native PMT in python but the numpy_financial package provides it.)

I've also used PMT when looking at various debt paydown scenarios and how much free cash flow remains after. I can't get a normal home mortgage so have used portfolio margin to buy property in the past but there is no convenient vendor-calculated "monthly mortgage payment" with that, so you sort of need to manage it yourself to make sure you stay on top of the accruing interest.

It shows us how much charitable giving we should target -- based on an heuristic from Peter Singer's book/website The Life You Can Save.

Because net worth is stored daily it is easy to look up, or chart, historical data. For instance, after a major purchase (property, car) how long does it take our portfolio to recover (currently 553 days and counting, the Iran was isn't helping....)

There's a table showing various projected safe spending rates (based on PMT above) at various net worths that let us have reasonable conversations about increasing/decreasing spending in the coming years (where "spending" including gifting both family and charities).

In the far distant past I used it for investigating things like Siegel & Waring's "Only Spending Rule You'll Ever Need", Walton target portfolio sizes, Stout & Mitchell's spending rule, Blanchett's Simple Formula, Steiner's Corridor, Kasten's Model, Milevsky's Stochastic Portfolio Value, and so on.

redst...@gmail.com

unread,
12:24 PM (5 hours ago) 12:24 PM
to Beancount

Terrific! Thanks Justus for sharing the quick-start repo, and Chary for the original Jupyter inspiration. The repo got me to finally try Marimo, and it really does feel like notebooks done right.

Marimo + AI = Your custom Beancount analysis micro-app in minutes.

This combo is like having a Fava custom mini-app for every analysis you want. The result is surprisingly polished.

One thing I noticed right away was that Marimo doesn’t have a built-in element for hierarchical accounts, which is one of Fava’s core strengths. No problems though: Marimo supports anywidget, and AI handled the rest.

Check it out: gist

It’s a tiny app that compares expenses between two years, sorted by the biggest changes. You can drill down from top-level expense accounts → subaccounts → individual transactions to see exactly what drove the difference.

Honestly, it’s worth spending the ~10 minutes to get oriented with Marimo. Once you do, it becomes an incredibly convenient way to build every custom one-off Beancount report and analysis you ever wanted.

It feels a bit like custom GUI analysis for your personal ledger is now a completely solved problem, and there is nothing more left to do in this area.

ss.jpg

Justus Pendleton

unread,
3:53 PM (1 hour ago) 3:53 PM
to Beancount
I've added this to my git repo, hope you don't mind.

One thing I noticed: normally in Marimo you can reorder cells however you want (i.e. put the resulting visualisation at the very top of the page and put all the setup and calculations at the bottom). But with your script reordering the tree-view breaks things somehow?  I spent a minute trying to figure out why but don't yet know Marimo or anywidget well enough to quite see what's going on.

Martin Blais

unread,
4:28 PM (1 hour ago) 4:28 PM
to bean...@googlegroups.com
Very cool
I also love how the data format is regular python in functions



--
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 visit https://groups.google.com/d/msgid/beancount/91858665-7f38-4359-bbe7-7f33bdd9e46dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages