Handle bad API data for trade quantity signage #2416

Merged
zachgoll merged 1 commits from zachgoll/maybe-884-plaid-returns-positive-signed-quantities-for-some-sell into main 2025-06-26 21:54:25 +08:00
zachgoll commented 2025-06-26 21:47:06 +08:00 (Migrated from github.com)

We have identified several cases where Plaid returns a positively signed quantity for investment trade transactions when they have a type equal to sell. This behavior contradicts the official documentation and has caused incorrect historical graphs for users because we use this signage as the core mechanism for calculating historical balances.

This PR adds some basic handling so that we can derive the correct signage in these scenarios where the data is incorrect.

We have identified several cases where Plaid returns a _positively signed_ `quantity` for investment trade transactions when they have a `type` equal to `sell`. This behavior contradicts the official documentation and has caused incorrect historical graphs for users because we use this signage as the core mechanism for calculating historical balances. This PR adds some basic handling so that we can derive the correct signage in these scenarios where the data is incorrect.
Sign in to join this conversation.