From 14b88edff6df4a5ea1dd27e66774f72195d91d60 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sun, 6 Oct 2024 21:07:07 +0200 Subject: [PATCH] Feature/extend MSFT buy with dividend test (#3891) * Extend test --- ...io-calculator-msft-buy-with-dividend.spec.ts | 17 +++++++++++++++++ .../app/portfolio/current-rate.service.mock.ts | 2 ++ 2 files changed, 19 insertions(+) diff --git a/apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-msft-buy-with-dividend.spec.ts b/apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-msft-buy-with-dividend.spec.ts index 97b860400..ba1cbeb3c 100644 --- a/apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-msft-buy-with-dividend.spec.ts +++ b/apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-msft-buy-with-dividend.spec.ts @@ -155,10 +155,27 @@ describe('PortfolioCalculator', () => { dividendInBaseCurrency: new Big('0.62'), fee: new Big('19'), firstBuyDate: '2021-09-16', + grossPerformance: new Big('33.25'), + grossPerformancePercentage: new Big('0.11136043941322258691'), + grossPerformancePercentageWithCurrencyEffect: new Big( + '0.11136043941322258691' + ), + 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.25'), + netPerformancePercentage: new Big('0.04772590260566682296'), + netPerformancePercentageWithCurrencyEffectMap: { + max: new Big('0.04772590260566682296') + }, + netPerformanceWithCurrencyEffectMap: { + '1d': new Big('-5.39'), + '5y': new Big('14.25'), + max: new Big('14.25'), + wtd: new Big('-5.39') + }, quantity: new Big('1'), symbol: 'MSFT', tags: [], diff --git a/apps/api/src/app/portfolio/current-rate.service.mock.ts b/apps/api/src/app/portfolio/current-rate.service.mock.ts index 313b09d67..fab25ae2d 100644 --- a/apps/api/src/app/portfolio/current-rate.service.mock.ts +++ b/apps/api/src/app/portfolio/current-rate.service.mock.ts @@ -65,6 +65,8 @@ function mockGetValue(symbol: string, date: Date) { return { marketPrice: 89.12 }; } else if (isSameDay(parseDate('2021-11-16'), date)) { return { marketPrice: 339.51 }; + } else if (isSameDay(parseDate('2023-07-09'), date)) { + return { marketPrice: 337.22 }; } else if (isSameDay(parseDate('2023-07-10'), date)) { return { marketPrice: 331.83 }; }