[bug] v3.0.0-beta.4 | Missing FX Conversion Activity Support
Problem Description
Wealthfolio doesn't support explicit foreign exchange (FX) conversion activities within the same account. When a user buys securities in a foreign currency (e.g., buying USD-denominated stocks from a EUR account), the bank performs an automatic EUR→USD conversion, but this conversion is not tracked in Wealthfolio.
This causes negative cash balances in the foreign currency and incorrect cash calculations.
Current Behavior
Activity Types Available:
- BUY, SELL, DIVIDEND, INTEREST, DEPOSIT, WITHDRAWAL, TRANSFER_IN, TRANSFER_OUT, FEE, TAX, SPLIT, CREDIT, ADJUSTMENT, UNKNOWN
What happens:
- User imports/adds activities showing USD purchases (e.g., buying GOLD in USD)
- The bank automatically converts EUR→USD to fund the purchase
- Wealthfolio records the USD spending but has no record of the EUR→USD conversion
- Result: Negative USD cash balance (-649.962 USD) and incorrect cash percentages (EUR showing 197.61%, USD showing negative values)
Steps to Reproduce
- Create an account with EUR as base currency
- Add a BUY activity for a USD-denominated security (e.g.,
GOLD $100 USD) - Navigate to Allocations > Cash category
- Observe negative USD cash balance and abnormal percentage calculations
Example from real data:
- EUR Cash: 1108.215 EUR (shows as 197.61%)
- USD Cash: -649.962 USD (shows as negative)
- Net Total: 560.82 EUR
The percentages are mathematically correct but indicate missing conversion data.
Expected Behavior
The system should support one of these approaches:
Option 1: Explicit FX Activity Types
Add new activity types:
FX_OUT- Currency sold (e.g., EUR spent)FX_IN- Currency received (e.g., USD received)
Option 2: Automatic FX Detection
When a BUY/SELL occurs in a currency different from the account's primary currency, automatically infer and create the conversion activities.
Option 3: Enhanced Transfer Types
Allow TRANSFER_OUT/TRANSFER_IN within the same account but different currencies to represent FX conversions.
Current Workaround
Users must manually add activities:
WITHDRAWALof EUR (amount spent for conversion)DEPOSITof USD (amount received)
Or:
TRANSFER_OUTof EURTRANSFER_INof USD (both in same account)
This is tedious and error-prone for accounts with frequent multi-currency transactions.
Technical Context
- FX rates are already supported via the
fx_ratefield on activities - The FX service can fetch exchange rates for conversion
- The health system has
FX_INTEGRITYchecks for missing/stale rates - Missing: Activity types and UI flows for recording conversions
Impact
- Cash calculations are incorrect for multi-currency accounts
- Portfolio valuation may be affected
- User experience is confusing when seeing negative balances
I can provide more examples if needed.
I would prefer the second automatic option if it's possible to ask for this 🙃, otherwise I think the explicit FX_OUT/FX_IN alternative would be the way instead of using the TRANSFER_OUT/TRANSFER_IN option
I've opened PR #1924 to add the explicit same-account currency-exchange workflow discussed here.
The proposed implementation records the source debit and destination credit (for example, 100 USD → 92 EUR) as one activity, with desktop/mobile create, edit, duplicate and delete flows. Both native cash balances update together; the exchange is not counted as an external flow or contribution. The execution ratio stays separate from the FX rates used for portfolio valuation, and Spending includes both cash legs without classifying the exchange as income or spending.
This PR covers manual exchanges only. It does not infer conversions from BUY/SELL, add new CSV/broker import support (including #1402), or rewrite historical transfer pairs. Existing cross-account transfers and legacy paired-FX handling remain in place.
I believe #1228 is related.