@barchart/portfolio-api-common 1.0.182 → 1.0.186

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.
@@ -326,10 +326,10 @@ module.exports = (() => {
326
326
  const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false);
327
327
  const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false);
328
328
 
329
- const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, true, false);
330
- const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, true);
331
- const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, true);
332
- const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, true, false);
329
+ const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false);
330
+ const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false);
331
+ const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false);
332
+ const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false);
333
333
 
334
334
  const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false);
335
335
  const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false);
@@ -486,7 +486,7 @@ module.exports = (() => {
486
486
  getPositions(portfolio) {
487
487
  assert.argumentIsRequired(portfolio, 'portfolio', String);
488
488
 
489
- return getPositionItemsForPortfolio(this._items, portfolio).map(item => item.position);
489
+ return getPositionItemsForPortfolio(this._items, portfolio);
490
490
  }
491
491
 
492
492
  /**
@@ -611,7 +611,9 @@ module.exports = (() => {
611
611
  }));
612
612
 
613
613
  addGroupBinding.call(this, group, group.registerMarketPercentChangeHandler(() => {
614
- groupTree.getParent().walk((childGroup) => childGroup.refreshMarketPercent());
614
+ if (!groupTree.getIsRoot()) {
615
+ groupTree.getParent().walk((childGroup) => childGroup.refreshMarketPercent());
616
+ }
615
617
  }));
616
618
  }
617
619
 
@@ -178,7 +178,8 @@ module.exports = (() => {
178
178
  const quoteChangeNegative = quote.lastPriceDirection === 'down';
179
179
 
180
180
  setTimeout(() => this._dataFormat.quoteChangeDirection = { up: quoteChangePositive, down: quoteChangeNegative }, 0);
181
- this._dataFormat.quoteChangeNegative = quoteChangeNegative;
181
+
182
+ this._dataFormat.quoteChangeNegative = is.number(this._dataActual.quoteChange) && this._dataActual.quoteChange < 0;
182
183
  } else {
183
184
  this._dataActual.currentPrice = null;
184
185
  this._dataFormat.currentPrice = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.182",
3
+ "version": "1.0.186",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -702,10 +702,10 @@ module.exports = (() => {
702
702
  const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false);
703
703
  const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false);
704
704
 
705
- const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, true, false);
706
- const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, true);
707
- const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, true);
708
- const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, true, false);
705
+ const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false);
706
+ const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false);
707
+ const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false);
708
+ const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false);
709
709
 
710
710
  const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false);
711
711
  const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false);
@@ -1202,7 +1202,7 @@ module.exports = (() => {
1202
1202
  getPositions(portfolio) {
1203
1203
  assert.argumentIsRequired(portfolio, 'portfolio', String);
1204
1204
 
1205
- return getPositionItemsForPortfolio(this._items, portfolio).map(item => item.position);
1205
+ return getPositionItemsForPortfolio(this._items, portfolio);
1206
1206
  }
1207
1207
 
1208
1208
  /**
@@ -1327,7 +1327,9 @@ module.exports = (() => {
1327
1327
  }));
1328
1328
 
1329
1329
  addGroupBinding.call(this, group, group.registerMarketPercentChangeHandler(() => {
1330
- groupTree.getParent().walk((childGroup) => childGroup.refreshMarketPercent());
1330
+ if (!groupTree.getIsRoot()) {
1331
+ groupTree.getParent().walk((childGroup) => childGroup.refreshMarketPercent());
1332
+ }
1331
1333
  }));
1332
1334
  }
1333
1335
 
@@ -1704,7 +1706,8 @@ module.exports = (() => {
1704
1706
  const quoteChangeNegative = quote.lastPriceDirection === 'down';
1705
1707
 
1706
1708
  setTimeout(() => this._dataFormat.quoteChangeDirection = { up: quoteChangePositive, down: quoteChangeNegative }, 0);
1707
- this._dataFormat.quoteChangeNegative = quoteChangeNegative;
1709
+
1710
+ this._dataFormat.quoteChangeNegative = is.number(this._dataActual.quoteChange) && this._dataActual.quoteChange < 0;
1708
1711
  } else {
1709
1712
  this._dataActual.currentPrice = null;
1710
1713
  this._dataFormat.currentPrice = null;