@barchart/portfolio-api-common 1.0.116 → 1.0.117
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.
|
@@ -394,8 +394,13 @@ module.exports = (() => {
|
|
|
394
394
|
const actual = group._dataActual;
|
|
395
395
|
const format = group._dataFormat;
|
|
396
396
|
|
|
397
|
-
|
|
398
|
-
|
|
397
|
+
if (actual.basis.getIsZero()) {
|
|
398
|
+
actual.unrealizedPercent = null;
|
|
399
|
+
format.unrealizedPercent = '—';
|
|
400
|
+
} else {
|
|
401
|
+
actual.unrealizedPercent = actual.unrealized.divide(actual.basis);
|
|
402
|
+
format.unrealizedPercent = formatPercent(actual.unrealizedPercent, 2);
|
|
403
|
+
}
|
|
399
404
|
}
|
|
400
405
|
|
|
401
406
|
const unchanged = { up: false, down: false };
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1399,8 +1399,13 @@ module.exports = (() => {
|
|
|
1399
1399
|
const actual = group._dataActual;
|
|
1400
1400
|
const format = group._dataFormat;
|
|
1401
1401
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1402
|
+
if (actual.basis.getIsZero()) {
|
|
1403
|
+
actual.unrealizedPercent = null;
|
|
1404
|
+
format.unrealizedPercent = '—';
|
|
1405
|
+
} else {
|
|
1406
|
+
actual.unrealizedPercent = actual.unrealized.divide(actual.basis);
|
|
1407
|
+
format.unrealizedPercent = formatPercent(actual.unrealizedPercent, 2);
|
|
1408
|
+
}
|
|
1404
1409
|
}
|
|
1405
1410
|
|
|
1406
1411
|
const unchanged = { up: false, down: false };
|