A double-entry accrual accounting system for your application.  Currency-agnostic.  Account holder and contexts are supported and built-in.