Look into learning Ledger, as advised by colindean
freemint from #picolisp suggests looking into throughput accounting