From cea374453f2025460800af6f3a76425eef7c3ef5 Mon Sep 17 00:00:00 2001 From: Marcel Hernandez Date: Wed, 18 Sep 2024 20:09:54 +0200 Subject: [PATCH] show unrealized profit percentage in 'all holdings' view --- frontend/src/reports/holdings/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/reports/holdings/index.ts b/frontend/src/reports/holdings/index.ts index 1f9cd203c..c4c3c4b0f 100644 --- a/frontend/src/reports/holdings/index.ts +++ b/frontend/src/reports/holdings/index.ts @@ -27,6 +27,7 @@ SELECT first(getprice(currency, cost_currency)) as price, cost(sum(position)) as book_value, value(sum(position)) as market_value, + safediv((abs(sum(number(value(position)))) - abs(sum(number(cost(position))))), sum(number(cost(position)))) * 100 as unrealized_profit_pct, cost_date as acquisition_date WHERE account_sortkey(account) ~ "^[01]" GROUP BY account, cost_date, currency, cost_currency, cost_number, account_sortkey(account)