Investment outflows count as expenses, but investment inflows are never income
Problem
Cashflow treats money moving between cash and investments asymmetrically:
| Direction | Kind | Cashflow / budgets |
|---|---|---|
| Cash → investment (contribution, buy booked on a cash account) | investment_contribution |
Counted as expense |
| Investment → cash (withdrawal, sale proceeds booked on a cash account) | funds_movement |
Excluded |
investment_contribution is deliberately kept out of BUDGET_EXCLUDED_KINDS so contributions show up as spending. No kind exists for the opposite direction, though. Transfer.kind_for_account returns funds_movement whenever the destination is a cash account, so money coming back from investments never shows up in cashflow.
This distorts cashflow for providers that book trades against a cash account. Trade Republic is one: with split cash and portfolio accounts, every buy and sell is also booked on the cash account.
Example: rebalancing at Trade Republic. Sell fund A for €1,000 and buy fund B for €1,000.
- Today: €1,000 expense, €0 income. Cashflow drops €1,000 while net worth is unchanged.
- Expected: €1,000 expense and €1,000 income, net €0.
The same applies to withdrawing from a broker: the contribution counted as spending, but getting the money back doesn't count as anything.
InvestmentFlowStatement already handles contributions and withdrawals symmetrically, based on the Contribution and Withdrawal activity labels. Cashflow and budgets don't.
Proposal
Add an investment_withdrawal kind as the counterpart of investment_contribution, counted as income in cashflow:
Transfer.kind_for_accountand the transfer creator, matcher, rule action and data importer: when the source is an investment or crypto account and the destination is not, the leg becomesinvestment_withdrawalinstead offunds_movement.Account::ProviderImportAdapter: map theWithdrawalactivity label toinvestment_withdrawal, the wayContributionmaps toinvestment_contribution. Today broker withdrawals (Trading212, IBKR, SnapTrade, Questrade, Plaid Investments, Indexa) staystandard, so until they are matched they count as uncategorized expenses.- Trade Republic: book sale proceeds on the cash account as
investment_withdrawal. IncomeStatement::ScopedTransactionsQuery: classifyinvestment_withdrawalas income, mirroring howinvestment_contributionis classified as expense.
Open questions
- Should gross sale proceeds count as income, or only the realized gain? Counting gross is symmetric with contributions, but it raises reported income and the savings rate.
- Should existing
funds_movementtransfers out of investment accounts be migrated, or should only new syncs use the new kind? - Budgets: should
investment_withdrawalshow up as income in budget views, or only in cashflow?
Related
Trade Republic buys are booked as investment_contribution without a category, so they land in Uncategorized on the dashboard. Every other path that creates an investment_contribution assigns the name-based Investment Contributions category. Filling the synthetic Other investments bucket (is_uncategorized_investment, currently hardcoded to false for transactions) would fix that for every provider without forcing a user-editable category.
Source: we-promise/sure