@barchart/portfolio-api-common 1.17.0 → 1.17.1

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.
@@ -304,6 +304,22 @@ module.exports = (() => {
304
304
  return this._excluded;
305
305
  }
306
306
 
307
+ /**
308
+ * Changes the group currency.
309
+ *
310
+ * @public
311
+ * @param {Currency} currency
312
+ */
313
+ changeCurrency(currency) {
314
+ assert.argumentIsRequired(currency, 'currency', Currency, 'Currency');
315
+
316
+ if (this._currency !== currency) {
317
+ this._currency = currency;
318
+
319
+ this.refresh();
320
+ }
321
+ }
322
+
307
323
  /**
308
324
  * Sets the immediate parent group (allowing for calculation of relative
309
325
  * percentages).
@@ -442,6 +458,8 @@ module.exports = (() => {
442
458
  }
443
459
 
444
460
  this._dataFormat.portfolioType = portfolioType;
461
+
462
+ this.changeCurrency(this._definition.currencySelector({ portfolio }));
445
463
  }
446
464
 
447
465
  /**
@@ -605,6 +623,14 @@ module.exports = (() => {
605
623
 
606
624
  this._dataActual.description = this._description;
607
625
  this._dataFormat.description = this._description;
626
+
627
+ if (this._definition.type !== PositionLevelType.PORTFOLIO || this._key !== PositionLevelDefinition.getKeyForPortfolioGroup(portfolio)) {
628
+ return;
629
+ }
630
+
631
+ const currencySelector = this._definition.currencySelector;
632
+
633
+ this.changeCurrency(currencySelector({ portfolio }));
608
634
  }));
609
635
 
610
636
  this._disposeStack.push(fundamentalBinding);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "description": "Common JavaScript code used by Barchart's Portfolio Service",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",