Bugfix/fix division by zero in calculate overall gross performance (#253)
* Fix error with division by zero * Update changelog
This commit is contained in:
parent
66900ffa24
commit
7f047362cc
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed an issue of a division by zero in the portfolio calculations
|
||||||
|
|
||||||
## 1.32.0 - 04.08.2021
|
## 1.32.0 - 04.08.2021
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -418,13 +418,18 @@ export class PortfolioCalculator {
|
|||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!completeInitialValue.eq(0)) {
|
||||||
|
grossPerformancePercentage =
|
||||||
|
grossPerformancePercentage.div(completeInitialValue);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentValue,
|
currentValue,
|
||||||
grossPerformance,
|
grossPerformance,
|
||||||
|
grossPerformancePercentage,
|
||||||
hasErrors,
|
hasErrors,
|
||||||
totalInvestment,
|
totalInvestment
|
||||||
grossPerformancePercentage:
|
|
||||||
grossPerformancePercentage.div(completeInitialValue)
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user