Browse Source

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

* Extend test
pull/3965/head
Thomas Kaul 3 months ago
committed by GitHub
parent
commit
14b88edff6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 17
      apps/api/src/app/portfolio/calculator/twr/portfolio-calculator-msft-buy-with-dividend.spec.ts
  2. 2
      apps/api/src/app/portfolio/current-rate.service.mock.ts

17
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: [],

2
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 };
}

Loading…
Cancel
Save