@barchart/portfolio-api-common 1.2.62 → 1.2.66

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.
@@ -21,10 +21,11 @@ module.exports = (() => {
21
21
  * @param {Boolean} hasCorporateActions
22
22
  * @param {Boolean} closeFractional
23
23
  * @param {Boolean} roundQuantity
24
+ * @param {Boolean} strictOrdering
24
25
  * @param {Function} generator
25
26
  */
26
27
  class InstrumentType extends Enum {
27
- constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, generator) {
28
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
28
29
  super(code, description);
29
30
 
30
31
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
@@ -35,6 +36,7 @@ module.exports = (() => {
35
36
  assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
36
37
  assert.argumentIsRequired(closeFractional, 'closeFractional', Boolean);
37
38
  assert.argumentIsRequired(roundQuantity, 'roundQuantity', Boolean);
39
+ assert.argumentIsRequired(roundQuantity, 'strictOrdering', Boolean);
38
40
  assert.argumentIsRequired(generator, 'generator', Function);
39
41
 
40
42
  this._alternateDescription = alternateDescription;
@@ -44,7 +46,9 @@ module.exports = (() => {
44
46
  this._usesSymbols = usesSymbols;
45
47
  this._hasCorporateActions = hasCorporateActions;
46
48
  this._closeFractional = closeFractional;
49
+ this._closeFractional = strictOrdering;
47
50
  this._roundQuantity = roundQuantity;
51
+ this._strictOrdering = strictOrdering;
48
52
 
49
53
  this._generator = generator;
50
54
  }
@@ -121,6 +125,17 @@ module.exports = (() => {
121
125
  return this._closeFractional;
122
126
  }
123
127
 
128
+ /**
129
+ * Indicates if transaction sequences must be honored before calculating position
130
+ * totals.
131
+ *
132
+ * @public
133
+ * @returns {Boolean}
134
+ */
135
+ get strictOrdering() {
136
+ return this._strictOrdering;
137
+ }
138
+
124
139
  /**
125
140
  * Indicates transaction quantities should be rounded.
126
141
  *
@@ -228,10 +243,10 @@ module.exports = (() => {
228
243
  }
229
244
  }
230
245
 
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()}`);
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()}`);
235
250
 
236
251
  const map = { };
237
252
 
@@ -1,4 +1,5 @@
1
- const DataType = require('@barchart/common-js/serialization/json/DataType'),
1
+ const Currency = require('@barchart/common-js/lang/Currency'),
2
+ DataType = require('@barchart/common-js/serialization/json/DataType'),
2
3
  Enum = require('@barchart/common-js/lang/Enum'),
3
4
  Schema = require('@barchart/common-js/serialization/json/Schema'),
4
5
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.62",
3
+ "version": "1.2.66",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -22,10 +22,11 @@ module.exports = (() => {
22
22
  * @param {Boolean} hasCorporateActions
23
23
  * @param {Boolean} closeFractional
24
24
  * @param {Boolean} roundQuantity
25
+ * @param {Boolean} strictOrdering
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, generator) {
29
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
29
30
  super(code, description);
30
31
 
31
32
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
@@ -36,6 +37,7 @@ module.exports = (() => {
36
37
  assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
37
38
  assert.argumentIsRequired(closeFractional, 'closeFractional', Boolean);
38
39
  assert.argumentIsRequired(roundQuantity, 'roundQuantity', Boolean);
40
+ assert.argumentIsRequired(roundQuantity, 'strictOrdering', Boolean);
39
41
  assert.argumentIsRequired(generator, 'generator', Function);
40
42
 
41
43
  this._alternateDescription = alternateDescription;
@@ -45,7 +47,9 @@ module.exports = (() => {
45
47
  this._usesSymbols = usesSymbols;
46
48
  this._hasCorporateActions = hasCorporateActions;
47
49
  this._closeFractional = closeFractional;
50
+ this._closeFractional = strictOrdering;
48
51
  this._roundQuantity = roundQuantity;
52
+ this._strictOrdering = strictOrdering;
49
53
 
50
54
  this._generator = generator;
51
55
  }
@@ -122,6 +126,17 @@ module.exports = (() => {
122
126
  return this._closeFractional;
123
127
  }
124
128
 
129
+ /**
130
+ * Indicates if transaction sequences must be honored before calculating position
131
+ * totals.
132
+ *
133
+ * @public
134
+ * @returns {Boolean}
135
+ */
136
+ get strictOrdering() {
137
+ return this._strictOrdering;
138
+ }
139
+
125
140
  /**
126
141
  * Indicates transaction quantities should be rounded.
127
142
  *
@@ -229,10 +244,10 @@ module.exports = (() => {
229
244
  }
230
245
  }
231
246
 
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()}`);
247
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
248
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
249
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
250
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
236
251
 
237
252
  const map = { };
238
253