@barchart/portfolio-api-common 1.0.244 → 1.0.245

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.
@@ -564,6 +564,20 @@ module.exports = (() => {
564
564
  });
565
565
  }
566
566
 
567
+ /**
568
+ * Returns a single position for a portfolio.
569
+ *
570
+ * @public
571
+ * @param {String} portfolio
572
+ * @param {String} position
573
+ * @return {Object|null}
574
+ */
575
+ getPosition(portfolio, position) {
576
+ assert.argumentIsRequired(position, 'position', String);
577
+
578
+ return this.getPositions(portfolio).find(p => p.position === position) || null;
579
+ }
580
+
567
581
  /**
568
582
  * Pauses aggregation calculations during the processing of an action.
569
583
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.244",
3
+ "version": "1.0.245",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1363,6 +1363,20 @@ module.exports = (() => {
1363
1363
  });
1364
1364
  }
1365
1365
 
1366
+ /**
1367
+ * Returns a single position for a portfolio.
1368
+ *
1369
+ * @public
1370
+ * @param {String} portfolio
1371
+ * @param {String} position
1372
+ * @return {Object|null}
1373
+ */
1374
+ getPosition(portfolio, position) {
1375
+ assert.argumentIsRequired(position, 'position', String);
1376
+
1377
+ return this.getPositions(portfolio).find(p => p.position === position) || null;
1378
+ }
1379
+
1366
1380
  /**
1367
1381
  * Pauses aggregation calculations during the processing of an action.
1368
1382
  *