diff --git a/apps/api/src/app/import/import.service.ts b/apps/api/src/app/import/import.service.ts index a68c7887c..babe7c3e3 100644 --- a/apps/api/src/app/import/import.service.ts +++ b/apps/api/src/app/import/import.service.ts @@ -126,8 +126,7 @@ export class ImportService { unitPrice: marketPrice, unitPriceInAssetProfileCurrency: marketPrice, updatedAt: undefined, - userId: Account?.userId, - valueInBaseCurrency: 0 + userId: Account?.userId }; }) ); @@ -419,43 +418,14 @@ export class ImportService { }); }); - const dataGatheringItems = uniqueActivities.flatMap( - ({ currency, date, SymbolProfile }) => { - const activityDataGatheringItems = [ - { - date, - dataSource: SymbolProfile.dataSource, - symbol: SymbolProfile.symbol - } - ]; - - if (currency !== SymbolProfile.currency) { - activityDataGatheringItems.push({ - date, - dataSource: - this.dataProviderService.getDataSourceForExchangeRates(), - symbol: `${currency}${SymbolProfile.currency}` - }); - } - - if ( - (currency ?? SymbolProfile.currency) !== - user.Settings.settings.baseCurrency - ) { - activityDataGatheringItems.push({ - date, - dataSource: - this.dataProviderService.getDataSourceForExchangeRates(), - symbol: `${currency ?? SymbolProfile.currency}${user.Settings.settings.baseCurrency}` - }); - } - - return activityDataGatheringItems; - } - ); - this.dataGatheringService.gatherSymbols({ - dataGatheringItems, + dataGatheringItems: uniqueActivities.map(({ date, SymbolProfile }) => { + return { + date, + dataSource: SymbolProfile.dataSource, + symbol: SymbolProfile.symbol + }; + }), priority: DATA_GATHERING_QUEUE_PRIORITY_HIGH }); } diff --git a/apps/api/src/app/order/interfaces/activities.interface.ts b/apps/api/src/app/order/interfaces/activities.interface.ts index 3dcde1464..0c25c8ef8 100644 --- a/apps/api/src/app/order/interfaces/activities.interface.ts +++ b/apps/api/src/app/order/interfaces/activities.interface.ts @@ -17,7 +17,6 @@ export interface Activity extends Order { unitPriceInAssetProfileCurrency: number; updateAccountBalance?: boolean; value: number; - valueInBaseCurrency: number; } export interface ActivityError { diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 7287c103b..d3bbc1e06 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -246,10 +246,14 @@ export class PortfolioService { activities: Activity[]; groupBy?: GroupBy; }): Promise { - let dividends = activities.map(({ date, valueInBaseCurrency }) => { + let dividends = activities.map(({ currency, date, value }) => { return { date: format(date, DATE_FORMAT), - investment: valueInBaseCurrency + investment: this.exchangeRateDataService.toCurrency( + value, + currency, + this.getUserCurrency() + ) }; }); diff --git a/apps/client/src/app/services/import-activities.service.ts b/apps/client/src/app/services/import-activities.service.ts index f334a159f..2164bd248 100644 --- a/apps/client/src/app/services/import-activities.service.ts +++ b/apps/client/src/app/services/import-activities.service.ts @@ -138,12 +138,12 @@ export class ImportActivitiesService { return { accountId, comment, - currency, fee, quantity, type, unitPrice, updateAccountBalance, + currency: currency ?? SymbolProfile.currency, dataSource: SymbolProfile.dataSource, date: date.toString(), symbol: SymbolProfile.symbol