From 6573126116827991cd3ea54af5ce5695a59174c5 Mon Sep 17 00:00:00 2001 From: Daniel Devaud Date: Wed, 2 Apr 2025 19:02:08 +0200 Subject: [PATCH] Fix tests --- .../calculator/portfolio-calculator.ts | 18 ++++-------------- ...o-calculator-msft-buy-with-dividend.spec.ts | 18 +++++++++--------- 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts b/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts index 3d6c3ad73..dd83e798e 100644 --- a/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts +++ b/apps/api/src/app/portfolio/calculator/portfolio-calculator.ts @@ -199,10 +199,7 @@ export abstract class PortfolioCalculator { for (const { currency, dataSource, symbol } of transactionPoints[ firstIndex - 1 ].items) { - dataGatheringItems.push({ - dataSource, - symbol - }); + dataGatheringItems.push({ dataSource, symbol }); currencies[symbol] = currency; } @@ -231,17 +228,12 @@ export abstract class PortfolioCalculator { values: marketSymbols } = await this.currentRateService.getValues({ dataGatheringItems, - dateQuery: { - gte: this.startDate, - lt: this.endDate - } + dateQuery: { gte: this.startDate, lt: this.endDate } }); this.dataProviderInfos = dataProviderInfos; - const marketSymbolMap: { - [date: string]: { [symbol: string]: Big }; - } = {}; + const marketSymbolMap: { [date: string]: { [symbol: string]: Big } } = {}; for (const marketSymbol of marketSymbols) { const date = format(marketSymbol.date, DATE_FORMAT); @@ -1111,9 +1103,7 @@ export abstract class PortfolioCalculator { chartDateMap: { [date: string]: boolean }; end: Date; exchangeRates: { [dateString: string]: number }; - marketSymbolMap: { - [date: string]: { [symbol: string]: Big }; - }; + marketSymbolMap: { [date: string]: { [symbol: string]: Big } }; start: Date; } & AssetProfileIdentifier): SymbolMetrics; diff --git a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-msft-buy-with-dividend.spec.ts b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-msft-buy-with-dividend.spec.ts index 90ee9c22b..4c54ba7aa 100644 --- a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-msft-buy-with-dividend.spec.ts +++ b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-msft-buy-with-dividend.spec.ts @@ -154,25 +154,25 @@ describe('PortfolioCalculator', () => { dividendInBaseCurrency: new Big('0.62'), fee: new Big('19'), firstBuyDate: '2021-09-16', - grossPerformance: new Big('33.87'), - grossPerformancePercentage: new Big('0.11343693482483756447'), + grossPerformance: new Big('33.25'), + grossPerformancePercentage: new Big('0.11136043941322258691'), grossPerformancePercentageWithCurrencyEffect: new Big( - '0.11343693482483756447' + '0.11136043941322258691' ), - grossPerformanceWithCurrencyEffect: new Big('33.87'), + grossPerformanceWithCurrencyEffect: new Big('33.25'), investment: new Big('298.58'), investmentWithCurrencyEffect: new Big('298.58'), marketPrice: 331.83, marketPriceInBaseCurrency: 331.83, - netPerformance: new Big('14.87'), - netPerformancePercentage: new Big('0.04980239801728180052'), + netPerformance: new Big('14.25'), + netPerformancePercentage: new Big('0.04772590260566682296'), netPerformancePercentageWithCurrencyEffectMap: { - max: new Big('0.04980239801728180052') + max: new Big('0.04772590260566682296') }, netPerformanceWithCurrencyEffectMap: { '1d': new Big('-5.39'), - '5y': new Big('14.87'), - max: new Big('14.87'), + '5y': new Big('14.25'), + max: new Big('14.25'), wtd: new Big('-5.39') }, quantity: new Big('1'),