@barchart/portfolio-api-common 1.2.90 → 1.2.91

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,6 +86,19 @@ module.exports = (() => {
86
86
  return this._rangeCalculator(getFilteredTransactions(transactions));
87
87
  }
88
88
 
89
+ /**
90
+ * Returns the range which contains a given date and all subsequent ranges.
91
+ *
92
+ * @public
93
+ * @param {Day} date
94
+ * @return {Array.<PositionSummaryRange>}
95
+ */
96
+ getRangesFromDate(date) {
97
+ const transaction = { date: date, snapshot: { open: Decimal.ONE } };
98
+
99
+ return this.getRanges([ transaction ]);
100
+ }
101
+
89
102
  /**
90
103
  * Returns the start date for a frame, a given number of periods ago.
91
104
  *
@@ -42,7 +42,7 @@ module.exports = (() => {
42
42
  * @param {Array.<Object>} portfolios - The portfolios.
43
43
  * @param {Array.<Object>} positions - The positions (for all of the portfolios).
44
44
  * @param {Array.<Object>} summaries - The positions summaries (for all of the positions).
45
- * @param {PositionSummaryFrame} - If specified, locks the current (and previous) periods to a specific frame, use for reporting.
45
+ * @param {PositionSummaryFrame=} - If specified, locks the current (and previous) periods to a specific frame, use for reporting.
46
46
  */
47
47
  class PositionContainer {
48
48
  constructor(definitions, portfolios, positions, summaries, frame) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.90",
3
+ "version": "1.2.91",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -477,6 +477,19 @@ module.exports = (() => {
477
477
  return this._rangeCalculator(getFilteredTransactions(transactions));
478
478
  }
479
479
 
480
+ /**
481
+ * Returns the range which contains a given date and all subsequent ranges.
482
+ *
483
+ * @public
484
+ * @param {Day} date
485
+ * @return {Array.<PositionSummaryRange>}
486
+ */
487
+ getRangesFromDate(date) {
488
+ const transaction = { date: date, snapshot: { open: Decimal.ONE } };
489
+
490
+ return this.getRanges([ transaction ]);
491
+ }
492
+
480
493
  /**
481
494
  * Returns the start date for a frame, a given number of periods ago.
482
495
  *
@@ -1421,7 +1434,7 @@ module.exports = (() => {
1421
1434
  * @param {Array.<Object>} portfolios - The portfolios.
1422
1435
  * @param {Array.<Object>} positions - The positions (for all of the portfolios).
1423
1436
  * @param {Array.<Object>} summaries - The positions summaries (for all of the positions).
1424
- * @param {PositionSummaryFrame} - If specified, locks the current (and previous) periods to a specific frame, use for reporting.
1437
+ * @param {PositionSummaryFrame=} - If specified, locks the current (and previous) periods to a specific frame, use for reporting.
1425
1438
  */
1426
1439
  class PositionContainer {
1427
1440
  constructor(definitions, portfolios, positions, summaries, frame) {