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
@@ -126,7 +126,8 @@ function totalsByCurrency(
for (const value of money) addTotal(value.currency, decimal(value));
for (const position of positions) {
const price = position.currentPrice;
if (!price) continue;
// CURRENCY positions mirror the cash balances already added above.
if (!price || types[position.instrumentType?.toLowerCase() ?? ''] === 'CURRENCY') continue;
addTotal(
price.currency,
multiply(decimal(position.quantity ?? {}), decimal(price)),