diff --git a/apps/api/src/app/portfolio/portfolio-calculator.ts b/apps/api/src/app/portfolio/portfolio-calculator.ts index ce4c3fe8e..01369743b 100644 --- a/apps/api/src/app/portfolio/portfolio-calculator.ts +++ b/apps/api/src/app/portfolio/portfolio-calculator.ts @@ -25,7 +25,15 @@ import { isSameDay, subDays } from 'date-fns'; -import { cloneDeep, first, isNumber, last, sortBy, uniq } from 'lodash'; +import { + cloneDeep, + first, + flowRight, + isNumber, + last, + sortBy, + uniq +} from 'lodash'; import { CurrentRateService } from './current-rate.service'; import { CurrentPositions } from './interfaces/current-positions.interface'; @@ -2026,7 +2034,7 @@ export class PortfolioCalculator { const totalInvestmentBeforeTransaction = { ...totalInvestment }; const valueOfInvestmentBeforeTransaction = { - Value: totalUnits.mul(order.unitPrice), + Value: totalUnits.mul(order.unitPriceInBaseCurrency), WithCurrencyEffect: totalUnits.mul( order.unitPriceInBaseCurrencyWithCurrencyEffect ) @@ -2101,7 +2109,7 @@ export class PortfolioCalculator { ); const valueOfInvestment = { - Value: totalUnits.mul(order.unitPrice), + Value: totalUnits.mul(order.unitPriceInBaseCurrency), WithCurrencyEffect: totalUnits.mul( order.unitPriceInBaseCurrencyWithCurrencyEffect ) @@ -2331,7 +2339,7 @@ export class PortfolioCalculator { .mul( withCurrencyEffect ? order.unitPriceInBaseCurrencyWithCurrencyEffect - : order.unitPrice + : order.unitPriceInBaseCurrency ) .mul(this.getFactor(order.type)) : totalUnits.gt(0) diff --git a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts index 633f1283f..b01106c12 100644 --- a/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts +++ b/apps/client/src/app/components/admin-market-data/asset-profile-dialog/asset-profile-dialog.component.ts @@ -166,7 +166,7 @@ export class AssetProfileDialog implements OnDestroy, OnInit { assetClass: this.assetProfile.assetClass ?? null, assetSubClass: this.assetProfile.assetSubClass ?? null, comment: this.assetProfile?.comment ?? '', - tags: this.assetProfile?.tags, + tags: this.assetProfile?.tags ?? [], countries: JSON.stringify( this.assetProfile?.countries?.map(({ code, weight }) => { return { code, weight };