@barchart/portfolio-api-common 1.0.74 → 1.0.78

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,6 +19,10 @@ module.exports = (() => {
19
19
  constructor(code, description, alternateDescription, canReinvest, usesSymbols) {
20
20
  super(code, description);
21
21
 
22
+ assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
23
+ assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
24
+ assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
25
+
22
26
  this._alternateDescription = alternateDescription;
23
27
  this._canReinvest = canReinvest;
24
28
  this._usesSymbols = usesSymbols;
@@ -6,7 +6,8 @@ const assert = require('@barchart/common-js/lang/assert'),
6
6
  Schema = require('@barchart/common-js/serialization/json/Schema'),
7
7
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
8
8
 
9
- const TransactionType = require('./../data/TransactionType');
9
+ const InstrumentType = require('./../data/InstrumentType'),
10
+ TransactionType = require('./../data/TransactionType');
10
11
 
11
12
  module.exports = (() => {
12
13
  'use strict';
@@ -244,12 +245,11 @@ module.exports = (() => {
244
245
  .withField('portfolio', DataType.STRING)
245
246
  .withField('position', DataType.STRING)
246
247
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
247
- .withField('instrument.name', DataType.STRING, true)
248
- .withField('instrument.type', DataType.STRING, true)
249
- .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
248
+ .withField('instrument.name', DataType.STRING)
249
+ .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'))
250
+ .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
250
251
  .withField('instrument.symbol.barchart', DataType.STRING, true)
251
252
  .withField('instrument.symbol.display', DataType.STRING, true)
252
- .withField('currency', DataType.forEnum(Currency, 'Currency'))
253
253
  .withField('date', DataType.DAY)
254
254
  .withField('price', DataType.DECIMAL)
255
255
  .withField('quantity', DataType.DECIMAL)
@@ -272,9 +272,9 @@ module.exports = (() => {
272
272
  .withField('portfolio', DataType.STRING)
273
273
  .withField('position', DataType.STRING)
274
274
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
275
- .withField('instrument.name', DataType.STRING, true)
276
- .withField('instrument.type', DataType.STRING, true)
277
- .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
275
+ .withField('instrument.name', DataType.STRING)
276
+ .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'))
277
+ .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
278
278
  .withField('instrument.symbol.barchart', DataType.STRING, true)
279
279
  .withField('instrument.symbol.display', DataType.STRING, true)
280
280
  .withField('date', DataType.DAY)
@@ -388,9 +388,8 @@ module.exports = (() => {
388
388
  .withField('portfolio', DataType.STRING)
389
389
  .withField('position', DataType.STRING)
390
390
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
391
- .withField('instrument.name', DataType.STRING, true)
392
- .withField('instrument.type', DataType.STRING, true)
393
- .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
391
+ .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'))
392
+ .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
394
393
  .withField('date', DataType.DAY)
395
394
  .withField('amount', DataType.DECIMAL)
396
395
  .withField('fee', DataType.DECIMAL, true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.74",
3
+ "version": "1.0.78",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -20,6 +20,10 @@ module.exports = (() => {
20
20
  constructor(code, description, alternateDescription, canReinvest, usesSymbols) {
21
21
  super(code, description);
22
22
 
23
+ assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
24
+ assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
25
+ assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
26
+
23
27
  this._alternateDescription = alternateDescription;
24
28
  this._canReinvest = canReinvest;
25
29
  this._usesSymbols = usesSymbols;