@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
- actual.unrealizedPercent = actual.unrealized.divide(actual.basis);
398
- format.unrealizedPercent = formatPercent(actual.unrealizedPercent, 2);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.116",
3
+ "version": "1.0.117",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1399,8 +1399,13 @@ module.exports = (() => {
1399
1399
  const actual = group._dataActual;
1400
1400
  const format = group._dataFormat;
1401
1401
 
1402
- actual.unrealizedPercent = actual.unrealized.divide(actual.basis);
1403
- format.unrealizedPercent = formatPercent(actual.unrealizedPercent, 2);
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 };