@barchart/portfolio-api-common 1.0.55 → 1.0.59

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.
@@ -77,7 +77,8 @@ module.exports = (() => {
77
77
  const currentDefinition = definitions[0];
78
78
  const additionalDefinitions = array.dropLeft(definitions);
79
79
 
80
- const populatedGroups = array.batchBy(items, currentDefinition.keySelector).map((items) => {
80
+ const populatedObjects = array.groupBy(items, currentDefinition.keySelector);
81
+ const populatedGroups = Object.keys(populatedObjects).map(key => populatedObjects[key]).map((items) => {
81
82
  const first = items[0];
82
83
 
83
84
  return new PositionGroup(items, currentDefinition.currencySelector(first), currentDefinition.descriptionSelector(first), currentDefinition.single && items.length === 1);
@@ -137,13 +138,13 @@ module.exports = (() => {
137
138
 
138
139
  setPrice(symbol, price) {
139
140
  if (this._symbols.hasOwnProperty(symbol)) {
140
- this._symbols.forEach(item.setPrice(price));
141
+ this._symbols[symbol].forEach(item => item.setPrice(price));
141
142
  }
142
143
  }
143
144
 
144
145
  getGroup(keys) {
145
146
  const node = keys.reduce((tree, key) => {
146
- tree = tree.findChild((group) => group.description === key);
147
+ tree = tree.findChild(group => group.description === key);
147
148
 
148
149
  return tree;
149
150
  }, this._tree);
@@ -153,7 +154,7 @@ module.exports = (() => {
153
154
 
154
155
  getGroups(keys) {
155
156
  const node = keys.reduce((tree, key) => {
156
- tree = tree.findChild((group) => group.description === key);
157
+ tree = tree.findChild(group => group.description === key);
157
158
 
158
159
  return tree;
159
160
  }, this._tree);
@@ -99,7 +99,7 @@ module.exports = (() => {
99
99
  const position = item.position;
100
100
  const snapshot = item.position.snapshot;
101
101
 
102
- updates.value = updates.basis.add(snapshot.basis);
102
+ updates.basis = updates.basis.add(snapshot.basis);
103
103
 
104
104
  return updates;
105
105
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.55",
3
+ "version": "1.0.59",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -592,7 +592,8 @@ module.exports = (() => {
592
592
  const currentDefinition = definitions[0];
593
593
  const additionalDefinitions = array.dropLeft(definitions);
594
594
 
595
- const populatedGroups = array.batchBy(items, currentDefinition.keySelector).map((items) => {
595
+ const populatedObjects = array.groupBy(items, currentDefinition.keySelector);
596
+ const populatedGroups = Object.keys(populatedObjects).map(key => populatedObjects[key]).map((items) => {
596
597
  const first = items[0];
597
598
 
598
599
  return new PositionGroup(items, currentDefinition.currencySelector(first), currentDefinition.descriptionSelector(first), currentDefinition.single && items.length === 1);
@@ -652,13 +653,13 @@ module.exports = (() => {
652
653
 
653
654
  setPrice(symbol, price) {
654
655
  if (this._symbols.hasOwnProperty(symbol)) {
655
- this._symbols.forEach(item.setPrice(price));
656
+ this._symbols[symbol].forEach(item => item.setPrice(price));
656
657
  }
657
658
  }
658
659
 
659
660
  getGroup(keys) {
660
661
  const node = keys.reduce((tree, key) => {
661
- tree = tree.findChild((group) => group.description === key);
662
+ tree = tree.findChild(group => group.description === key);
662
663
 
663
664
  return tree;
664
665
  }, this._tree);
@@ -668,7 +669,7 @@ module.exports = (() => {
668
669
 
669
670
  getGroups(keys) {
670
671
  const node = keys.reduce((tree, key) => {
671
- tree = tree.findChild((group) => group.description === key);
672
+ tree = tree.findChild(group => group.description === key);
672
673
 
673
674
  return tree;
674
675
  }, this._tree);
@@ -786,7 +787,7 @@ module.exports = (() => {
786
787
  const position = item.position;
787
788
  const snapshot = item.position.snapshot;
788
789
 
789
- updates.value = updates.basis.add(snapshot.basis);
790
+ updates.basis = updates.basis.add(snapshot.basis);
790
791
 
791
792
  return updates;
792
793
  }, {