@barchart/portfolio-api-common 1.2.2 → 1.2.3

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.
@@ -458,6 +458,9 @@ module.exports = (() => {
458
458
  if (this._single) {
459
459
  const precision = sender.position.instrument.currency.precision;
460
460
 
461
+ this._dataActual.invalid = this._definition.type === PositionLevelType.POSITION && item.invalid;
462
+ this._dataFormat.invalid = this._dataActual.invalid;
463
+
461
464
  this._dataActual.currentPrice = quote.lastPrice;
462
465
  this._dataFormat.currentPrice = formatNumber(this._dataActual.currentPrice, precision);
463
466
 
@@ -27,7 +27,11 @@ module.exports = (() => {
27
27
 
28
28
  this._portfolio = portfolio;
29
29
  this._position = position;
30
- this._currency = position.instrument.currency || Currency.CAD;
30
+
31
+ const instrument = position.instrument;
32
+
33
+ this._currency = instrument.currency || Currency.CAD;
34
+ this._invalid = instrument.type.usesSymbols && (!is.object(instrument.symbol) || !is.string(instrument.symbol.barchart));
31
35
 
32
36
  this._currentSummary = currentSummary || null;
33
37
  this._previousSummaries = previousSummaries || [ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -2560,6 +2560,9 @@ module.exports = (() => {
2560
2560
  if (this._single) {
2561
2561
  const precision = sender.position.instrument.currency.precision;
2562
2562
 
2563
+ this._dataActual.invalid = this._definition.type === PositionLevelType.POSITION && item.invalid;
2564
+ this._dataFormat.invalid = this._dataActual.invalid;
2565
+
2563
2566
  this._dataActual.currentPrice = quote.lastPrice;
2564
2567
  this._dataFormat.currentPrice = formatNumber(this._dataActual.currentPrice, precision);
2565
2568
 
@@ -2988,7 +2991,11 @@ module.exports = (() => {
2988
2991
 
2989
2992
  this._portfolio = portfolio;
2990
2993
  this._position = position;
2991
- this._currency = position.instrument.currency || Currency.CAD;
2994
+
2995
+ const instrument = position.instrument;
2996
+
2997
+ this._currency = instrument.currency || Currency.CAD;
2998
+ this._invalid = instrument.type.usesSymbols && (!is.object(instrument.symbol) || !is.string(instrument.symbol.barchart));
2992
2999
 
2993
3000
  this._currentSummary = currentSummary || null;
2994
3001
  this._previousSummaries = previousSummaries || [ ];