fix: count brokerage cash once and skip short-position return percent (WealthLedger/backend#140)

This commit is contained in:
2026-10-28 08:00:20 +03:00
parent 97fc41fa29
commit f2843e30bd
6 changed files with 65 additions and 8 deletions
@@ -43,6 +43,8 @@ export function portfolioStructure(
currencies.set(money.currency, group);
};
for (const position of positions) {
// CURRENCY positions mirror cash, which is counted once as CASH below.
if (position.type === 'CURRENCY') continue;
const type = ['BOND', 'STOCK'].includes(position.type)
? position.type
: 'OTHER';