From 6d38696382da9b85ce02088aa411d039351ce9c5 Mon Sep 17 00:00:00 2001 From: Attila Cseh Date: Mon, 11 Aug 2025 12:08:58 +0200 Subject: [PATCH] account allocationInPercentage calculation implemented --- apps/api/src/app/portfolio/portfolio.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index c15d06c1e..27bb044cc 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -226,7 +226,7 @@ export class PortfolioService { interestInBaseCurrency, transactionCount, valueInBaseCurrency, - allocationInPercentage: null, // TODO + allocationInPercentage: 0, balanceInBaseCurrency: this.exchangeRateDataService.toCurrency( account.balance, account.currency, @@ -298,6 +298,11 @@ export class PortfolioService { transactionCount += account.transactionCount; } + for (const account of accounts) { + account.allocationInPercentage = + account.valueInBaseCurrency / totalValueInBaseCurrency.toNumber(); + } + return { accounts, transactionCount,