@barchart/portfolio-api-common 1.0.158 → 1.0.159

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.
@@ -123,7 +123,6 @@ module.exports = (() => {
123
123
  this._dataActual.summaryTotalPrevious = null;
124
124
  this._dataActual.cashTotal = null;
125
125
 
126
- this._dataFormat.type = null;
127
126
  this._dataFormat.currentPrice = null;
128
127
  this._dataFormat.previousPrice = null;
129
128
  this._dataFormat.basis = null;
@@ -144,6 +143,7 @@ module.exports = (() => {
144
143
  this._dataFormat.summaryTotalPrevious = null;
145
144
  this._dataFormat.summaryTotalPreviousNegative = false;
146
145
  this._dataFormat.cashTotal = null;
146
+ this._dataFormat.portfolioType = null;
147
147
 
148
148
  this._items.forEach((item) => {
149
149
  this._disposeStack.push(item.registerQuoteChangeHandler((quote, sender) => {
@@ -509,14 +509,28 @@ module.exports = (() => {
509
509
  if (group.single) {
510
510
  const item = group._items[0];
511
511
 
512
- format.type = item.data.type || null;
513
-
514
512
  actual.quantity = item.position.snapshot.open;
515
513
  actual.basisPrice = item.data.basisPrice;
516
514
 
517
515
  format.quantity = formatDecimal(actual.quantity, 2);
518
516
  format.basisPrice = formatCurrency(actual.basisPrice, currency);
519
517
  }
518
+
519
+ const groupItems = group._items;
520
+
521
+ let portfolioType = null;
522
+
523
+ if (groupItems.length > 0) {
524
+ const portfolio = groupItems[0].portfolio;
525
+
526
+ if (groupItems.every(i => i.portfolio.portfolio === portfolio.portfolio)) {
527
+ if (portfolio.miscellany && portfolio.miscellany.data.type && portfolio.miscellany.data.type.value) {
528
+ portfolioType = portfolio.miscellany.data.type.value;
529
+ }
530
+ }
531
+ }
532
+
533
+ format.portfolioType = portfolioType;
520
534
  }
521
535
 
522
536
  function calculatePriceData(group, rates, item, forceRefresh) {
@@ -61,8 +61,6 @@ module.exports = (() => {
61
61
  this._data.newsExists = false;
62
62
  this._data.fundamental = { };
63
63
 
64
- this._data.type = null;
65
-
66
64
  calculateStaticData(this);
67
65
  calculatePriceData(this, null);
68
66
 
@@ -237,10 +235,6 @@ module.exports = (() => {
237
235
 
238
236
  const data = item._data;
239
237
 
240
- if (portfolio.miscellany && portfolio.miscellany.data.type && portfolio.miscellany.data.type.value) {
241
- data.type = portfolio.miscellany.data.type.value;
242
- }
243
-
244
238
  data.previousPrice = position.previous || null;
245
239
 
246
240
  let basis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.158",
3
+ "version": "1.0.159",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1368,7 +1368,6 @@ module.exports = (() => {
1368
1368
  this._dataActual.summaryTotalPrevious = null;
1369
1369
  this._dataActual.cashTotal = null;
1370
1370
 
1371
- this._dataFormat.type = null;
1372
1371
  this._dataFormat.currentPrice = null;
1373
1372
  this._dataFormat.previousPrice = null;
1374
1373
  this._dataFormat.basis = null;
@@ -1389,6 +1388,7 @@ module.exports = (() => {
1389
1388
  this._dataFormat.summaryTotalPrevious = null;
1390
1389
  this._dataFormat.summaryTotalPreviousNegative = false;
1391
1390
  this._dataFormat.cashTotal = null;
1391
+ this._dataFormat.portfolioType = null;
1392
1392
 
1393
1393
  this._items.forEach((item) => {
1394
1394
  this._disposeStack.push(item.registerQuoteChangeHandler((quote, sender) => {
@@ -1754,14 +1754,28 @@ module.exports = (() => {
1754
1754
  if (group.single) {
1755
1755
  const item = group._items[0];
1756
1756
 
1757
- format.type = item.data.type || null;
1758
-
1759
1757
  actual.quantity = item.position.snapshot.open;
1760
1758
  actual.basisPrice = item.data.basisPrice;
1761
1759
 
1762
1760
  format.quantity = formatDecimal(actual.quantity, 2);
1763
1761
  format.basisPrice = formatCurrency(actual.basisPrice, currency);
1764
1762
  }
1763
+
1764
+ const groupItems = group._items;
1765
+
1766
+ let portfolioType = null;
1767
+
1768
+ if (groupItems.length > 0) {
1769
+ const portfolio = groupItems[0].portfolio;
1770
+
1771
+ if (groupItems.every(i => i.portfolio.portfolio === portfolio.portfolio)) {
1772
+ if (portfolio.miscellany && portfolio.miscellany.data.type && portfolio.miscellany.data.type.value) {
1773
+ portfolioType = portfolio.miscellany.data.type.value;
1774
+ }
1775
+ }
1776
+ }
1777
+
1778
+ format.portfolioType = portfolioType;
1765
1779
  }
1766
1780
 
1767
1781
  function calculatePriceData(group, rates, item, forceRefresh) {
@@ -1975,8 +1989,6 @@ module.exports = (() => {
1975
1989
  this._data.newsExists = false;
1976
1990
  this._data.fundamental = { };
1977
1991
 
1978
- this._data.type = null;
1979
-
1980
1992
  calculateStaticData(this);
1981
1993
  calculatePriceData(this, null);
1982
1994
 
@@ -2151,10 +2163,6 @@ module.exports = (() => {
2151
2163
 
2152
2164
  const data = item._data;
2153
2165
 
2154
- if (portfolio.miscellany && portfolio.miscellany.data.type && portfolio.miscellany.data.type.value) {
2155
- data.type = portfolio.miscellany.data.type.value;
2156
- }
2157
-
2158
2166
  data.previousPrice = position.previous || null;
2159
2167
 
2160
2168
  let basis;