@barchart/portfolio-api-common 1.3.1 → 1.3.2

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.
@@ -570,15 +570,13 @@ module.exports = (() => {
570
570
  data.periodUnrealized = periodUnrealized;
571
571
  data.periodUnrealizedChange = periodUnrealizedChange;
572
572
  } else {
573
- data.unrealized = Decimal.ZERO;
574
573
  data.unrealizedChange = Decimal.ZERO;
575
-
574
+ data.periodUnrealized = Decimal.ZERO;
576
575
  data.periodGainChange = Decimal.ZERO;
577
576
  }
578
577
  } else {
579
- data.unrealized = Decimal.ZERO;
580
578
  data.unrealizedChange = Decimal.ZERO;
581
-
579
+ data.periodUnrealized = Decimal.ZERO;
582
580
  data.periodGainChange = Decimal.ZERO;
583
581
  }
584
582
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -4112,15 +4112,13 @@ module.exports = (() => {
4112
4112
  data.periodUnrealized = periodUnrealized;
4113
4113
  data.periodUnrealizedChange = periodUnrealizedChange;
4114
4114
  } else {
4115
- data.unrealized = Decimal.ZERO;
4116
4115
  data.unrealizedChange = Decimal.ZERO;
4117
-
4116
+ data.periodUnrealized = Decimal.ZERO;
4118
4117
  data.periodGainChange = Decimal.ZERO;
4119
4118
  }
4120
4119
  } else {
4121
- data.unrealized = Decimal.ZERO;
4122
4120
  data.unrealizedChange = Decimal.ZERO;
4123
-
4121
+ data.periodUnrealized = Decimal.ZERO;
4124
4122
  data.periodGainChange = Decimal.ZERO;
4125
4123
  }
4126
4124
  }
