A fast thought on writing accounting software: The most common mistake programmers make when writing an accounting system is they think it’s all about balances. They think the point of an accounting system is to tell you your account balance, so they design the data model around that.
They’re wrong. The point of an accounting system is to track the complete history of the movements of money and other assets. Auditing isn’t just a feature of the system, it is the system. Balances are just a summary report on the real data.