diff --git a/CHANGELOG.md b/CHANGELOG.md index abf9b6eb1..1e814cfcd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improved the usability of the benchmarks in the markets overview +### Fixed + +- Fixed a missing value in the activities table on mobile + ## 2.59.0 - 2024-02-29 ### Added diff --git a/apps/api/src/app/order/interfaces/activities.interface.ts b/apps/api/src/app/order/interfaces/activities.interface.ts index 0f6c0bee8..7c612d464 100644 --- a/apps/api/src/app/order/interfaces/activities.interface.ts +++ b/apps/api/src/app/order/interfaces/activities.interface.ts @@ -7,8 +7,10 @@ export interface Activities { export interface Activity extends OrderWithAccount { error?: ActivityError; + feeInBaseCurrency: number; updateAccountBalance?: boolean; value: number; + valueInBaseCurrency: number; } export interface ActivityError { diff --git a/apps/api/src/app/order/order.service.ts b/apps/api/src/app/order/order.service.ts index 53d388621..a88aa4462 100644 --- a/apps/api/src/app/order/order.service.ts +++ b/apps/api/src/app/order/order.service.ts @@ -328,7 +328,17 @@ export class OrderService { return { ...order, - value + value, + feeInBaseCurrency: this.exchangeRateDataService.toCurrency( + order.fee, + order.SymbolProfile.currency, + userCurrency + ), + valueInBaseCurrency: this.exchangeRateDataService.toCurrency( + value, + order.SymbolProfile.currency, + userCurrency + ) }; }); diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 1c4dd039a..44e1c5524 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -237,14 +237,10 @@ export class PortfolioService { types: ['DIVIDEND'] }); - let dividends = activities.map(({ date, SymbolProfile, value }) => { + let dividends = activities.map(({ date, valueInBaseCurrency }) => { return { date: format(date, DATE_FORMAT), - investment: this.exchangeRateDataService.toCurrency( - value, - SymbolProfile.currency, - userCurrency - ) + investment: valueInBaseCurrency }; }); @@ -768,14 +764,8 @@ export class PortfolioService { .filter(({ type }) => { return type === 'DIVIDEND'; }) - .map(({ SymbolProfile, value }) => { - return new Big( - this.exchangeRateDataService.toCurrency( - value, - SymbolProfile.currency, - userCurrency - ) - ); + .map(({ valueInBaseCurrency }) => { + return new Big(valueInBaseCurrency); }) ); @@ -2105,15 +2095,11 @@ export class PortfolioService { quantity, SymbolProfile, type, - unitPrice + valueInBaseCurrency } of ordersByAccount) { const unitPriceInBaseCurrency = portfolioItemsNow[SymbolProfile.symbol]?.marketPriceInBaseCurrency ?? - this.exchangeRateDataService.toCurrency( - unitPrice, - SymbolProfile.currency, - userCurrency - ) ?? + valueInBaseCurrency ?? 0; let currentValueOfSymbolInBaseCurrency =