Fix Plaid cash balance double counting #2222

Merged
zachgoll merged 5 commits from zachgoll/plaid-cash-security-handling into main 2025-05-09 00:25:54 +08:00
zachgoll commented 2025-05-08 09:43:24 +08:00 (Migrated from github.com)

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 value to arrive at balance. Since Plaid's available_balance has various types of cash combined, when we do our cash + holdings value = balance calculation, we get cash/cash equivalent holdings counted twice.

This PR preemptively backs out these cash equivalents from the reported available_balance to fit our internal domain model better and avoid double-counting account values.

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 value` to arrive at `balance`. Since Plaid's `available_balance` has various types of cash combined, when we do our `cash + holdings value = balance` calculation, we get cash/cash equivalent holdings counted _twice_. This PR preemptively _backs out_ these cash equivalents from the reported `available_balance` to fit our internal domain model better and avoid double-counting account values.
Sign in to join this conversation.