@barchart/portfolio-api-common 1.0.251 → 1.0.255

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.
@@ -730,7 +730,7 @@ module.exports = (() => {
730
730
  actual.unrealized = updates.unrealized;
731
731
  actual.unrealizedToday = updates.unrealizedToday;
732
732
  actual.summaryTotalCurrent = updates.summaryTotalCurrent;
733
- actual.total = updates.unrealizedToday.add(actual.realized).add(actual.income);
733
+ actual.total = updates.unrealized.add(actual.realized).add(actual.income);
734
734
 
735
735
  format.market = formatCurrency(actual.market, currency);
736
736
 
@@ -258,6 +258,7 @@ module.exports = (() => {
258
258
  .withField('quantity', DataType.DECIMAL)
259
259
  .withField('fee', DataType.DECIMAL, true)
260
260
  .withField('force', DataType.BOOLEAN, true)
261
+ .withField('reinvest', DataType.BOOLEAN, true)
261
262
  .schema
262
263
  );
263
264
 
@@ -299,6 +300,7 @@ module.exports = (() => {
299
300
  .withField('quantity', DataType.DECIMAL)
300
301
  .withField('fee', DataType.DECIMAL, true)
301
302
  .withField('force', DataType.BOOLEAN, true)
303
+ .withField('reinvest', DataType.BOOLEAN, true)
302
304
  .schema
303
305
  );
304
306
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.251",
3
+ "version": "1.0.255",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -2487,7 +2487,7 @@ module.exports = (() => {
2487
2487
  actual.unrealized = updates.unrealized;
2488
2488
  actual.unrealizedToday = updates.unrealizedToday;
2489
2489
  actual.summaryTotalCurrent = updates.summaryTotalCurrent;
2490
- actual.total = updates.unrealizedToday.add(actual.realized).add(actual.income);
2490
+ actual.total = updates.unrealized.add(actual.realized).add(actual.income);
2491
2491
 
2492
2492
  format.market = formatCurrency(actual.market, currency);
2493
2493
 
@@ -3830,6 +3830,33 @@ module.exports = function () {
3830
3830
  }
3831
3831
  }
3832
3832
 
3833
+ /**
3834
+ * Climbs the tree, evaluating each parent until a predicate is matched. Once matched,
3835
+ * the {@link Tree} node is returned. Otherwise, if the predicate cannot be matched,
3836
+ * a null value is returned.
3837
+ *
3838
+ * @public
3839
+ * @param {Tree~nodePredicate} predicate - A predicate that tests each child node. The predicate takes two arguments -- the node's value, and the node itself.
3840
+ * @param {boolean=} includeCurrentNode - If true, the predicate will be applied to the current node.
3841
+ * @returns {Tree|null}
3842
+ */
3843
+
3844
+ }, {
3845
+ key: 'findParent',
3846
+ value: function findParent(predicate, includeCurrentNode) {
3847
+ var returnRef = void 0;
3848
+
3849
+ if (is.boolean(includeCurrentNode) && includeCurrentNode && predicate(this.getValue(), this)) {
3850
+ returnRef = this;
3851
+ } else if (this._parent !== null) {
3852
+ returnRef = this._parent.findParent(predicate, true);
3853
+ } else {
3854
+ returnRef = null;
3855
+ }
3856
+
3857
+ return returnRef;
3858
+ }
3859
+
3833
3860
  /**
3834
3861
  * Creates a representation of the tree using JavaScript objects and arrays.
3835
3862
  *