Populate holdings for "offline" securities properly #1958
Reference in New Issue
Block a user
Delete Branch "1952-bug-some-stocks-do-not-appear-among-holdings"
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?
https://github.com/user-attachments/assets/618d72cb-2ba2-40ad-8509-cdd7f96c53ce
Changes
Offline tickers
Fixes #1952 where "offline" ticker symbols were not generating holdings. Changes include:
Sync code organization
The previous balance and holdings sync classes had a ton of mixed responsibilities and it was getting hard to maintain and tweak (as needed in the case of this bug).
The flow dependencies are now more clear:
Account::Balance::Syncer,Account::Holding::Syncer) is responsible for:In short, an
Accountis aSyncable, which calls thesyncmethod to create aSyncresource. ASyncresource is polymorphic and can sync aFamily,PlaidItem, orAccount. EachSynccallssync_data, which for anAccountwill call various operations, includingsync_balances. Thesync_balancesoperation will useAccount::Balance::Syncerto calculate (viaAccount::Balance::Calculator) the balances, which depends onAccount::Holding::Syncer.account.sync->Sync->account.sync_data->Account::Balance::Syncer->Account::Holding::SyncerAdditional account concerns
Account::Linkable- more clearly identifies a "Linked" account (connected to a data source like Plaid) and an "Unlinked" or "Offline" account (manual data)Account::Enrichable- used for any code related to enhancing the data of an account from an external data sourceThis PR hatweaks the holdings calculator so that "offline" tickers (that our data provider doesn't have prices for) will still generate holding values. The fallback logic is as-follows: