@barchart/portfolio-api-common 2.1.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.
@@ -454,9 +454,21 @@ module.exports = (() => {
454
454
  assert.argumentIsRequired(position, 'position', Object);
455
455
  assert.argumentIsRequired(position.position, 'position.position', String);
456
456
 
457
- 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);
458
461
 
459
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
+ }
460
472
  }
461
473
 
462
474
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "2.1.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",