@barchart/portfolio-api-common 1.2.3 → 1.2.4

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.
@@ -71,6 +71,7 @@ module.exports = (() => {
71
71
  this._dataFormat.key = this._key;
72
72
  this._dataFormat.description = this._description;
73
73
  this._dataFormat.hide = false;
74
+ this._dataFormat.invalid = false;
74
75
  this._dataFormat.newsExists = false;
75
76
  this._dataFormat.quantity = null;
76
77
  this._dataFormat.basisPrice = null;
@@ -412,7 +413,7 @@ module.exports = (() => {
412
413
  * @public
413
414
  */
414
415
  refresh() {
415
- calculateStaticData(this, this._rates);
416
+ calculateStaticData(this, this._rates, this._definition);
416
417
  calculatePriceData(this, this._rates, null, true);
417
418
  }
418
419
 
@@ -458,9 +459,6 @@ module.exports = (() => {
458
459
  if (this._single) {
459
460
  const precision = sender.position.instrument.currency.precision;
460
461
 
461
- this._dataActual.invalid = this._definition.type === PositionLevelType.POSITION && item.invalid;
462
- this._dataFormat.invalid = this._dataActual.invalid;
463
-
464
462
  this._dataActual.currentPrice = quote.lastPrice;
465
463
  this._dataFormat.currentPrice = formatNumber(this._dataActual.currentPrice, precision);
466
464
 
@@ -617,7 +615,7 @@ module.exports = (() => {
617
615
  return formatDecimal(decimal, currency.precision);
618
616
  }
619
617
 
620
- function calculateStaticData(group, rates) {
618
+ function calculateStaticData(group, rates, definition) {
621
619
  const actual = group._dataActual;
622
620
  const format = group._dataFormat;
623
621
 
@@ -694,6 +692,8 @@ module.exports = (() => {
694
692
 
695
693
  format.quantity = formatDecimal(actual.quantity, 2);
696
694
  format.basisPrice = formatCurrency(actual.basisPrice, currency);
695
+
696
+ format.invalid = definition.type === PositionLevelType.POSITION && item.invalid;
697
697
  }
698
698
 
699
699
  const groupItems = group._items;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -2173,6 +2173,7 @@ module.exports = (() => {
2173
2173
  this._dataFormat.key = this._key;
2174
2174
  this._dataFormat.description = this._description;
2175
2175
  this._dataFormat.hide = false;
2176
+ this._dataFormat.invalid = false;
2176
2177
  this._dataFormat.newsExists = false;
2177
2178
  this._dataFormat.quantity = null;
2178
2179
  this._dataFormat.basisPrice = null;
@@ -2514,7 +2515,7 @@ module.exports = (() => {
2514
2515
  * @public
2515
2516
  */
2516
2517
  refresh() {
2517
- calculateStaticData(this, this._rates);
2518
+ calculateStaticData(this, this._rates, this._definition);
2518
2519
  calculatePriceData(this, this._rates, null, true);
2519
2520
  }
2520
2521
 
@@ -2560,9 +2561,6 @@ module.exports = (() => {
2560
2561
  if (this._single) {
2561
2562
  const precision = sender.position.instrument.currency.precision;
2562
2563
 
2563
- this._dataActual.invalid = this._definition.type === PositionLevelType.POSITION && item.invalid;
2564
- this._dataFormat.invalid = this._dataActual.invalid;
2565
-
2566
2564
  this._dataActual.currentPrice = quote.lastPrice;
2567
2565
  this._dataFormat.currentPrice = formatNumber(this._dataActual.currentPrice, precision);
2568
2566
 
@@ -2719,7 +2717,7 @@ module.exports = (() => {
2719
2717
  return formatDecimal(decimal, currency.precision);
2720
2718
  }
2721
2719
 
2722
- function calculateStaticData(group, rates) {
2720
+ function calculateStaticData(group, rates, definition) {
2723
2721
  const actual = group._dataActual;
2724
2722
  const format = group._dataFormat;
2725
2723
 
@@ -2796,6 +2794,8 @@ module.exports = (() => {
2796
2794
 
2797
2795
  format.quantity = formatDecimal(actual.quantity, 2);
2798
2796
  format.basisPrice = formatCurrency(actual.basisPrice, currency);
2797
+
2798
+ format.invalid = definition.type === PositionLevelType.POSITION && item.invalid;
2799
2799
  }
2800
2800
 
2801
2801
  const groupItems = group._items;