Fix credit card balance history #2414
Reference in New Issue
Block a user
Delete Branch "zachgoll/maybe-879-plaid-credit-card-historical-balance-off"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When syncing Plaid credit card accounts, we were getting very overstated histories due to the
account.cash_balancevalue. InBalance::ReverseCalculator, we use "cash balance" as our starting point and work backwards, applying entry changes to generate historicals. For credit card accounts, Plaid considersavailable_balanceas "the limit less the current balance, less any pending outflows plus any pending inflows". We were previously settingcash_balanceequal to Plaid'savailable_balance, which was giving us a starting point closer to the "credit limit" (which is often much higher than the user's utilization). This made it so we had today's balance correct, but historicals were then extremely inflated.This PR moves us to a more standard way of handling Plaid balances:
currentvs.availableanymore. We simply usecurrentalways, which means, "total account value"