To this noob, this seems like a problem that was pretty convincingly solved by double entry accounting ledgers, but from your post it sounds like this isn’t a replacement-of but rather an addition-to that model. What’s a situation where an imperative approach would be preferable to the traditional declarative approach?
My depth of knowledge pretty much starts and ends with the below document, so apologies if this is obvious to experts!
https://beancount.github.io/docs/the_double_entry_counting_m...
E: the problem being “tracking transactions”. Yes?