Browse Source

Fix tests

pull/5027/head
Daniel Devaud 3 months ago
parent
commit
6573126116
  1. 18
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  2. 18
      apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-msft-buy-with-dividend.spec.ts

18
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;

18
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'),

Loading…
Cancel
Save