@barchart/portfolio-api-common 1.0.53 → 1.0.57

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.
@@ -86,7 +86,7 @@ module.exports = (() => {
86
86
  const missingGroups = array.difference(currentDefinition.requiredGroups.map(group => group.description), populatedGroups.map(group => group.description));
87
87
 
88
88
  const empty = missingGroups.map((description) => {
89
- return new PositionGroup([ ], currentDefinition.find(group => group.description === description).currency, description);
89
+ return new PositionGroup([ ], currentDefinition.requiredGroups.find(group => group.description === description).currency, description);
90
90
  });
91
91
 
92
92
  const compositeGroups = populatedGroups.concat(empty);
@@ -95,7 +95,7 @@ module.exports = (() => {
95
95
 
96
96
  if (currentDefinition.requiredGroups.length !== 0) {
97
97
  const ordering = currentDefinition.requiredGroups.reduce((map, group, index) => {
98
- map[group] = index;
98
+ map[group.description] = index;
99
99
 
100
100
  return map;
101
101
  }, { });
@@ -137,13 +137,13 @@ module.exports = (() => {
137
137
 
138
138
  setPrice(symbol, price) {
139
139
  if (this._symbols.hasOwnProperty(symbol)) {
140
- this._symbols.forEach(item.setPrice(price));
140
+ this._symbols[symbol].forEach(item => item.setPrice(price));
141
141
  }
142
142
  }
143
143
 
144
144
  getGroup(keys) {
145
145
  const node = keys.reduce((tree, key) => {
146
- tree = tree.findChild((group) => group.description === key);
146
+ tree = tree.findChild(group => group.description === key);
147
147
 
148
148
  return tree;
149
149
  }, this._tree);
@@ -153,7 +153,7 @@ module.exports = (() => {
153
153
 
154
154
  getGroups(keys) {
155
155
  const node = keys.reduce((tree, key) => {
156
- tree = tree.findChild((group) => group.description === key);
156
+ tree = tree.findChild(group => group.description === key);
157
157
 
158
158
  return tree;
159
159
  }, this._tree);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.53",
3
+ "version": "1.0.57",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -601,7 +601,7 @@ module.exports = (() => {
601
601
  const missingGroups = array.difference(currentDefinition.requiredGroups.map(group => group.description), populatedGroups.map(group => group.description));
602
602
 
603
603
  const empty = missingGroups.map((description) => {
604
- return new PositionGroup([ ], currentDefinition.find(group => group.description === description).currency, description);
604
+ return new PositionGroup([ ], currentDefinition.requiredGroups.find(group => group.description === description).currency, description);
605
605
  });
606
606
 
607
607
  const compositeGroups = populatedGroups.concat(empty);
@@ -610,7 +610,7 @@ module.exports = (() => {
610
610
 
611
611
  if (currentDefinition.requiredGroups.length !== 0) {
612
612
  const ordering = currentDefinition.requiredGroups.reduce((map, group, index) => {
613
- map[group] = index;
613
+ map[group.description] = index;
614
614
 
615
615
  return map;
616
616
  }, { });
@@ -652,13 +652,13 @@ module.exports = (() => {
652
652
 
653
653
  setPrice(symbol, price) {
654
654
  if (this._symbols.hasOwnProperty(symbol)) {
655
- this._symbols.forEach(item.setPrice(price));
655
+ this._symbols[symbol].forEach(item => item.setPrice(price));
656
656
  }
657
657
  }
658
658
 
659
659
  getGroup(keys) {
660
660
  const node = keys.reduce((tree, key) => {
661
- tree = tree.findChild((group) => group.description === key);
661
+ tree = tree.findChild(group => group.description === key);
662
662
 
663
663
  return tree;
664
664
  }, this._tree);
@@ -668,7 +668,7 @@ module.exports = (() => {
668
668
 
669
669
  getGroups(keys) {
670
670
  const node = keys.reduce((tree, key) => {
671
- tree = tree.findChild((group) => group.description === key);
671
+ tree = tree.findChild(group => group.description === key);
672
672
 
673
673
  return tree;
674
674
  }, this._tree);