Browse Source
Bugfix/fix division by zero in performance calculation (#3695)
* Fix division by zero
* Update changelog
pull/3697/head
Thomas Kaul
5 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
8 additions and
4 deletions
-
CHANGELOG.md
-
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
|
|
@ -5,7 +5,7 @@ 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/), |
|
|
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
|
|
|
|
|
|
|
## 2.106.0-alpha.1 - 2024-08-24 |
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
|
|
@ -713,10 +713,14 @@ export abstract class PortfolioCalculator { |
|
|
|
netPerformanceWithCurrencyEffect: |
|
|
|
netPerformanceWithCurrencyEffectSinceStartDate, |
|
|
|
netPerformanceInPercentage: |
|
|
|
netPerformanceSinceStartDate / timeWeightedInvestmentValue, |
|
|
|
timeWeightedInvestmentValue === 0 |
|
|
|
? 0 |
|
|
|
: netPerformanceSinceStartDate / timeWeightedInvestmentValue, |
|
|
|
netPerformanceInPercentageWithCurrencyEffect: |
|
|
|
netPerformanceWithCurrencyEffectSinceStartDate / |
|
|
|
timeWeightedInvestmentValue, |
|
|
|
timeWeightedInvestmentValue === 0 |
|
|
|
? 0 |
|
|
|
: netPerformanceWithCurrencyEffectSinceStartDate / |
|
|
|
timeWeightedInvestmentValue, |
|
|
|
// TODO: Add net worth with valuables
|
|
|
|
// netWorth: totalCurrentValueWithCurrencyEffect
|
|
|
|
// .plus(totalAccountBalanceWithCurrencyEffect)
|
|
|
|