Calculating the running balance will only be truly possible for transactions that have a timestamp (most banks just return the date). If you are happy to have a running balance that’s correct to the day, you can act under the assumption that transactions are returned in time order and do the following:
- Get the current balance from the /balance endpoint
- Get transactions from the /transactions endpoint
- Subtract the most recent transaction amount from the current balance, and assign this as the running balance for this transaction
- Take the next transaction, subtract the amount from the previous transaction’s running balance and assign this as the running balance for this transaction
- Repeat step 4 for the rest of the transaction dataset
Note that we don’t recommend considering pending transactions. That’s because these may not settle, or may settle with a different final amount. You would need to use the available balance if you want to factor in pending transactions.