Browse Source

Bugfix/total buy and sell calculation in summary (#5759)

* Fix total buy and sell calculation related to activities in custom currency

* Update changelog
pull/5775/head
Thomas Kaul 1 day ago
committed by GitHub
parent
commit
04d6d9cfa9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 4
      apps/api/src/app/portfolio/portfolio.service.ts

1
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

4
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
)
);

Loading…
Cancel
Save