Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/extend MSFT buy with dividend test (#3891)

Thomas Kaul14b88edff6df
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 97b8604007..ba1cbeb3cf 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 313b09d670..fab25ae2d8 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 };
}