@barchart/portfolio-api-common 1.2.130 → 1.2.131

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.
@@ -11,9 +11,10 @@ module.exports = (() => {
11
11
  *
12
12
  * @public
13
13
  * @extends {Enum}
14
+ * @param {String} code
14
15
  * @param {String} description
15
16
  * @param {String} alternateDescription
16
- * @param {String} code
17
+ * @param {Boolean} canExistEmpty
17
18
  * @param {Boolean} canReinvest
18
19
  * @param {Boolean} canShort
19
20
  * @param {Boolean} canSwitchDirection
@@ -25,10 +26,11 @@ module.exports = (() => {
25
26
  * @param {Function} generator
26
27
  */
27
28
  class InstrumentType extends Enum {
28
- constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
29
+ constructor(code, description, alternateDescription, canExistEmpty, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
29
30
  super(code, description);
30
31
 
31
32
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
33
+ assert.argumentIsRequired(canExistEmpty, 'canExistEmpty', Boolean);
32
34
  assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
33
35
  assert.argumentIsRequired(canShort, 'canShort', Boolean);
34
36
  assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
@@ -40,6 +42,8 @@ module.exports = (() => {
40
42
  assert.argumentIsRequired(generator, 'generator', Function);
41
43
 
42
44
  this._alternateDescription = alternateDescription;
45
+
46
+ this._canExistEmpty = canExistEmpty;
43
47
  this._canReinvest = canReinvest;
44
48
  this._canShort = canShort;
45
49
  this._canSwitchDirection = canSwitchDirection;
@@ -62,6 +66,16 @@ module.exports = (() => {
62
66
  return this._alternateDescription;
63
67
  }
64
68
 
69
+ /**
70
+ * Indicates if the position can exist without any associated transactions.
71
+ *
72
+ * @public
73
+ * @returns {Boolean}
74
+ */
75
+ get canExistEmpty() {
76
+ return this._canExistEmpty;
77
+ }
78
+
65
79
  /**
66
80
  * Indicates if the instrument type allows automatic reinvestment.
67
81
  *
@@ -242,10 +256,10 @@ module.exports = (() => {
242
256
  }
243
257
  }
244
258
 
245
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
246
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
247
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
248
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
259
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', true, false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
260
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', false, true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
261
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', false, true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
262
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
249
263
 
250
264
  const map = { };
251
265
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.130",
3
+ "version": "1.2.131",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -12,9 +12,10 @@ module.exports = (() => {
12
12
  *
13
13
  * @public
14
14
  * @extends {Enum}
15
+ * @param {String} code
15
16
  * @param {String} description
16
17
  * @param {String} alternateDescription
17
- * @param {String} code
18
+ * @param {Boolean} canExistEmpty
18
19
  * @param {Boolean} canReinvest
19
20
  * @param {Boolean} canShort
20
21
  * @param {Boolean} canSwitchDirection
@@ -26,10 +27,11 @@ module.exports = (() => {
26
27
  * @param {Function} generator
27
28
  */
28
29
  class InstrumentType extends Enum {
29
- constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
30
+ constructor(code, description, alternateDescription, canExistEmpty, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
30
31
  super(code, description);
31
32
 
32
33
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
34
+ assert.argumentIsRequired(canExistEmpty, 'canExistEmpty', Boolean);
33
35
  assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
34
36
  assert.argumentIsRequired(canShort, 'canShort', Boolean);
35
37
  assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
@@ -41,6 +43,8 @@ module.exports = (() => {
41
43
  assert.argumentIsRequired(generator, 'generator', Function);
42
44
 
43
45
  this._alternateDescription = alternateDescription;
46
+
47
+ this._canExistEmpty = canExistEmpty;
44
48
  this._canReinvest = canReinvest;
45
49
  this._canShort = canShort;
46
50
  this._canSwitchDirection = canSwitchDirection;
@@ -63,6 +67,16 @@ module.exports = (() => {
63
67
  return this._alternateDescription;
64
68
  }
65
69
 
70
+ /**
71
+ * Indicates if the position can exist without any associated transactions.
72
+ *
73
+ * @public
74
+ * @returns {Boolean}
75
+ */
76
+ get canExistEmpty() {
77
+ return this._canExistEmpty;
78
+ }
79
+
66
80
  /**
67
81
  * Indicates if the instrument type allows automatic reinvestment.
68
82
  *
@@ -243,10 +257,10 @@ module.exports = (() => {
243
257
  }
244
258
  }
245
259
 
246
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
247
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
248
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
249
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
260
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', true, false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
261
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', false, true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
262
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', false, true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
263
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
250
264
 
251
265
  const map = { };
252
266