@barchart/portfolio-api-common 1.2.60 → 1.2.61

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.
@@ -19,11 +19,12 @@ module.exports = (() => {
19
19
  * @param {Boolean} canSwitchDirection
20
20
  * @param {Boolean} usesSymbols
21
21
  * @param {Boolean} hasCorporateActions
22
- * @param {Number} closeFractional
22
+ * @param {Boolean} closeFractional
23
+ * @param {Boolean} roundQuantity
23
24
  * @param {Function} generator
24
25
  */
25
26
  class InstrumentType extends Enum {
26
- constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, generator) {
27
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, generator) {
27
28
  super(code, description);
28
29
 
29
30
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
@@ -33,6 +34,7 @@ module.exports = (() => {
33
34
  assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
34
35
  assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
35
36
  assert.argumentIsRequired(closeFractional, 'closeFractional', Boolean);
37
+ assert.argumentIsRequired(roundQuantity, 'roundQuantity', Boolean);
36
38
  assert.argumentIsRequired(generator, 'generator', Function);
37
39
 
38
40
  this._alternateDescription = alternateDescription;
@@ -42,6 +44,7 @@ module.exports = (() => {
42
44
  this._usesSymbols = usesSymbols;
43
45
  this._hasCorporateActions = hasCorporateActions;
44
46
  this._closeFractional = closeFractional;
47
+ this._roundQuantity = roundQuantity;
45
48
 
46
49
  this._generator = generator;
47
50
  }
@@ -118,6 +121,16 @@ module.exports = (() => {
118
121
  return this._closeFractional;
119
122
  }
120
123
 
124
+ /**
125
+ * Indicates transaction quantities should be rounded.
126
+ *
127
+ * @public
128
+ * @returns {Boolean}
129
+ */
130
+ get roundQuantity() {
131
+ return this._roundQuantity;
132
+ }
133
+
121
134
  /**
122
135
  * Generates an identifier for the instrument.
123
136
  *
@@ -215,10 +228,10 @@ module.exports = (() => {
215
228
  }
216
229
  }
217
230
 
218
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
219
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
220
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
221
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
231
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
232
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
233
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
234
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
222
235
 
223
236
  const map = { };
224
237
 
@@ -2,8 +2,7 @@ const array = require('@barchart/common-js/lang/array'),
2
2
  assert = require('@barchart/common-js/lang/assert'),
3
3
  Day = require('@barchart/common-js/lang/Day'),
4
4
  Decimal = require('@barchart/common-js/lang/Decimal'),
5
- Enum = require('@barchart/common-js/lang/Enum'),
6
- is = require('@barchart/common-js/lang/is');
5
+ Enum = require('@barchart/common-js/lang/Enum');
7
6
 
8
7
  module.exports = (() => {
9
8
  'use strict';
@@ -1,5 +1,4 @@
1
- const assert = require('@barchart/common-js/lang/assert'),
2
- Enum = require('@barchart/common-js/lang/Enum');
1
+ const Enum = require('@barchart/common-js/lang/Enum');
3
2
 
4
3
  module.exports = (() => {
5
4
  'use strict';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.60",
3
+ "version": "1.2.61",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -20,11 +20,12 @@ module.exports = (() => {
20
20
  * @param {Boolean} canSwitchDirection
21
21
  * @param {Boolean} usesSymbols
22
22
  * @param {Boolean} hasCorporateActions
23
- * @param {Number} closeFractional
23
+ * @param {Boolean} closeFractional
24
+ * @param {Boolean} roundQuantity
24
25
  * @param {Function} generator
25
26
  */
26
27
  class InstrumentType extends Enum {
27
- constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, generator) {
28
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, generator) {
28
29
  super(code, description);
29
30
 
30
31
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
@@ -34,6 +35,7 @@ module.exports = (() => {
34
35
  assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
35
36
  assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
36
37
  assert.argumentIsRequired(closeFractional, 'closeFractional', Boolean);
38
+ assert.argumentIsRequired(roundQuantity, 'roundQuantity', Boolean);
37
39
  assert.argumentIsRequired(generator, 'generator', Function);
38
40
 
39
41
  this._alternateDescription = alternateDescription;
@@ -43,6 +45,7 @@ module.exports = (() => {
43
45
  this._usesSymbols = usesSymbols;
44
46
  this._hasCorporateActions = hasCorporateActions;
45
47
  this._closeFractional = closeFractional;
48
+ this._roundQuantity = roundQuantity;
46
49
 
47
50
  this._generator = generator;
48
51
  }
@@ -119,6 +122,16 @@ module.exports = (() => {
119
122
  return this._closeFractional;
120
123
  }
121
124
 
125
+ /**
126
+ * Indicates transaction quantities should be rounded.
127
+ *
128
+ * @public
129
+ * @returns {Boolean}
130
+ */
131
+ get roundQuantity() {
132
+ return this._roundQuantity;
133
+ }
134
+
122
135
  /**
123
136
  * Generates an identifier for the instrument.
124
137
  *
@@ -216,10 +229,10 @@ module.exports = (() => {
216
229
  }
217
230
  }
218
231
 
219
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
220
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
221
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
222
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
232
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
233
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
234
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
235
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
223
236
 
224
237
  const map = { };
225
238
 
@@ -366,8 +379,7 @@ const array = require('@barchart/common-js/lang/array'),
366
379
  assert = require('@barchart/common-js/lang/assert'),
367
380
  Day = require('@barchart/common-js/lang/Day'),
368
381
  Decimal = require('@barchart/common-js/lang/Decimal'),
369
- Enum = require('@barchart/common-js/lang/Enum'),
370
- is = require('@barchart/common-js/lang/is');
382
+ Enum = require('@barchart/common-js/lang/Enum');
371
383
 
372
384
  module.exports = (() => {
373
385
  'use strict';
@@ -634,7 +646,7 @@ module.exports = (() => {
634
646
  return PositionSummaryFrame;
635
647
  })();
636
648
 
637
- },{"@barchart/common-js/lang/Day":21,"@barchart/common-js/lang/Decimal":22,"@barchart/common-js/lang/Enum":24,"@barchart/common-js/lang/array":28,"@barchart/common-js/lang/assert":29,"@barchart/common-js/lang/is":33}],4:[function(require,module,exports){
649
+ },{"@barchart/common-js/lang/Day":21,"@barchart/common-js/lang/Decimal":22,"@barchart/common-js/lang/Enum":24,"@barchart/common-js/lang/array":28,"@barchart/common-js/lang/assert":29}],4:[function(require,module,exports){
638
650
  const assert = require('@barchart/common-js/lang/assert'),
639
651
  Enum = require('@barchart/common-js/lang/Enum');
640
652