From bffe6060bd52427af135005826fed8d4d5ae1c61 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 16 Mar 2024 10:05:16 +0100 Subject: [PATCH] Pass portfolio calculator to getChart() (#3153) --- .../src/app/portfolio/portfolio.service.ts | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 74d7b382a..a7f160e84 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -294,10 +294,9 @@ export class PortfolioService { const { items } = await this.getChart({ dateRange, impersonationId, - portfolioOrders, + portfolioCalculator, transactionPoints, userId, - userCurrency: this.request.user.Settings.settings.baseCurrency, withDataDecimation: false }); @@ -1218,9 +1217,8 @@ export class PortfolioService { const { items } = await this.getChart({ dateRange, impersonationId, - portfolioOrders, + portfolioCalculator, transactionPoints, - userCurrency, userId }); @@ -1445,17 +1443,15 @@ export class PortfolioService { private async getChart({ dateRange = 'max', impersonationId, - portfolioOrders, + portfolioCalculator, transactionPoints, - userCurrency, userId, withDataDecimation = true }: { dateRange?: DateRange; impersonationId: string; - portfolioOrders: PortfolioOrder[]; + portfolioCalculator: PortfolioCalculator; transactionPoints: TransactionPoint[]; - userCurrency: string; userId: string; withDataDecimation?: boolean; }): Promise { @@ -1469,15 +1465,6 @@ export class PortfolioService { userId = await this.getUserId(impersonationId, userId); - const portfolioCalculator = new PortfolioCalculator({ - currency: userCurrency, - currentRateService: this.currentRateService, - exchangeRateDataService: this.exchangeRateDataService, - orders: portfolioOrders - }); - - portfolioCalculator.setTransactionPoints(transactionPoints); - const endDate = new Date(); const portfolioStart = parseDate(transactionPoints[0].date);