When importing an IBKR Flex report that contains multiple FlexStatement nodes (multiple IBKR accounts) in one XML, Portfolio Performance imports FX trades (Trades/Trade with assetCategory=“CASH” and symbols like EUR.HUF, USD.HUF, also EUR.USD, EUR.ZAR, USD.ZAR) as cash transfers, but the source/target cash accounts are resolved incorrectly across accounts. FX legs end up booked between cash accounts belonging to different IBKR accountIds, creating artificial inter-account transfers and impossible negative cash balances.
Example:
Trade in U173xxxxx: transactionID=3607649210, symbol=EUR.HUF, quantity=1108, proceeds=-452067.324 (HUF)
Imported as cash transfer from IBKR (U158xxxxx) (HUF) to IBKR TBSZ-2025 (U173xxxxx) EUR.
Trade in U158xxxxx: transactionID=3579620213, symbol=EUR.HUF, quantity=1, proceeds=-407.735 (HUF)
Imported as cash transfer from IBKR (U158xxxxx) (HUF) to IBKR TBSZ-2025 (U173xxxxx) EUR (wrong target account).
This causes huge negative cash in the main account and inflated cash in the TBSZ account.
Possible root cause
Cash account lookup for FX trades appears to be done by currency only (global), not scoped to the statement/accountId context, so the first matching cash account of a currency is chosen even if it belongs to another IBKR account.
Alternatively, the “Import transactions from PDF files” screen may override accounts. This screen is misleading, as some trades can involve Fx within U158xxxxx (buy USD from HUF) and others within IBKR TBSZ-2025 (U173xxxxx) (e.g. buy USD from HUF)
I also submitted as a bug: IB Flex import: FX trades (assetCategory=CASH) mapped to wrong cash accounts when Flex report contains multiple accounts (multiple FlexStatements) · Issue #5473 · portfolio-performance/portfolio · GitHub
Do you have any idea how to overcome this issue?