Browse Source

FIx BALN Test

pull/5027/head
Daniel Devaud 1 year ago
parent
commit
fc32b392e3
  1. 18
      apps/api/src/app/portfolio/portfolio-calculator.ts

18
apps/api/src/app/portfolio/portfolio-calculator.ts

@ -1157,10 +1157,7 @@ export class PortfolioCalculator {
Value: new Big(0), Value: new Big(0),
WithCurrencyEffect: new Big(0) WithCurrencyEffect: new Big(0)
}; };
let investmentAtStartDate: WithCurrencyEffect<Big> = { let investmentAtStartDate;
Value: new Big(0),
WithCurrencyEffect: new Big(0)
};
const investmentValuesAccumulated: WithCurrencyEffect<{ const investmentValuesAccumulated: WithCurrencyEffect<{
[date: string]: Big; [date: string]: Big;
}> = { }> = {
@ -2053,15 +2050,12 @@ export class PortfolioCalculator {
order.unitPriceInBaseCurrencyWithCurrencyEffect order.unitPriceInBaseCurrencyWithCurrencyEffect
) )
}; };
if ( if (!investmentAtStartDate && i >= indexOfStartOrder) {
(investmentAtStartDate.Value?.eq(0) ?? true) && investmentAtStartDate = {
i >= indexOfStartOrder Value: totalInvestment.Value ?? new Big(0),
) { WithCurrencyEffect: totalInvestment.WithCurrencyEffect ?? new Big(0)
investmentAtStartDate.Value = totalInvestment.Value ?? new Big(0); };
valueAtStartDate.Value = valueOfInvestmentBeforeTransaction.Value; valueAtStartDate.Value = valueOfInvestmentBeforeTransaction.Value;
investmentAtStartDate.WithCurrencyEffect =
totalInvestment.WithCurrencyEffect ?? new Big(0);
valueAtStartDate.WithCurrencyEffect = valueAtStartDate.WithCurrencyEffect =
valueOfInvestmentBeforeTransaction.WithCurrencyEffect; valueOfInvestmentBeforeTransaction.WithCurrencyEffect;
} }

Loading…
Cancel
Save