@barchart/portfolio-api-common 2.0.0 → 2.1.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.
@@ -35,6 +35,8 @@ module.exports = (() => {
35
35
  Currency.EUR,
36
36
  Currency.HKD,
37
37
  Currency.JPY,
38
+ Currency.NOK,
39
+ Currency.SEK,
38
40
  Currency.USD
39
41
  ];
40
42
 
@@ -452,9 +454,21 @@ module.exports = (() => {
452
454
  assert.argumentIsRequired(position, 'position', Object);
453
455
  assert.argumentIsRequired(position.position, 'position.position', String);
454
456
 
455
- removePositionItem.call(this, this._items.find(item => item.position.position === position.position));
457
+ const positionItemToRemove = this._items.find(item => item.position.position === position.position);
458
+ const positionToRemove = positionItemToRemove ? positionItemToRemove.position || null : null;
459
+
460
+ removePositionItem.call(this, positionItemToRemove);
456
461
 
457
462
  recalculatePercentages.call(this);
463
+
464
+ if (positionToRemove) {
465
+ const existingBarchartSymbols = this.getPositionSymbols(false, false);
466
+ const removedBarchartSymbol = extractSymbolForBarchart(positionToRemove);
467
+
468
+ if (removedBarchartSymbol !== null && !existingBarchartSymbols.some(existingBarchartSymbol => existingBarchartSymbol === removedBarchartSymbol)) {
469
+ this._positionSymbolRemovedEvent.fire(removedBarchartSymbol);
470
+ }
471
+ }
458
472
  }
459
473
 
460
474
  /**
@@ -540,7 +540,6 @@ module.exports = (() => {
540
540
  this._dataFormat.quoteLow = formatFraction(this._dataActual.quoteLow, currency, instrument, this._useBarchartPriceFormattingRules);
541
541
 
542
542
  this._dataFormat.quoteChange = formatFraction(this._dataActual.quoteChange, currency, instrument, this._useBarchartPriceFormattingRules);
543
-
544
543
  }
545
544
  }
546
545
  }
@@ -224,7 +224,7 @@ module.exports = (() => {
224
224
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
225
225
  .withField('instrument.name', DataType.STRING, true)
226
226
  .withField('instrument.exchange', DataType.STRING, true)
227
- .withField('instrument.code', DataType.NUMBER, true)
227
+ .withField('instrument.code', DataType.NUMBER, true) // Not intended to be the unit code. Same value as [profile] table [type] column. See `InstrumentType.fromSymbolType` function.
228
228
  .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
229
229
  .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
230
230
  .withField('instrument.symbol.barchart', DataType.STRING, true)
@@ -274,7 +274,7 @@ module.exports = (() => {
274
274
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
275
275
  .withField('instrument.name', DataType.STRING, true)
276
276
  .withField('instrument.exchange', DataType.STRING, true)
277
- .withField('instrument.code', DataType.NUMBER, true)
277
+ .withField('instrument.code', DataType.NUMBER, true) // Not intended to be the unit code. Same value as [profile] table [type] column. See `InstrumentType.fromSymbolType` function.
278
278
  .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
279
279
  .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
280
280
  .withField('instrument.symbol.barchart', DataType.STRING, true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "2.0.0",
3
+ "version": "2.1.1",
4
4
  "description": "Common JavaScript code used by Barchart's Portfolio Service",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -15,7 +15,7 @@
15
15
  "url": "git+ssh://git@github.com/barchart/portfolio-api-common.git"
16
16
  },
17
17
  "dependencies": {
18
- "@barchart/common-js": "^4.46.1",
18
+ "@barchart/common-js": "^4.51.0",
19
19
  "@barchart/marketdata-api-js": "^6.2.1",
20
20
  "uuid": "9.0.1"
21
21
  },