@@ -5285,7 +5283,7 @@ module.exports = function () {
5285
5283
  *
5286
5284
  * @public
5287
5285
  * @param {*} value - The value of the node.
5288
- * @param {Tree=} parent - The parent node. If not supplied, this will be the root node.
5286
+ * @param {Tree} parent - The parent node. If not supplied, this will be the root node.
5289
5287
  */
5290
5288
 
5291
5289
  var Tree = function () {
@@ -6431,20 +6429,7 @@ module.exports = function () {
6431
6429
  }
6432
6430
 
6433
6431
  /**
6434
- * Returns a new {@link Day} instance for the start of the month referenced by the current instance.
6435
- *
6436
- * @public
6437
- * @returns {Day}
6438
- */
6439
-
6440
- }, {
6441
- key: 'getStartOfMonth',
6442
- value: function getStartOfMonth() {
6443
- return new Day(this.year, this.month, 1);
6444
- }
6445
-
6446
- /**
6447
- * Returns a new instance for the {@link Day} end of the month referenced by the current instance.
6432
+ * Returns a new Day instance for the end of the month of the current instance.
6448
6433
  *
6449
6434
  * @public
6450
6435
  * @returns {Day}
@@ -6596,7 +6581,7 @@ module.exports = function () {
6596
6581
  return this._month;
6597
6582
  }
6598
6583
 
6599
- /**day
6584
+ /**
6600
6585
  * The day of the month.
6601
6586
  *
6602
6587
  * @public
@@ -6617,7 +6602,7 @@ module.exports = function () {
6617
6602
  }
6618
6603
 
6619
6604
  /**
6620
- * Converts a string (which matches the output of {@link Day#format}) into
6605
+ * Converts a string (which matches the output of {@link Day#format} into
6621
6606
  * a {@link Day} instance.
6622
6607
  *
6623
6608
  * @public
@@ -6888,24 +6873,6 @@ module.exports = function () {
6888
6873
  return new Decimal(this._big.div(getBig(other)));
6889
6874
  }
6890
6875
 
6891
- /**
6892
- * Returns a new {@link Decimal} instance with a value that results
6893
- * from raising the current instance to the power of the exponent
6894
- * provided.
6895
- *
6896
- * @public
6897
- * @param {Decimal|Number|String} exponent
6898
- * @returns {Decimal}
6899
- */
6900
-
6901
- }, {
6902
- key: 'raise',
6903
- value: function raise(exponent) {
6904
- assert.argumentIsRequired(exponent, 'exponent', Number);
6905
-
6906
- return new Decimal(this._big.pow(exponent));
6907
- }
6908
-
6909
6876
  /**
6910
6877
  * Returns a new {@link Decimal} with a value resulting from a rounding
6911
6878
  * operation on the current value.
@@ -7070,28 +7037,6 @@ module.exports = function () {
7070
7037
  return this._big.eq(getBig(other));
7071
7038
  }
7072
7039
 
7073
- /**
7074
- * Returns true is close to another value.
7075
- *
7076
- * @public
7077
- * @param {Decimal|Number|String} other - The value to compare.
7078
- * @param {Number} places - The significant digits.
7079
- * @returns {Boolean}
7080
- */
7081
-
7082
- }, {
7083
- key: 'getIsApproximate',
7084
- value: function getIsApproximate(other, places) {
7085
- if (places === 0) {
7086
- return this.getIsEqual(other);
7087
- }
7088
-
7089
- var difference = this.subtract(other).absolute();
7090
- var tolerance = Decimal.ONE.divide(new Decimal(10).raise(places));
7091
-
7092
- return difference.getIsLessThan(tolerance);
7093
- }
7094
-
7095
7040
  /**
7096
7041
  * Returns true if the current instance is an integer (i.e. has no decimal
7097
7042
  * component).
@@ -8775,62 +8720,8 @@ module.exports = function () {
8775
8720
  }
8776
8721
 
8777
8722
  return found;
8778
- },
8779
-
8780
-
8781
- /**
8782
- * Inserts an item into an array using a binary search is used to determine the
8783
- * proper point for insertion and returns the same array.
8784
- *
8785
- * @static
8786
- * @public
8787
- * @param {Array} a
8788
- * @param {*} item
8789
- * @param {Function} comparator
8790
- * @returns {Array}
8791
- */
8792
- insert: function insert(a, item, comparator) {
8793
- assert.argumentIsArray(a, 'a');
8794
- assert.argumentIsRequired(comparator, 'comparator', Function);
8795
-
8796
- if (a.length === 0 || !(comparator(item, a[a.length - 1]) < 0)) {
8797
- a.push(item);
8798
- } else if (comparator(item, a[0]) < 0) {
8799
- a.unshift(item);
8800
- } else {
8801
- a.splice(binarySearch(a, item, comparator, 0, a.length - 1), 0, item);
8802
- }
8803
-
8804
- return a;
8805
8723
  }
8806
8724
  };
8807
-
8808
- function binarySearch(array, item, comparator, start, end) {
8809
- var size = end - start;
8810
-
8811
- var midpointIndex = start + Math.floor(size / 2);
8812
- var midpointItem = array[midpointIndex];
8813
-
8814
- var comparison = comparator(item, midpointItem) > 0;
8815
-
8816
- if (size < 2) {
8817
- if (comparison > 0) {
8818
- var finalIndex = array.length - 1;
8819
-
8820
- if (end === finalIndex && comparator(item, array[finalIndex]) > 0) {
8821
- return end + 1;
8822
- } else {
8823
- return end;
8824
- }
8825
- } else {
8826
- return start;
8827
- }
8828
- } else if (comparison > 0) {
8829
- return binarySearch(array, item, comparator, midpointIndex, end);
8830
- } else {
8831
- return binarySearch(array, item, comparator, start, midpointIndex);
8832
- }
8833
- }
8834
8725
  }();
8835
8726
 
8836
8727
  },{"./assert":29,"./is":33}],29:[function(require,module,exports){
@@ -9351,7 +9242,7 @@ module.exports = function () {
9351
9242
  * @static
9352
9243
  * @public
9353
9244
  * @param {*} candidate
9354
- * @returns {boolean}
9245
+ * @returns {*|boolean}
9355
9246
  */
9356
9247
  negative: function negative(candidate) {
9357
9248
  return this.number(candidate) && candidate < 0;