@barchart/portfolio-api-common 1.11.2 → 1.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -892,7 +892,7 @@ module.exports = (() => {
|
|
|
892
892
|
let marketChange = updates.market.subtract(actual.marketPrevious);
|
|
893
893
|
let marketChangePercent;
|
|
894
894
|
|
|
895
|
-
if (actual.marketPrevious.
|
|
895
|
+
if (actual.marketPrevious.getIsApproximate(Decimal.ZERO, 4)) {
|
|
896
896
|
if (marketChange.getIsPositive()) {
|
|
897
897
|
marketChangePercent = Decimal.ONE;
|
|
898
898
|
} else if (marketChange.getIsNegative()) {
|
|
@@ -950,7 +950,7 @@ module.exports = (() => {
|
|
|
950
950
|
if (parent && !excluded) {
|
|
951
951
|
const parentData = parent._dataActual;
|
|
952
952
|
|
|
953
|
-
if (parentData.marketAbsolute !== null && !parentData.marketAbsolute.
|
|
953
|
+
if (parentData.marketAbsolute !== null && !parentData.marketAbsolute.getIsApproximate(Decimal.ZERO, 4)) {
|
|
954
954
|
let numerator;
|
|
955
955
|
|
|
956
956
|
if (group.currency !== parent.currency) {
|
|
@@ -992,7 +992,7 @@ module.exports = (() => {
|
|
|
992
992
|
const numerator = actual.realized;
|
|
993
993
|
const denominator = totalBasis.subtract(openBasis);
|
|
994
994
|
|
|
995
|
-
if (denominator.
|
|
995
|
+
if (denominator.getIsApproximate(Decimal.ZERO, 4)) {
|
|
996
996
|
actual.realizedPercent = Decimal.ZERO;
|
|
997
997
|
} else {
|
|
998
998
|
actual.realizedPercent = numerator.divide(denominator);
|
|
@@ -1008,7 +1008,7 @@ module.exports = (() => {
|
|
|
1008
1008
|
const numerator = actual.unrealized;
|
|
1009
1009
|
const denominator = actual.basis.absolute();
|
|
1010
1010
|
|
|
1011
|
-
if (denominator.
|
|
1011
|
+
if (denominator.getIsApproximate(Decimal.ZERO, 4)) {
|
|
1012
1012
|
actual.unrealizedPercent = Decimal.ZERO;
|
|
1013
1013
|
} else {
|
|
1014
1014
|
actual.unrealizedPercent = numerator.divide(denominator);
|
|
@@ -1018,7 +1018,7 @@ module.exports = (() => {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
1020
1020
|
function calculateGainPercent(gain, basis) {
|
|
1021
|
-
return basis.
|
|
1021
|
+
return basis.getIsApproximate(Decimal.ZERO, 4) ? Decimal.ZERO : gain.divide(basis);
|
|
1022
1022
|
}
|
|
1023
1023
|
|
|
1024
1024
|
const unchanged = { up: false, down: false };
|