Feature/harmonize algebraic sign of gross and net performance percent (#776)
* Harmonize algebraic sign * Update changelog
This commit is contained in:
parent
b8c43ecf89
commit
65f6bcb166
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Renamed `orders` to `activities` in import and export functionality
|
- Renamed `orders` to `activities` in import and export functionality
|
||||||
|
- Harmonized the algebraic sign of `currentGrossPerformancePercent` and `currentNetPerformancePercent` with `currentGrossPerformance` and `currentNetPerformance`
|
||||||
- Improved the pricing page
|
- Improved the pricing page
|
||||||
|
|
||||||
## 1.130.0 - 30.03.2022
|
## 1.130.0 - 30.03.2022
|
||||||
|
@ -810,23 +810,33 @@ export class PortfolioServiceNew {
|
|||||||
|
|
||||||
const hasErrors = currentPositions.hasErrors;
|
const hasErrors = currentPositions.hasErrors;
|
||||||
const currentValue = currentPositions.currentValue.toNumber();
|
const currentValue = currentPositions.currentValue.toNumber();
|
||||||
const currentGrossPerformance =
|
const currentGrossPerformance = currentPositions.grossPerformance;
|
||||||
currentPositions.grossPerformance.toNumber();
|
let currentGrossPerformancePercent =
|
||||||
const currentGrossPerformancePercent =
|
currentPositions.grossPerformancePercentage;
|
||||||
currentPositions.grossPerformancePercentage.toNumber();
|
const currentNetPerformance = currentPositions.netPerformance;
|
||||||
const currentNetPerformance = currentPositions.netPerformance.toNumber();
|
let currentNetPerformancePercent =
|
||||||
const currentNetPerformancePercent =
|
currentPositions.netPerformancePercentage;
|
||||||
currentPositions.netPerformancePercentage.toNumber();
|
|
||||||
|
if (currentGrossPerformance.mul(currentGrossPerformancePercent).lt(0)) {
|
||||||
|
// If algebraic sign is different, harmonize it
|
||||||
|
currentGrossPerformancePercent = currentGrossPerformancePercent.mul(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentNetPerformance.mul(currentNetPerformancePercent).lt(0)) {
|
||||||
|
// If algebraic sign is different, harmonize it
|
||||||
|
currentNetPerformancePercent = currentNetPerformancePercent.mul(-1);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
errors: currentPositions.errors,
|
errors: currentPositions.errors,
|
||||||
hasErrors: currentPositions.hasErrors || hasErrors,
|
hasErrors: currentPositions.hasErrors || hasErrors,
|
||||||
performance: {
|
performance: {
|
||||||
currentGrossPerformance,
|
currentValue,
|
||||||
currentGrossPerformancePercent,
|
currentGrossPerformance: currentGrossPerformance.toNumber(),
|
||||||
currentNetPerformance,
|
currentGrossPerformancePercent:
|
||||||
currentNetPerformancePercent,
|
currentGrossPerformancePercent.toNumber(),
|
||||||
currentValue
|
currentNetPerformance: currentNetPerformance.toNumber(),
|
||||||
|
currentNetPerformancePercent: currentNetPerformancePercent.toNumber()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user