Fix Plaid cash balance double counting #2222
Reference in New Issue
Block a user
Delete Branch "zachgoll/plaid-cash-security-handling"
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?
This PR reconciles the differences in our internal domain model for handling cash balances on investment accounts and Plaid's domain model.
Plaid vs. Maybe cash balance handling
Plaid combines brokerage cash + cash equivalent investments all into a single bucket called "cash", which is reported as
available_balance.Unlike Plaid, Maybe internally draws a hard line between brokerage cash (i.e. "uninvested cash") and "holdings".
This causes a double-count because internally, we add
cash + holdings valueto arrive atbalance. Since Plaid'savailable_balancehas various types of cash combined, when we do ourcash + holdings value = balancecalculation, we get cash/cash equivalent holdings counted twice.This PR preemptively backs out these cash equivalents from the reported
available_balanceto fit our internal domain model better and avoid double-counting account values.