From 04d6d9cfa93ca20b527799e15cb272d684479ef5 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Fri, 17 Oct 2025 20:04:27 +0200 Subject: [PATCH] Bugfix/total buy and sell calculation in summary (#5759) * Fix total buy and sell calculation related to activities in custom currency * Update changelog --- CHANGELOG.md | 1 + apps/api/src/app/portfolio/portfolio.service.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b97b37ae2..c0f6bd0e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed an issue with the total buy and sell calculation in the summary related to activities in a custom currency - Respected the include indices flag in the search functionality of the _Financial Modeling Prep_ service - Fixed an issue where the scroll position was not restored when changing pages - Fixed the word wrap in the menus of the activities table component diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index bbfb31b79..cb6eba5be 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -2126,11 +2126,11 @@ export class PortfolioService { .filter(({ isDraft, type }) => { return isDraft === false && type === activityType; }) - .map(({ quantity, SymbolProfile, unitPrice }) => { + .map(({ currency, quantity, SymbolProfile, unitPrice }) => { return new Big( this.exchangeRateDataService.toCurrency( new Big(quantity).mul(unitPrice).toNumber(), - SymbolProfile.currency, + currency ?? SymbolProfile.currency, userCurrency ) );