@barchart/portfolio-api-common 1.3.4 → 1.3.8

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.
@@ -296,8 +296,8 @@ module.exports = (() => {
296
296
  const transactionCreateFailedOutOfSequence = new FailureType('TRANSACTION_CREATE_FAILED_OUT_OF_SEQUENCE', 'Unable to process transaction, because the transaction date is out-of-sequence. In other words, it would occur before an existing transaction. Please confirm your intent to re-write transaction history (which could take some time and alter the historical results for this position).');
297
297
  const transactionCreateFailedInvalidDate = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_DATE', 'Unable to process transaction with given date.');
298
298
  const transactionCreateFailedTypeInvalidForInstrument = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_INVALID_FOR_INSTRUMENT', 'Unable to process transaction, {L|transactionType.description} transactions cannot be used with {L|instrumentType.description} positions.');
299
- const transactionCreateFailedTypeInvalidForDirection = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_INVALID_FOR_DIRECTION', 'Unable to process transaction, a {L|positionDirection.description} position would be created (i.e. you would have {L|positionDirection.sign} shares/units). {u|instrumentType.description} positions cannot have {L|positionDirection.description} positions.');
300
- const transactionCreateFailedInvalidDirectionSwitch = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_DIRECTION_SWITCH', 'Unable to process transaction, the transaction would switch the position from {L|currentDirection.description} to {L|proposedDirection.description} (i.e. {L|currentDirection.sign} to {L|proposedDirection.sign} shares/units). This is not allowed. Please close the current position (i.e. zero it out) and then enter a second transaction.');
299
+ const transactionCreateFailedTypeInvalidForDirection = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_INVALID_FOR_DIRECTION', 'Unable to process transaction, a {L|positionDirection.description} position would be created (i.e. you would have {L|positionDirection.sign} shares/units). {u|instrumentType.description} positions cannot have {L|positionDirection.description} positions.', false);
300
+ const transactionCreateFailedInvalidDirectionSwitch = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_DIRECTION_SWITCH', 'Unable to process transaction, the transaction would switch the position from {L|currentDirection.description} to {L|proposedDirection.description} (i.e. {L|currentDirection.sign} to {L|proposedDirection.sign} shares/units). This is not allowed. Please close the current position (i.e. zero it out) and then enter a second transaction.', false);
301
301
  const transactionCreateFailedInvalidInitialType = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_INITIAL_TYPE', 'Unable to process operation because the first transaction would to be a {U|transactionType.description}, which is not allowed -- since {U|transactionType.description} transactions cannot open a position.');
302
302
 
303
303
  const transactionCreateFailedTypeReserved = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_RESERVED', 'Unable to create {U|type.description} transaction, this type of transaction is managed by the system.');
@@ -307,7 +307,7 @@ module.exports = (() => {
307
307
 
308
308
  const transactionDeleteFailedOutOfSequence = new FailureType('TRANSACTION_DELETE_FAILED_OUT_OF_SEQUENCE', 'Deleting any transaction, except for the most recent, will cause transaction history to be re-written. Please confirm your intent to re-write transaction history (which could take some time and alter the historical results for this position).');
309
309
  const transactionDeleteFailedNoTransaction = new FailureType('TRANSACTION_DELETE_FAILED_NO_TRANSACTION', 'Unable to delete transaction. The referenced transaction does not exist.');
310
- const transactionDeleteFailedDirectionSwitchOnRewrite = new FailureType('TRANSACTION_DELETE_FAILED_DIRECTION_SWITCH_ON_REWRITE', 'Deleting this transaction would cause your history to be re-written and the position to switch from long to short (i.e. positive to negative) or vice versa.');
310
+ const transactionDeleteFailedDirectionSwitchOnRewrite = new FailureType('TRANSACTION_DELETE_FAILED_DIRECTION_SWITCH_ON_REWRITE', 'Deleting this transaction would cause your history to be re-written and the position to switch from long to short (i.e. positive to negative) or vice versa.', false);
311
311
  const transactionDeleteFailedPositionLocked = new FailureType('TRANSACTION_DELETE_FAILED_POSITION_LOCKED', 'Unable to delete transaction, your {L|description} history is being recalculated. Please wait a minute or two and retry.');
312
312
  const transactionDeleteFailedTypeReserved = new FailureType('TRANSACTION_DELETE_FAILED_TYPE_RESERVED', 'Unable to delete {U|type.description} transaction, this type of transaction is managed by the system.');
313
313
 
@@ -236,7 +236,7 @@ module.exports = (() => {
236
236
  *
237
237
  * @public
238
238
  * @static
239
- * @param code
239
+ * @param {Number} code
240
240
  * @returns {InstrumentType}
241
241
  */
242
242
  static fromSymbolType(code) {
@@ -23,8 +23,7 @@ module.exports = (() => {
23
23
  }
24
24
 
25
25
  /**
26
- * Maps transaction objects into new objects whose properties are human-readable (or
27
- * mutates the original objects, adding a "formatted" property to each transaction).
26
+ * Maps transaction objects into new objects whose properties are human-readable.
28
27
  *
29
28
  * @public
30
29
  * @static
@@ -41,8 +41,8 @@ module.exports = (() => {
41
41
  * @public
42
42
  * @param {PositionTreeDefinition[]} definitions
43
43
  * @param {Object[]} portfolios - The portfolios.
44
- * @param {Object[]} positions - The positions (for all of the portfolios).
45
- * @param {Object[]} summaries - The positions summaries (for all of the positions).
44
+ * @param {Object[]} positions - The positions (for all of portfolios).
45
+ * @param {Object[]} summaries - The positions summaries (for all of positions).
46
46
  * @param {PositionSummaryFrame=} reportFrame - If specified, locks the current (and previous) periods to a specific frame, use for reporting.
47
47
  * @param {Day=} reportDate - The end date for the report frame.
48
48
  */
@@ -933,7 +933,6 @@ module.exports = (() => {
933
933
  });
934
934
  }
935
935
 
936
-
937
936
  function updateEmptyPortfolioGroups(portfolio) {
938
937
  Object.keys(this._trees).forEach((key) => {
939
938
  this._trees[key].walk((group) => {
@@ -74,7 +74,7 @@ module.exports = (() => {
74
74
  }
75
75
 
76
76
  /**
77
- * A function, when given a {@link PositionItem} returns a string that is used
77
+ * A function, when given a {@link PositionItem}, returns a string that is used
78
78
  * to group {@link PositionItem} instances into different groups.
79
79
  *
80
80
  * @public
@@ -85,7 +85,7 @@ module.exports = (() => {
85
85
  }
86
86
 
87
87
  /**
88
- * A function, when given a {@link PositionItem} returns a string used to describe the
88
+ * A function, when given a {@link PositionItem}, returns a string used to describe the
89
89
  * group.
90
90
  *
91
91
  * @public
@@ -96,7 +96,7 @@ module.exports = (() => {
96
96
  }
97
97
 
98
98
  /**
99
- * A function, when given a {@link PositionItem} returns the {@link Currency} used to
99
+ * A function, when given a {@link PositionItem}, returns the {@link Currency} used to
100
100
  * display values for the group.
101
101
  *
102
102
  * @public
@@ -111,7 +111,7 @@ module.exports = (() => {
111
111
  * groups.
112
112
  *
113
113
  * @public
114
- * @returns {Array<String>}
114
+ * @returns {String[]}
115
115
  */
116
116
  get requiredGroups() {
117
117
  return this._requiredGroups;
@@ -160,13 +160,16 @@ module.exports = (() => {
160
160
  * @public
161
161
  * @static
162
162
  * @param {Object} portfolio
163
+ * @param {Currency=} currency
163
164
  * @returns {PositionLevelDefinition~RequiredGroup}
164
165
  */
165
- static buildRequiredGroupForPortfolio(portfolio) {
166
+ static buildRequiredGroupForPortfolio(portfolio, currency) {
167
+ assert.argumentIsOptional(currency, 'currency', Currency, 'Currency');
168
+
166
169
  return {
167
170
  key: PositionLevelDefinition.getKeyForPortfolioGroup(portfolio),
168
171
  description: PositionLevelDefinition.getDescriptionForPortfolioGroup(portfolio),
169
- currency: Currency.CAD
172
+ currency: (currency || Currency.CAD)
170
173
  };
171
174
  }
172
175
 
@@ -182,12 +185,12 @@ module.exports = (() => {
182
185
  return portfolio.name;
183
186
  }
184
187
 
185
- static getRequiredGroupGeneratorForPortfolio() {
188
+ static getRequiredGroupGeneratorForPortfolio(currency) {
186
189
  return (portfolio) => {
187
190
  let requiredGroup;
188
191
 
189
192
  if (is.object(portfolio) && is.string(portfolio.portfolio) && is.string(portfolio.name)) {
190
- requiredGroup = PositionLevelDefinition.buildRequiredGroupForPortfolio(portfolio);
193
+ requiredGroup = PositionLevelDefinition.buildRequiredGroupForPortfolio(portfolio, currency);
191
194
  } else {
192
195
  requiredGroup = null;
193
196
  }
@@ -203,12 +206,13 @@ module.exports = (() => {
203
206
  * @static
204
207
  * @param {InstrumentType} type
205
208
  * @param {Currency} currency
209
+ * @param {Currency=} defaultCurrency
206
210
  * @returns {PositionLevelDefinition~RequiredGroup}
207
211
  */
208
- static buildRequiredGroupForAssetClass(type, currency) {
212
+ static buildRequiredGroupForAssetClass(type, currency, defaultCurrency) {
209
213
  return {
210
214
  key: PositionLevelDefinition.getKeyForAssetClassGroup(type, currency),
211
- description: PositionLevelDefinition.getDescriptionForAssetClassGroup(type, currency),
215
+ description: PositionLevelDefinition.getDescriptionForAssetClassGroup(type, currency, defaultCurrency),
212
216
  currency: currency
213
217
  };
214
218
  }
@@ -220,11 +224,12 @@ module.exports = (() => {
220
224
  return `${type.code}|${currency.code}`;
221
225
  }
222
226
 
223
- static getDescriptionForAssetClassGroup(type, currency) {
227
+ static getDescriptionForAssetClassGroup(type, currency, defaultCurrency) {
224
228
  assert.argumentIsRequired(type, 'type', InstrumentType, 'InstrumentType');
225
229
  assert.argumentIsRequired(currency, 'currency', Currency, 'Currency');
230
+ assert.argumentIsOptional(defaultCurrency, 'defaultCurrency', Currency, 'Currency');
226
231
 
227
- return `${type.alternateDescription}${currency.code === 'CAD' ? '' : ` (${currency.alternateDescription})`}`;
232
+ return `${type.alternateDescription}${currency === (defaultCurrency || Currency.CAD) ? '' : ` (${currency.alternateDescription})`}`;
228
233
  }
229
234
 
230
235
  toString() {
@@ -3,19 +3,49 @@ const Enum = require('@barchart/common-js/lang/Enum');
3
3
  module.exports = (() => {
4
4
  'use strict';
5
5
 
6
+ /**
7
+ * Describes the contents of a grouping level within a tree of positions.
8
+ * This is an attribute of a {@link PositionLevelDefinition}.
9
+ *
10
+ * @public
11
+ * @extends {Enum}
12
+ */
6
13
  class PositionLevelType extends Enum {
7
14
  constructor(code) {
8
15
  super(code, code);
9
16
  }
10
17
 
18
+ /**
19
+ * A level of grouping that represents an entire portfolio's contents.
20
+ *
21
+ * @public
22
+ * @static
23
+ * @returns {PositionLevelType}
24
+ */
11
25
  static get PORTFOLIO() {
12
26
  return portfolio;
13
27
  }
14
28
 
29
+ /**
30
+ * A level of grouping that represents a single positions (i.e. guaranteed to
31
+ * be a leaf node in a grouping tree).
32
+ *
33
+ * @public
34
+ * @static
35
+ * @return {PositionLevelType}
36
+ */
15
37
  static get POSITION() {
16
38
  return position;
17
39
  }
18
40
 
41
+ /**
42
+ * A level of grouping that is neither a portfolio or a position. This could be an
43
+ * intermediate level of grouping (e.g. an asset class within a portfolio).
44
+ *
45
+ * @public
46
+ * @static
47
+ * @return {PositionLevelType}
48
+ */
19
49
  static get OTHER() {
20
50
  return other;
21
51
  }
@@ -11,7 +11,7 @@ module.exports = (() => {
11
11
  * @public
12
12
  * @param {String} name
13
13
  * @param {PositionLevelDefinition[]} definitions
14
- * @oaram {String[]=} exclusionDependencies
14
+ * @param {String[]=} exclusionDependencies
15
15
  */
16
16
  class PositionTreeDefinitions {
17
17
  constructor(name, definitions, exclusionDependencies) {
@@ -44,7 +44,7 @@ module.exports = (() => {
44
44
  * bottom-most level of the tree (i.e. leaf nodes).
45
45
  *
46
46
  * @public
47
- * @returns {PositionLevelDefinitions>[]}
47
+ * @returns {PositionLevelDefinitions[]}
48
48
  */
49
49
  get definitions() {
50
50
  return this._definitions;
@@ -0,0 +1,123 @@
1
+ const assert = require('@barchart/common-js/lang/assert'),
2
+ Enum = require('@barchart/common-js/lang/Enum');
3
+
4
+ module.exports = (() => {
5
+ 'use strict';
6
+
7
+ /**
8
+ * Types of websocket response actions.
9
+ *
10
+ * @public
11
+ * @extends {Enum}
12
+ * @param {String} code
13
+ * @param {String} description
14
+ * @param {String} action
15
+ */
16
+ class WebsocketActionType extends Enum {
17
+ constructor(code, description, action) {
18
+ super(code, description);
19
+
20
+ assert.argumentIsRequired(action, 'action', String);
21
+
22
+ this._action = action;
23
+ }
24
+
25
+ /**
26
+ * An action of websocket response
27
+ *
28
+ * @public
29
+ * @returns {String}
30
+ */
31
+ get action() {
32
+ return this._action;
33
+ }
34
+
35
+ /**
36
+ * Action type for creating new portfolio.
37
+ *
38
+ * @public
39
+ * @static
40
+ * @returns {WebsocketActionType}
41
+ */
42
+ static get PORTFOLIO_CREATE() {
43
+ return portfolioCreate;
44
+ }
45
+
46
+ /**
47
+ * Action type for deleting portfolio.
48
+ *
49
+ * @public
50
+ * @static
51
+ * @returns {WebsocketActionType}
52
+ */
53
+ static get PORTFOLIO_DELETE() {
54
+ return portfolioDelete;
55
+ }
56
+
57
+ /**
58
+ * Action type for updating new portfolio.
59
+ *
60
+ * @public
61
+ * @static
62
+ * @returns {WebsocketActionType}
63
+ */
64
+ static get PORTFOLIO_UPDATE() {
65
+ return portfolioUpdate;
66
+ }
67
+
68
+ /**
69
+ * Action type for creating new transaction.
70
+ *
71
+ * @public
72
+ * @static
73
+ * @returns {WebsocketActionType}
74
+ */
75
+ static get TRANSACTION_CREATE() {
76
+ return transactionCreate;
77
+ }
78
+
79
+ /**
80
+ * Action type for deleting transaction.
81
+ *
82
+ * @public
83
+ * @static
84
+ * @returns {WebsocketActionType}
85
+ */
86
+ static get TRANSACTION_DELETE() {
87
+ return transactionDelete;
88
+ }
89
+
90
+ /**
91
+ * Action type for editing transaction.
92
+ *
93
+ * @public
94
+ * @static
95
+ * @returns {WebsocketActionType}
96
+ */
97
+ static get TRANSACTION_EDIT() {
98
+ return transactionEdit;
99
+ }
100
+
101
+ /**
102
+ * Action type for batching transaction.
103
+ *
104
+ * @public
105
+ * @static
106
+ * @returns {WebsocketActionType}
107
+ */
108
+ static get TRANSACTION_BATCH() {
109
+ return transactionBatch;
110
+ }
111
+ }
112
+
113
+ const portfolioCreate = new WebsocketActionType('PORTFOLIO_CREATE', 'Create portfolio action', 'portfolio/create');
114
+ const portfolioDelete = new WebsocketActionType('PORTFOLIO_DELETE', 'Delete portfolio action', 'portfolio/delete');
115
+ const portfolioUpdate = new WebsocketActionType('PORTFOLIO_UPDATE', 'Update portfolio action', 'portfolio/update');
116
+
117
+ const transactionCreate = new WebsocketActionType('TRANSACTION_CREATE', 'Create transaction action', 'transaction/create');
118
+ const transactionDelete = new WebsocketActionType('TRANSACTION_DELETE', 'Delete transaction action', 'transaction/delete');
119
+ const transactionEdit = new WebsocketActionType('TRANSACTION_EDIT', 'Edit transaction action', 'transaction/edit');
120
+ const transactionBatch = new WebsocketActionType('TRANSACTION_BATCH', 'Batch transaction action', 'transaction/batch');
121
+
122
+ return WebsocketActionType;
123
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.3.4",
3
+ "version": "1.3.8",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -237,7 +237,7 @@ module.exports = (() => {
237
237
  *
238
238
  * @public
239
239
  * @static
240
- * @param code
240
+ * @param {Number} code
241
241
  * @returns {InstrumentType}
242
242
  */
243
243
  static fromSymbolType(code) {
@@ -1527,8 +1527,8 @@ module.exports = (() => {
1527
1527
  * @public
1528
1528
  * @param {PositionTreeDefinition[]} definitions
1529
1529
  * @param {Object[]} portfolios - The portfolios.
1530
- * @param {Object[]} positions - The positions (for all of the portfolios).
1531
- * @param {Object[]} summaries - The positions summaries (for all of the positions).
1530
+ * @param {Object[]} positions - The positions (for all of portfolios).
1531
+ * @param {Object[]} summaries - The positions summaries (for all of positions).
1532
1532
  * @param {PositionSummaryFrame=} reportFrame - If specified, locks the current (and previous) periods to a specific frame, use for reporting.
1533
1533
  * @param {Day=} reportDate - The end date for the report frame.
1534
1534
  */
@@ -2419,7 +2419,6 @@ module.exports = (() => {
2419
2419
  });
2420
2420
  }
2421
2421
 
2422
-
2423
2422
  function updateEmptyPortfolioGroups(portfolio) {
2424
2423
  Object.keys(this._trees).forEach((key) => {
2425
2424
  this._trees[key].walk((group) => {
@@ -4400,7 +4399,7 @@ module.exports = (() => {
4400
4399
  }
4401
4400
 
4402
4401
  /**
4403
- * A function, when given a {@link PositionItem} returns a string that is used
4402
+ * A function, when given a {@link PositionItem}, returns a string that is used
4404
4403
  * to group {@link PositionItem} instances into different groups.
4405
4404
  *
4406
4405
  * @public
@@ -4411,7 +4410,7 @@ module.exports = (() => {
4411
4410
  }
4412
4411
 
4413
4412
  /**
4414
- * A function, when given a {@link PositionItem} returns a string used to describe the
4413
+ * A function, when given a {@link PositionItem}, returns a string used to describe the
4415
4414
  * group.
4416
4415
  *
4417
4416
  * @public
@@ -4422,7 +4421,7 @@ module.exports = (() => {
4422
4421
  }
4423
4422
 
4424
4423
  /**
4425
- * A function, when given a {@link PositionItem} returns the {@link Currency} used to
4424
+ * A function, when given a {@link PositionItem}, returns the {@link Currency} used to
4426
4425
  * display values for the group.
4427
4426
  *
4428
4427
  * @public
@@ -4437,7 +4436,7 @@ module.exports = (() => {
4437
4436
  * groups.
4438
4437
  *
4439
4438
  * @public
4440
- * @returns {Array<String>}
4439
+ * @returns {String[]}
4441
4440
  */
4442
4441
  get requiredGroups() {
4443
4442
  return this._requiredGroups;
@@ -4486,13 +4485,16 @@ module.exports = (() => {
4486
4485
  * @public
4487
4486
  * @static
4488
4487
  * @param {Object} portfolio
4488
+ * @param {Currency=} currency
4489
4489
  * @returns {PositionLevelDefinition~RequiredGroup}
4490
4490
  */
4491
- static buildRequiredGroupForPortfolio(portfolio) {
4491
+ static buildRequiredGroupForPortfolio(portfolio, currency) {
4492
+ assert.argumentIsOptional(currency, 'currency', Currency, 'Currency');
4493
+
4492
4494
  return {
4493
4495
  key: PositionLevelDefinition.getKeyForPortfolioGroup(portfolio),
4494
4496
  description: PositionLevelDefinition.getDescriptionForPortfolioGroup(portfolio),
4495
- currency: Currency.CAD
4497
+ currency: (currency || Currency.CAD)
4496
4498
  };
4497
4499
  }
4498
4500
 
@@ -4508,12 +4510,12 @@ module.exports = (() => {
4508
4510
  return portfolio.name;
4509
4511
  }
4510
4512
 
4511
- static getRequiredGroupGeneratorForPortfolio() {
4513
+ static getRequiredGroupGeneratorForPortfolio(currency) {
4512
4514
  return (portfolio) => {
4513
4515
  let requiredGroup;
4514
4516
 
4515
4517
  if (is.object(portfolio) && is.string(portfolio.portfolio) && is.string(portfolio.name)) {
4516
- requiredGroup = PositionLevelDefinition.buildRequiredGroupForPortfolio(portfolio);
4518
+ requiredGroup = PositionLevelDefinition.buildRequiredGroupForPortfolio(portfolio, currency);
4517
4519
  } else {
4518
4520
  requiredGroup = null;
4519
4521
  }
@@ -4529,12 +4531,13 @@ module.exports = (() => {
4529
4531
  * @static
4530
4532
  * @param {InstrumentType} type
4531
4533
  * @param {Currency} currency
4534
+ * @param {Currency=} defaultCurrency
4532
4535
  * @returns {PositionLevelDefinition~RequiredGroup}
4533
4536
  */
4534
- static buildRequiredGroupForAssetClass(type, currency) {
4537
+ static buildRequiredGroupForAssetClass(type, currency, defaultCurrency) {
4535
4538
  return {
4536
4539
  key: PositionLevelDefinition.getKeyForAssetClassGroup(type, currency),
4537
- description: PositionLevelDefinition.getDescriptionForAssetClassGroup(type, currency),
4540
+ description: PositionLevelDefinition.getDescriptionForAssetClassGroup(type, currency, defaultCurrency),
4538
4541
  currency: currency
4539
4542
  };
4540
4543
  }
@@ -4546,11 +4549,12 @@ module.exports = (() => {
4546
4549
  return `${type.code}|${currency.code}`;
4547
4550
  }
4548
4551
 
4549
- static getDescriptionForAssetClassGroup(type, currency) {
4552
+ static getDescriptionForAssetClassGroup(type, currency, defaultCurrency) {
4550
4553
  assert.argumentIsRequired(type, 'type', InstrumentType, 'InstrumentType');
4551
4554
  assert.argumentIsRequired(currency, 'currency', Currency, 'Currency');
4555
+ assert.argumentIsOptional(defaultCurrency, 'defaultCurrency', Currency, 'Currency');
4552
4556
 
4553
- return `${type.alternateDescription}${currency.code === 'CAD' ? '' : ` (${currency.alternateDescription})`}`;
4557
+ return `${type.alternateDescription}${currency === (defaultCurrency || Currency.CAD) ? '' : ` (${currency.alternateDescription})`}`;
4554
4558
  }
4555
4559
 
4556
4560
  toString() {
@@ -4608,19 +4612,49 @@ const Enum = require('@barchart/common-js/lang/Enum');
4608
4612
  module.exports = (() => {
4609
4613
  'use strict';
4610
4614
 
4615
+ /**
4616
+ * Describes the contents of a grouping level within a tree of positions.
4617
+ * This is an attribute of a {@link PositionLevelDefinition}.
4618
+ *
4619
+ * @public
4620
+ * @extends {Enum}
4621
+ */
4611
4622
  class PositionLevelType extends Enum {
4612
4623
  constructor(code) {
4613
4624
  super(code, code);
4614
4625
  }
4615
4626
 
4627
+ /**
4628
+ * A level of grouping that represents an entire portfolio's contents.
4629
+ *
4630
+ * @public
4631
+ * @static
4632
+ * @returns {PositionLevelType}
4633
+ */
4616
4634
  static get PORTFOLIO() {
4617
4635
  return portfolio;
4618
4636
  }
4619
4637
 
4638
+ /**
4639
+ * A level of grouping that represents a single positions (i.e. guaranteed to
4640
+ * be a leaf node in a grouping tree).
4641
+ *
4642
+ * @public
4643
+ * @static
4644
+ * @return {PositionLevelType}
4645
+ */
4620
4646
  static get POSITION() {
4621
4647
  return position;
4622
4648
  }
4623
4649
 
4650
+ /**
4651
+ * A level of grouping that is neither a portfolio or a position. This could be an
4652
+ * intermediate level of grouping (e.g. an asset class within a portfolio).
4653
+ *
4654
+ * @public
4655
+ * @static
4656
+ * @return {PositionLevelType}
4657
+ */
4624
4658
  static get OTHER() {
4625
4659
  return other;
4626
4660
  }
@@ -4647,7 +4681,7 @@ module.exports = (() => {
4647
4681
  * @public
4648
4682
  * @param {String} name
4649
4683
  * @param {PositionLevelDefinition[]} definitions
4650
- * @oaram {String[]=} exclusionDependencies
4684
+ * @param {String[]=} exclusionDependencies
4651
4685
  */
4652
4686
  class PositionTreeDefinitions {
4653
4687
  constructor(name, definitions, exclusionDependencies) {
@@ -4680,7 +4714,7 @@ module.exports = (() => {
4680
4714
  * bottom-most level of the tree (i.e. leaf nodes).
4681
4715
  *
4682
4716
  * @public
4683
- * @returns {PositionLevelDefinitions>[]}
4717
+ * @returns {PositionLevelDefinitions[]}
4684
4718
  */
4685
4719
  get definitions() {
4686
4720
  return this._definitions;