Closed ltowarek closed 3 years ago
With a current balance approach it will not work well with the reports, because there will be no history of account balance in a given point of time. Better approach seems to be an initial balance per account. This way, current account balance is simply the initial account balance and transactions balance.
For imported, just created accounts, initial balance can be taken from the oldest transaction's extra fields - https://docs.saltedge.com/account_information/v5/#transactions-extra - opening_balance
or closing_balance
- amount
.
Initial balance should be treated as a regular transaction instead of account field.
Approach with the oldest transaction does not work when there are pending transactions. Account balance returns sum of pending and posted transactions.
It seems that the proper way of doing this is:
Balance in synchronized accounts should be read-only and updated during connection refresh. Balance in regular accounts should be updated when transaction is created/updated/deleted.