# req-092 As a user, when I'm creating, updating and deleting my buckets and pipes, I want to see the result of the procedure, `calculate_tank_balance`, described below, so that I see a prominent number which I know summarises what the difference between my incomings and outgoings has actually been in the past, so that my incomings and outgoings are roughly equal in the long run. Source: req-091 Satisfied by: dml-drip, ass-009, ass-021, req-093, req-094, req-108, req-027 ## calculate_tank_balance 1. Let `drip_sum` be the sum of all `drip.amount` for all drips `drip`. 2. Let `transaction_sum` be the sum of all `transaction.amount` for all transactions `transaction`. 3. Let `bucket_overdraw_sum` be the sum of all `bucket.balance` for all buckets `bucket` such that `bucket.balance < 0`. 4. Return `transaction_sum + bucket_overdraw_sum - drip_sum`.