@barchart/portfolio-client-js 1.2.18 → 1.2.19

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.
@@ -26,7 +26,7 @@ module.exports = function () {
26
26
  window.Barchart.ValuationType = ValuationType;
27
27
  }();
28
28
 
29
- },{"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Timezones":35,"@barchart/portfolio-api-common/lib/data/TransactionType":53,"@barchart/portfolio-api-common/lib/data/ValuationType":54,"@barchart/tgam-jwt-js/lib/JwtGateway":59}],2:[function(require,module,exports){
29
+ },{"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Timezones":35,"@barchart/portfolio-api-common/lib/data/TransactionType":54,"@barchart/portfolio-api-common/lib/data/ValuationType":55,"@barchart/tgam-jwt-js/lib/JwtGateway":60}],2:[function(require,module,exports){
30
30
  'use strict';
31
31
 
32
32
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -272,7 +272,7 @@ module.exports = function () {
272
272
  return x.format();
273
273
  }).withVariableParameter('end', 'end', 'end', true, function (x) {
274
274
  return x.format();
275
- });
275
+ }).withVariableParameter('page', 'page', 'page', true).withVariableParameter('sequence', 'sequence', 'sequence', true).withVariableParameter('count', 'count', 'count', true).withVariableParameter('descending', 'descending', 'descending', true);
276
276
  }).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
277
277
  return _this;
278
278
  }
@@ -770,8 +770,37 @@ module.exports = function () {
770
770
  }
771
771
  }, {
772
772
  key: 'readTransactionsFormattedPage',
773
- value: function readTransactionsFormattedPage(portfolio, position, start, count) {
774
- return Promise.resolve([]);
773
+ value: function readTransactionsFormattedPage(portfolio, position, sequence, count, descending) {
774
+ var _this18 = this;
775
+
776
+ return Promise.resolve().then(function () {
777
+ checkStart.call(_this18);
778
+
779
+ assert.argumentIsRequired(portfolio, 'portfolio', String);
780
+ assert.argumentIsRequired(position, 'position', String);
781
+ assert.argumentIsOptional(sequence, 'sequence', Number);
782
+ assert.argumentIsOptional(count, 'count', Number);
783
+ assert.argumentIsOptional(descending, 'descending', Boolean);
784
+
785
+ var payload = {};
786
+
787
+ payload.portfolio = portfolio;
788
+ payload.position = position;
789
+
790
+ payload.page = true;
791
+
792
+ if (sequence) {
793
+ payload.sequence = sequence;
794
+ }
795
+
796
+ if (count) {
797
+ payload.count = count;
798
+ }
799
+
800
+ payload.descending = is.boolean(descending) && descending;
801
+
802
+ return Gateway.invoke(_this18._readTransactionsReportEndpoint, payload);
803
+ });
775
804
  }
776
805
 
777
806
  /**
@@ -1010,7 +1039,7 @@ module.exports = function () {
1010
1039
  return PortfolioGateway;
1011
1040
  }();
1012
1041
 
1013
- },{"./../common/Configuration":2,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/ErrorInterceptor":20,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/portfolio-api-common/lib/data/PositionSummaryFrame":52,"@barchart/portfolio-api-common/lib/data/TransactionType":53,"@barchart/portfolio-api-common/lib/serialization/PortfolioSchema":55,"@barchart/portfolio-api-common/lib/serialization/PositionSchema":56,"@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema":57,"@barchart/portfolio-api-common/lib/serialization/TransactionSchema":58}],4:[function(require,module,exports){
1042
+ },{"./../common/Configuration":2,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/ErrorInterceptor":20,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/portfolio-api-common/lib/data/PositionSummaryFrame":53,"@barchart/portfolio-api-common/lib/data/TransactionType":54,"@barchart/portfolio-api-common/lib/serialization/PortfolioSchema":56,"@barchart/portfolio-api-common/lib/serialization/PositionSchema":57,"@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema":58,"@barchart/portfolio-api-common/lib/serialization/TransactionSchema":59}],4:[function(require,module,exports){
1014
1043
  'use strict';
1015
1044
 
1016
1045
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -1361,7 +1390,7 @@ module.exports = function () {
1361
1390
  return {
1362
1391
  JwtGateway: JwtGateway,
1363
1392
  PortfolioGateway: PortfolioGateway,
1364
- version: '1.2.18'
1393
+ version: '1.2.19'
1365
1394
  };
1366
1395
  }();
1367
1396
 
@@ -1464,10 +1493,29 @@ module.exports = function () {
1464
1493
 
1465
1494
  return reasons.children;
1466
1495
  }
1496
+
1497
+ /**
1498
+ * Indicates if the tree of {@link FailureReasonItem} instances contains
1499
+ * at least one item with a matching {@link FailureType}.
1500
+ *
1501
+ * @public
1502
+ * @param {FailureType} type
1503
+ * @returns {Boolean}
1504
+ */
1505
+
1506
+ }, {
1507
+ key: 'hasFailureType',
1508
+ value: function hasFailureType(type) {
1509
+ assert.argumentIsRequired(type, 'type', FailureType, 'FailureType');
1510
+
1511
+ return this._head.search(function (item) {
1512
+ return item.type === type;
1513
+ }, false, false) !== null;
1514
+ }
1467
1515
  }, {
1468
1516
  key: 'toJSON',
1469
1517
  value: function toJSON() {
1470
- return JSON.stringify(this.format());
1518
+ return this.format();
1471
1519
  }
1472
1520
 
1473
1521
  /**
@@ -1866,7 +1914,7 @@ module.exports = function () {
1866
1914
  var requestIdentifyFailure = new FailureType('REQUEST_IDENTITY_FAILURE', 'An attempt to {L|root.endpoint.description} failed because your identity could not be determined.');
1867
1915
  var requestAuthorizationFailure = new FailureType('REQUEST_AUTHORIZATION_FAILURE', 'An attempt to {L|root.endpoint.description} failed. You are not authorized to perform this action.');
1868
1916
  var requestInputMalformed = new FailureType('REQUEST_INPUT_MALFORMED', 'An attempt to {L|root.endpoint.description} failed, the data structure is invalid.');
1869
- var schemaValidationFailure = new FailureType('SCHEMA_VALIDATION_FAILURE', 'An attempt serialize JSON string failed found "{L|key}" when expecting "{L|name}"');
1917
+ var schemaValidationFailure = new FailureType('SCHEMA_VALIDATION_FAILURE', 'An attempt to read {U|schema} data failed (found "{L|key}" when expecting "{L|name}")');
1870
1918
  var requestGeneralFailure = new FailureType('REQUEST_GENERAL_FAILURE', 'An attempt to {L|root.endpoint.description} failed for unspecified reason(s).');
1871
1919
 
1872
1920
  return FailureType;
@@ -2098,7 +2146,7 @@ module.exports = function () {
2098
2146
  return Gateway;
2099
2147
  }();
2100
2148
 
2101
- },{"./../../lang/array":36,"./../../lang/assert":37,"./../../lang/attributes":38,"./../../lang/promise":42,"./../failures/FailureReason":6,"./../failures/FailureType":8,"./definitions/Endpoint":12,"./definitions/VerbType":16,"axios":61}],10:[function(require,module,exports){
2149
+ },{"./../../lang/array":36,"./../../lang/assert":37,"./../../lang/attributes":38,"./../../lang/promise":42,"./../failures/FailureReason":6,"./../failures/FailureType":8,"./definitions/Endpoint":12,"./definitions/VerbType":16,"axios":62}],10:[function(require,module,exports){
2102
2150
  'use strict';
2103
2151
 
2104
2152
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -3122,6 +3170,15 @@ module.exports = function () {
3122
3170
  get: function get() {
3123
3171
  return this._parameters;
3124
3172
  }
3173
+ }], [{
3174
+ key: 'merge',
3175
+ value: function merge(a, b) {
3176
+ return new Parameters(a.parameters.slice(0).concat(b.parameters.filter(function (candidate) {
3177
+ return !a.parameters.some(function (existing) {
3178
+ return existing.key === candidate.key;
3179
+ });
3180
+ })));
3181
+ }
3125
3182
  }]);
3126
3183
 
3127
3184
  return Parameters;
@@ -3793,7 +3850,7 @@ module.exports = function () {
3793
3850
  *
3794
3851
  * @public
3795
3852
  * @static
3796
- * @return {DelegateRequestInterceptor}
3853
+ * @returns {DelegateRequestInterceptor}
3797
3854
  */
3798
3855
 
3799
3856
  }, {
@@ -4381,6 +4438,33 @@ module.exports = function () {
4381
4438
  }
4382
4439
  }
4383
4440
 
4441
+ /**
4442
+ * Climbs the tree, evaluating each parent until a predicate is matched. Once matched,
4443
+ * the {@link Tree} node is returned. Otherwise, if the predicate cannot be matched,
4444
+ * a null value is returned.
4445
+ *
4446
+ * @public
4447
+ * @param {Tree~nodePredicate} predicate - A predicate that tests each child node. The predicate takes two arguments -- the node's value, and the node itself.
4448
+ * @param {boolean=} includeCurrentNode - If true, the predicate will be applied to the current node.
4449
+ * @returns {Tree|null}
4450
+ */
4451
+
4452
+ }, {
4453
+ key: 'findParent',
4454
+ value: function findParent(predicate, includeCurrentNode) {
4455
+ var returnRef = void 0;
4456
+
4457
+ if (is.boolean(includeCurrentNode) && includeCurrentNode && predicate(this.getValue(), this)) {
4458
+ returnRef = this;
4459
+ } else if (this._parent !== null) {
4460
+ returnRef = this._parent.findParent(predicate, true);
4461
+ } else {
4462
+ returnRef = null;
4463
+ }
4464
+
4465
+ return returnRef;
4466
+ }
4467
+
4384
4468
  /**
4385
4469
  * Creates a representation of the tree using JavaScript objects and arrays.
4386
4470
  *
@@ -4639,8 +4723,8 @@ module.exports = function () {
4639
4723
  * Compares two strings (in ascending order), using {@link String#localeCompare}.
4640
4724
  *
4641
4725
  * @static
4642
- * @param {Number} a
4643
- * @param {Number} b
4726
+ * @param {String} a
4727
+ * @param {String} b
4644
4728
  * @returns {Number}
4645
4729
  */
4646
4730
  compareStrings: function compareStrings(a, b) {
@@ -5222,7 +5306,7 @@ module.exports = function () {
5222
5306
  * @returns {String}
5223
5307
  */
5224
5308
  value: function format() {
5225
- return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
5309
+ return leftPad(this._year, 4, '0') + '-' + leftPad(this._month, 2, '0') + '-' + leftPad(this._day, 2, '0');
5226
5310
  }
5227
5311
 
5228
5312
  /**
@@ -5239,12 +5323,11 @@ module.exports = function () {
5239
5323
  }
5240
5324
 
5241
5325
  /**
5242
- * Converts a string (which matches the output of {@link Day#format} into
5243
- * a {@link Day} instance.
5326
+ * Clones a {@link Day} instance.
5244
5327
  *
5245
5328
  * @public
5246
5329
  * @static
5247
- * @param {String} value
5330
+ * @param {Day} value
5248
5331
  * @returns {Day}
5249
5332
  */
5250
5333
 
@@ -5285,6 +5368,24 @@ module.exports = function () {
5285
5368
  return this._day;
5286
5369
  }
5287
5370
  }], [{
5371
+ key: 'clone',
5372
+ value: function clone(value) {
5373
+ assert.argumentIsRequired(value, 'value', Day, 'Day');
5374
+
5375
+ return new Day(value.year, value.month, value.day);
5376
+ }
5377
+
5378
+ /**
5379
+ * Converts a string (which matches the output of {@link Day#format} into
5380
+ * a {@link Day} instance.
5381
+ *
5382
+ * @public
5383
+ * @static
5384
+ * @param {String} value
5385
+ * @returns {Day}
5386
+ */
5387
+
5388
+ }, {
5288
5389
  key: 'parse',
5289
5390
  value: function parse(value) {
5290
5391
  assert.argumentIsRequired(value, 'value', String);
@@ -5339,7 +5440,7 @@ module.exports = function () {
5339
5440
  *
5340
5441
  * @static
5341
5442
  * @public
5342
- * @return {Day}
5443
+ * @returns {Day}
5343
5444
  */
5344
5445
 
5345
5446
  }, {
@@ -5431,8 +5532,11 @@ module.exports = function () {
5431
5532
 
5432
5533
  var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
5433
5534
 
5434
- function leftPad(value) {
5435
- return value < 10 ? '0' + value : '' + value;
5535
+ function leftPad(value, digits, character) {
5536
+ var string = value.toString();
5537
+ var padding = digits - string.length;
5538
+
5539
+ return '' + character.repeat(padding) + string;
5436
5540
  }
5437
5541
 
5438
5542
  var comparator = ComparatorBuilder.startWith(function (a, b) {
@@ -5598,15 +5702,17 @@ module.exports = function () {
5598
5702
  *
5599
5703
  * @public
5600
5704
  * @param {Boolean=} approximate
5705
+ * @param {Number=} places
5601
5706
  * @returns {Boolean}
5602
5707
  */
5603
5708
 
5604
5709
  }, {
5605
5710
  key: 'getIsZero',
5606
- value: function getIsZero(approximate) {
5711
+ value: function getIsZero(approximate, places) {
5607
5712
  assert.argumentIsOptional(approximate, 'approximate', Boolean);
5713
+ assert.argumentIsOptional(places, 'places', Number);
5608
5714
 
5609
- return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(20, RoundingMode.NORMAL).getIsZero();
5715
+ return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(places || Big.DP, RoundingMode.NORMAL).getIsZero();
5610
5716
  }
5611
5717
 
5612
5718
  /**
@@ -5705,6 +5811,43 @@ module.exports = function () {
5705
5811
  return this._big.eq(getBig(other));
5706
5812
  }
5707
5813
 
5814
+ /**
5815
+ * Returns true if the current instance is an integer (i.e. has no decimal
5816
+ * component).
5817
+ *
5818
+ * @public
5819
+ * @return {Boolean}
5820
+ */
5821
+
5822
+ }, {
5823
+ key: 'getIsInteger',
5824
+ value: function getIsInteger() {
5825
+ return this.getIsEqual(this.round(0));
5826
+ }
5827
+
5828
+ /**
5829
+ * Returns the number of decimal places used.
5830
+ *
5831
+ * @public
5832
+ * @returns {Number}
5833
+ */
5834
+
5835
+ }, {
5836
+ key: 'getDecimalPlaces',
5837
+ value: function getDecimalPlaces() {
5838
+ var matches = this.toFixed().match(/-?\d*\.(\d*)/);
5839
+
5840
+ var returnVal = void 0;
5841
+
5842
+ if (matches === null) {
5843
+ returnVal = 0;
5844
+ } else {
5845
+ returnVal = matches[1].length;
5846
+ }
5847
+
5848
+ return returnVal;
5849
+ }
5850
+
5708
5851
  /**
5709
5852
  * Emits a floating point value that approximates the value of the current
5710
5853
  * instance.
@@ -5753,10 +5896,11 @@ module.exports = function () {
5753
5896
  }
5754
5897
 
5755
5898
  /**
5756
- * Parses the value emitted by {@link Decimal#toJSON}.
5899
+ * Clones a {@link Decimal} instance.
5757
5900
  *
5758
5901
  * @public
5759
- * @param {String} value
5902
+ * @static
5903
+ * @param {Decimal} value
5760
5904
  * @returns {Decimal}
5761
5905
  */
5762
5906
 
@@ -5766,6 +5910,22 @@ module.exports = function () {
5766
5910
  return '[Decimal]';
5767
5911
  }
5768
5912
  }], [{
5913
+ key: 'clone',
5914
+ value: function clone(value) {
5915
+ assert.argumentIsRequired(value, 'value', Decimal, 'Decimal');
5916
+
5917
+ return new Decimal(value._big);
5918
+ }
5919
+
5920
+ /**
5921
+ * Parses the value emitted by {@link Decimal#toJSON}.
5922
+ *
5923
+ * @public
5924
+ * @param {String} value
5925
+ * @returns {Decimal}
5926
+ */
5927
+
5928
+ }, {
5769
5929
  key: 'parse',
5770
5930
  value: function parse(value) {
5771
5931
  return new Decimal(value);
@@ -5787,7 +5947,7 @@ module.exports = function () {
5787
5947
  *
5788
5948
  * @public
5789
5949
  * @param {Decimal} instance
5790
- * @return {Boolean}
5950
+ * @returns {Boolean}
5791
5951
  */
5792
5952
  value: function getIsZero(instance) {
5793
5953
  assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
@@ -5800,7 +5960,7 @@ module.exports = function () {
5800
5960
  *
5801
5961
  * @public
5802
5962
  * @param {Decimal} instance
5803
- * @return {Boolean}
5963
+ * @returns {Boolean}
5804
5964
  */
5805
5965
 
5806
5966
  }, {
@@ -5816,7 +5976,7 @@ module.exports = function () {
5816
5976
  *
5817
5977
  * @public
5818
5978
  * @param {Decimal} instance
5819
- * @return {Boolean}
5979
+ * @returns {Boolean}
5820
5980
  */
5821
5981
 
5822
5982
  }, {
@@ -5832,7 +5992,7 @@ module.exports = function () {
5832
5992
  *
5833
5993
  * @public
5834
5994
  * @param {Decimal} instance
5835
- * @return {Boolean}
5995
+ * @returns {Boolean}
5836
5996
  */
5837
5997
 
5838
5998
  }, {
@@ -5848,7 +6008,7 @@ module.exports = function () {
5848
6008
  *
5849
6009
  * @public
5850
6010
  * @param {Decimal} instance
5851
- * @return {Boolean}
6011
+ * @returns {Boolean}
5852
6012
  */
5853
6013
 
5854
6014
  }, {
@@ -5864,7 +6024,7 @@ module.exports = function () {
5864
6024
  *
5865
6025
  * @public
5866
6026
  * @param {Decimal} instance
5867
- * @return {Boolean}
6027
+ * @returns {Boolean}
5868
6028
  */
5869
6029
 
5870
6030
  }, {
@@ -6054,7 +6214,7 @@ module.exports = function () {
6054
6214
  return Decimal;
6055
6215
  }();
6056
6216
 
6057
- },{"./Enum":32,"./assert":37,"./is":40,"big.js":86}],31:[function(require,module,exports){
6217
+ },{"./Enum":32,"./assert":37,"./is":40,"big.js":87}],31:[function(require,module,exports){
6058
6218
  'use strict';
6059
6219
 
6060
6220
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -6254,6 +6414,7 @@ module.exports = function () {
6254
6414
  /**
6255
6415
  * The unique code.
6256
6416
  *
6417
+ * @public
6257
6418
  * @returns {String}
6258
6419
  */
6259
6420
 
@@ -6266,6 +6427,7 @@ module.exports = function () {
6266
6427
  * Returns true if the provided {@link Enum} argument is equal
6267
6428
  * to the instance.
6268
6429
  *
6430
+ * @public
6269
6431
  * @param {Enum} other
6270
6432
  * @returns {boolean}
6271
6433
  */
@@ -6290,6 +6452,7 @@ module.exports = function () {
6290
6452
  * Looks up a enumeration item; given the enumeration type and the enumeration
6291
6453
  * item's value. If no matching item can be found, a null value is returned.
6292
6454
  *
6455
+ * @public
6293
6456
  * @param {Function} type - The enumeration type.
6294
6457
  * @param {String} code - The enumeration item's code.
6295
6458
  * @returns {*|null}
@@ -6309,6 +6472,7 @@ module.exports = function () {
6309
6472
  /**
6310
6473
  * The description.
6311
6474
  *
6475
+ * @public
6312
6476
  * @returns {String}
6313
6477
  */
6314
6478
 
@@ -6328,6 +6492,7 @@ module.exports = function () {
6328
6492
  /**
6329
6493
  * Returns all of the enumeration's items (given an enumeration type).
6330
6494
  *
6495
+ * @public
6331
6496
  * @param {Function} type - The enumeration to list.
6332
6497
  * @returns {Array}
6333
6498
  */
@@ -6527,10 +6692,11 @@ module.exports = function () {
6527
6692
  }
6528
6693
 
6529
6694
  /**
6530
- * Parses the value emitted by {@link Timestamp#toJSON}.
6695
+ * Clones a {@link Timestamp} instance.
6531
6696
  *
6532
6697
  * @public
6533
- * @param {String} value
6698
+ * @static
6699
+ * @param {Timestamp} value
6534
6700
  * @returns {Timestamp}
6535
6701
  */
6536
6702
 
@@ -6566,6 +6732,22 @@ module.exports = function () {
6566
6732
  return this._moment;
6567
6733
  }
6568
6734
  }], [{
6735
+ key: 'clone',
6736
+ value: function clone(value) {
6737
+ assert.argumentIsRequired(value, 'value', Timestamp, 'Timestamp');
6738
+
6739
+ return new Timestamp(value._timestamp, value._timezone);
6740
+ }
6741
+
6742
+ /**
6743
+ * Parses the value emitted by {@link Timestamp#toJSON}.
6744
+ *
6745
+ * @public
6746
+ * @param {Number} value
6747
+ * @returns {Timestamp}
6748
+ */
6749
+
6750
+ }, {
6569
6751
  key: 'parse',
6570
6752
  value: function parse(value) {
6571
6753
  return new Timestamp(value);
@@ -6591,7 +6773,7 @@ module.exports = function () {
6591
6773
  return Timestamp;
6592
6774
  }();
6593
6775
 
6594
- },{"./assert":37,"./is":40,"moment-timezone":91}],35:[function(require,module,exports){
6776
+ },{"./assert":37,"./is":40,"moment-timezone":92}],35:[function(require,module,exports){
6595
6777
  'use strict';
6596
6778
 
6597
6779
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -6717,8 +6899,8 @@ module.exports = function () {
6717
6899
  unique: function unique(a) {
6718
6900
  assert.argumentIsArray(a, 'a');
6719
6901
 
6720
- return a.filter(function (item, index, array) {
6721
- return array.indexOf(item) === index;
6902
+ return this.uniqueBy(a, function (item) {
6903
+ return item;
6722
6904
  });
6723
6905
  },
6724
6906
 
@@ -6729,7 +6911,7 @@ module.exports = function () {
6729
6911
  *
6730
6912
  * @static
6731
6913
  * @param {Array} a
6732
- * @param {Function} keySelector - The function, when applied to an item yields a unique key.
6914
+ * @param {Function} keySelector - A function that returns a unique key for an item.
6733
6915
  * @returns {Array}
6734
6916
  */
6735
6917
  uniqueBy: function uniqueBy(a, keySelector) {
@@ -6747,12 +6929,12 @@ module.exports = function () {
6747
6929
 
6748
6930
  /**
6749
6931
  * Splits array into groups and returns an object (where the properties have
6750
- * arrays). Unlike the indexBy function, there can be many items
6751
- * which share the same key.
6932
+ * arrays). Unlike the indexBy function, there can be many items which share
6933
+ * the same key.
6752
6934
  *
6753
6935
  * @static
6754
6936
  * @param {Array} a
6755
- * @param {Function} keySelector - The function, when applied to an item yields a key.
6937
+ * @param {Function} keySelector - A function that returns a unique key for an item.
6756
6938
  * @returns {Object}
6757
6939
  */
6758
6940
  groupBy: function groupBy(a, keySelector) {
@@ -6779,7 +6961,7 @@ module.exports = function () {
6779
6961
  *
6780
6962
  * @static
6781
6963
  * @param {Array} a
6782
- * @param {Function} keySelector - The function, when applied to an item yields a key.
6964
+ * @param {Function} keySelector - A function that returns a unique key for an item.
6783
6965
  * @returns {Array}
6784
6966
  */
6785
6967
  batchBy: function batchBy(a, keySelector) {
@@ -6808,12 +6990,11 @@ module.exports = function () {
6808
6990
 
6809
6991
  /**
6810
6992
  * Splits array into groups and returns an object (where the properties are items from the
6811
- * original array). Unlike the groupBy, Only one item can have a given key
6812
- * value.
6993
+ * original array). Unlike the groupBy, only one item can have a given key value.
6813
6994
  *
6814
6995
  * @static
6815
6996
  * @param {Array} a
6816
- * @param {Function} keySelector - The function, when applied to an item yields a unique key.
6997
+ * @param {Function} keySelector - A function that returns a unique key for an item.
6817
6998
  * @returns {Object}
6818
6999
  */
6819
7000
  indexBy: function indexBy(a, keySelector) {
@@ -6979,14 +7160,31 @@ module.exports = function () {
6979
7160
  * @returns {Array}
6980
7161
  */
6981
7162
  difference: function difference(a, b) {
7163
+ return this.differenceBy(a, b, function (item) {
7164
+ return item;
7165
+ });
7166
+ },
7167
+
7168
+
7169
+ /**
7170
+ * Set difference operation, where the uniqueness is determined by a delegate.
7171
+ *
7172
+ * @static
7173
+ * @param {Array} a
7174
+ * @param {Array} b
7175
+ * @param {Function} keySelector - A function that returns a unique key for an item.
7176
+ * @returns {Array}
7177
+ */
7178
+ differenceBy: function differenceBy(a, b, keySelector) {
6982
7179
  assert.argumentIsArray(a, 'a');
6983
7180
  assert.argumentIsArray(b, 'b');
7181
+ assert.argumentIsRequired(keySelector, 'keySelector', Function);
6984
7182
 
6985
7183
  var returnRef = [];
6986
7184
 
6987
7185
  a.forEach(function (candidate) {
6988
7186
  var exclude = b.some(function (comparison) {
6989
- return candidate === comparison;
7187
+ return keySelector(candidate) === keySelector(comparison);
6990
7188
  });
6991
7189
 
6992
7190
  if (!exclude) {
@@ -7009,7 +7207,23 @@ module.exports = function () {
7009
7207
  * @returns {Array}
7010
7208
  */
7011
7209
  differenceSymmetric: function differenceSymmetric(a, b) {
7012
- return this.union(this.difference(a, b), this.difference(b, a));
7210
+ return this.differenceSymmetricBy(a, b, function (item) {
7211
+ return item;
7212
+ });
7213
+ },
7214
+
7215
+
7216
+ /**
7217
+ * Set symmetric difference operation, where the uniqueness is determined by a delegate.
7218
+ *
7219
+ * @static
7220
+ * @param {Array} a
7221
+ * @param {Array} b
7222
+ * @param {Function} keySelector - A function that returns a unique key for an item.
7223
+ * @returns {Array}
7224
+ */
7225
+ differenceSymmetricBy: function differenceSymmetricBy(a, b, keySelector) {
7226
+ return this.unionBy(this.differenceBy(a, b, keySelector), this.differenceBy(b, a, keySelector), keySelector);
7013
7227
  },
7014
7228
 
7015
7229
 
@@ -7022,14 +7236,31 @@ module.exports = function () {
7022
7236
  * @returns {Array}
7023
7237
  */
7024
7238
  union: function union(a, b) {
7239
+ return this.unionBy(a, b, function (item) {
7240
+ return item;
7241
+ });
7242
+ },
7243
+
7244
+
7245
+ /**
7246
+ * Set union operation, where the uniqueness is determined by a delegate.
7247
+ *
7248
+ * @static
7249
+ * @param {Array} a
7250
+ * @param {Array} b
7251
+ * @param {Function} keySelector - A function that returns a unique key for an item.
7252
+ * @returns {Array}
7253
+ */
7254
+ unionBy: function unionBy(a, b, keySelector) {
7025
7255
  assert.argumentIsArray(a, 'a');
7026
7256
  assert.argumentIsArray(b, 'b');
7257
+ assert.argumentIsRequired(keySelector, 'keySelector', Function);
7027
7258
 
7028
7259
  var returnRef = a.slice();
7029
7260
 
7030
7261
  b.forEach(function (candidate) {
7031
7262
  var exclude = returnRef.some(function (comparison) {
7032
- return candidate === comparison;
7263
+ return keySelector(candidate) === keySelector(comparison);
7033
7264
  });
7034
7265
 
7035
7266
  if (!exclude) {
@@ -7050,6 +7281,22 @@ module.exports = function () {
7050
7281
  * @returns {Array}
7051
7282
  */
7052
7283
  intersection: function intersection(a, b) {
7284
+ return this.intersectionBy(a, b, function (item) {
7285
+ return item;
7286
+ });
7287
+ },
7288
+
7289
+
7290
+ /**
7291
+ * Set intersection operation, where the uniqueness is determined by a delegate.
7292
+ *
7293
+ * @static
7294
+ * @param {Array} a
7295
+ * @param {Array} b
7296
+ * @param {Function} keySelector - A function that returns a unique key for an item.
7297
+ * @returns {Array}
7298
+ */
7299
+ intersectionBy: function intersectionBy(a, b, keySelector) {
7053
7300
  assert.argumentIsArray(a, 'a');
7054
7301
  assert.argumentIsArray(b, 'b');
7055
7302
 
@@ -7057,7 +7304,7 @@ module.exports = function () {
7057
7304
 
7058
7305
  a.forEach(function (candidate) {
7059
7306
  var include = b.some(function (comparison) {
7060
- return candidate === comparison;
7307
+ return keySelector(candidate) === comparison;
7061
7308
  });
7062
7309
 
7063
7310
  if (include) {
@@ -7076,16 +7323,20 @@ module.exports = function () {
7076
7323
  * @public
7077
7324
  * @param {Array} a
7078
7325
  * @param {Function} predicate
7326
+ * @returns {Boolean}
7079
7327
  */
7080
7328
  remove: function remove(a, predicate) {
7081
7329
  assert.argumentIsArray(a, 'a');
7082
7330
  assert.argumentIsRequired(predicate, 'predicate', Function);
7083
7331
 
7084
7332
  var index = a.findIndex(predicate);
7333
+ var found = !(index < 0);
7085
7334
 
7086
- if (!(index < 0)) {
7335
+ if (found) {
7087
7336
  a.splice(index, 1);
7088
7337
  }
7338
+
7339
+ return found;
7089
7340
  }
7090
7341
  };
7091
7342
  }();
@@ -7195,7 +7446,7 @@ module.exports = function () {
7195
7446
 
7196
7447
  if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
7197
7448
  itemValidator = function itemValidator(value, index) {
7198
- return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
7449
+ return itemConstraint.prototype !== undefined && value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
7199
7450
  };
7200
7451
  } else {
7201
7452
  itemValidator = function itemValidator(value, index) {
@@ -7305,7 +7556,7 @@ module.exports = function () {
7305
7556
  *
7306
7557
  * @static
7307
7558
  * @param {Object} target - The object to check for existence of the property.
7308
- * @param {String|Array<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
7559
+ * @param {String|Array.<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
7309
7560
  * @param {String=} separator - The separator (defaults to a period character).
7310
7561
  * @returns {boolean}
7311
7562
  */
@@ -7331,7 +7582,7 @@ module.exports = function () {
7331
7582
  *
7332
7583
  * @static
7333
7584
  * @param {Object} target - The object to read from.
7334
- * @param {String|Array<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
7585
+ * @param {String|Array.<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
7335
7586
  * @param {String=} separator - The separator (defaults to a period character).
7336
7587
  * @returns {*}
7337
7588
  */
@@ -7366,7 +7617,8 @@ module.exports = function () {
7366
7617
  *
7367
7618
  * @static
7368
7619
  * @param {Object} target - The object to write to.
7369
- * @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
7620
+ * @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
7621
+ * @param {*} value - The value to assign.
7370
7622
  * @param {String=} separator - The separator (defaults to a period character).
7371
7623
  */
7372
7624
  write: function write(target, propertyNames, value, separator) {
@@ -7392,7 +7644,7 @@ module.exports = function () {
7392
7644
  *
7393
7645
  * @static
7394
7646
  * @param {Object} target - The object to erase a property from.
7395
- * @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
7647
+ * @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
7396
7648
  * @param {String=} separator - The separator (defaults to a period character).
7397
7649
  */
7398
7650
  erase: function erase(target, propertyNames, separator) {
@@ -7745,18 +7997,22 @@ module.exports = function () {
7745
7997
  *
7746
7998
  * @static
7747
7999
  * @param {Object} source - The object to copy.
8000
+ * @param {Function=} canExtract - An optional function which indicates if the "extractor" can be used.
8001
+ * @param {Function=} extractor - An optional function which returns a cloned value for a property for assignment to the cloned object.
7748
8002
  * @returns {Object}
7749
8003
  */
7750
- clone: function clone(source) {
8004
+ clone: function clone(source, canExtract, extractor) {
7751
8005
  var c = void 0;
7752
8006
 
7753
- if (is.array(source)) {
8007
+ if (is.fn(canExtract) && canExtract(source)) {
8008
+ c = extractor(source);
8009
+ } else if (is.array(source)) {
7754
8010
  c = source.map(function (sourceItem) {
7755
- return object.clone(sourceItem);
8011
+ return object.clone(sourceItem, canExtract, extractor);
7756
8012
  });
7757
8013
  } else if (is.object(source)) {
7758
8014
  c = object.keys(source).reduce(function (accumulator, key) {
7759
- accumulator[key] = object.clone(source[key]);
8015
+ accumulator[key] = object.clone(source[key], canExtract, extractor);
7760
8016
 
7761
8017
  return accumulator;
7762
8018
  }, {});
@@ -8074,7 +8330,7 @@ module.exports = function () {
8074
8330
  };
8075
8331
  }();
8076
8332
 
8077
- },{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":89}],44:[function(require,module,exports){
8333
+ },{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":90}],44:[function(require,module,exports){
8078
8334
  'use strict';
8079
8335
 
8080
8336
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -8550,7 +8806,7 @@ module.exports = function () {
8550
8806
  return DataType;
8551
8807
  }();
8552
8808
 
8553
- },{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":93}],46:[function(require,module,exports){
8809
+ },{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":94}],46:[function(require,module,exports){
8554
8810
  'use strict';
8555
8811
 
8556
8812
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -8732,7 +8988,7 @@ module.exports = function () {
8732
8988
  }
8733
8989
 
8734
8990
  /**
8735
- * Generates a function suitable for use by JSON.parse.
8991
+ * Generates a function suitable for use by {@link JSON.parse}.
8736
8992
  *
8737
8993
  * @public
8738
8994
  * @returns {Function}
@@ -9483,6 +9739,8 @@ module.exports = function () {
9483
9739
  }();
9484
9740
 
9485
9741
  },{"./../lang/Disposable":31,"./../lang/assert":37,"./../lang/is":40,"./../lang/object":41,"./../lang/promise":42}],51:[function(require,module,exports){
9742
+ const uuid = require('uuid');
9743
+
9486
9744
  const assert = require('@barchart/common-js/lang/assert'),
9487
9745
  Enum = require('@barchart/common-js/lang/Enum');
9488
9746
 
@@ -9498,26 +9756,48 @@ module.exports = (() => {
9498
9756
  * @param {String} alternateDescription
9499
9757
  * @param {String} code
9500
9758
  * @param {Boolean} canReinvest
9759
+ * @param {Boolean} canShort
9760
+ * @param {Boolean} canSwitchDirection
9501
9761
  * @param {Boolean} usesSymbols
9762
+ * @param {Boolean} hasCorporateActions
9763
+ * @param {Boolean} closeFractional
9764
+ * @param {Boolean} roundQuantity
9765
+ * @param {Boolean} strictOrdering
9766
+ * @param {Function} generator
9502
9767
  */
9503
9768
  class InstrumentType extends Enum {
9504
- constructor(code, description, alternateDescription, canReinvest, usesSymbols) {
9769
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, strictOrdering, generator) {
9505
9770
  super(code, description);
9506
9771
 
9507
9772
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
9508
9773
  assert.argumentIsRequired(canReinvest, 'canReinvest', Boolean);
9774
+ assert.argumentIsRequired(canShort, 'canShort', Boolean);
9775
+ assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
9509
9776
  assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
9777
+ assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
9778
+ assert.argumentIsRequired(closeFractional, 'closeFractional', Boolean);
9779
+ assert.argumentIsRequired(roundQuantity, 'roundQuantity', Boolean);
9780
+ assert.argumentIsRequired(roundQuantity, 'strictOrdering', Boolean);
9781
+ assert.argumentIsRequired(generator, 'generator', Function);
9510
9782
 
9511
9783
  this._alternateDescription = alternateDescription;
9512
9784
  this._canReinvest = canReinvest;
9785
+ this._canShort = canShort;
9786
+ this._canSwitchDirection = canSwitchDirection;
9513
9787
  this._usesSymbols = usesSymbols;
9788
+ this._hasCorporateActions = hasCorporateActions;
9789
+ this._closeFractional = closeFractional;
9790
+ this._roundQuantity = roundQuantity;
9791
+ this._strictOrdering = strictOrdering;
9792
+
9793
+ this._generator = generator;
9514
9794
  }
9515
9795
 
9516
9796
  /**
9517
9797
  * A human-readable description.
9518
9798
  *
9519
9799
  * @public
9520
- * @return {String}
9800
+ * @returns {String}
9521
9801
  */
9522
9802
  get alternateDescription() {
9523
9803
  return this._alternateDescription;
@@ -9533,6 +9813,27 @@ module.exports = (() => {
9533
9813
  return this._canReinvest;
9534
9814
  }
9535
9815
 
9816
+ /**
9817
+ * Indicates if short-selling is possible for this instrument type.
9818
+ *
9819
+ * @public
9820
+ * @returns {Boolean}
9821
+ */
9822
+ get canShort() {
9823
+ return this._canShort;
9824
+ }
9825
+
9826
+ /**
9827
+ * Indicates if one transaction is allowed to switch a position size from
9828
+ * positive to negative (or vice versa).
9829
+ *
9830
+ * @public
9831
+ * @returns {Boolean}
9832
+ */
9833
+ get canSwitchDirection() {
9834
+ return this._canSwitchDirection;
9835
+ }
9836
+
9536
9837
  /**
9537
9838
  * Indicates if an instrument of this type can be represented by a symbol.
9538
9839
  *
@@ -9543,6 +9844,65 @@ module.exports = (() => {
9543
9844
  return this._usesSymbols;
9544
9845
  }
9545
9846
 
9847
+ /**
9848
+ * Indicates if corporate actions are possible for this type of instrument.
9849
+ *
9850
+ * @public
9851
+ * @returns {Boolean}
9852
+ */
9853
+ get hasCorporateActions() {
9854
+ return this._hasCorporateActions;
9855
+ }
9856
+
9857
+ /**
9858
+ * Indicates if fractional shares should be closed when the position
9859
+ * size is less than one (or some of the fractional shares are closed).
9860
+ *
9861
+ * @public
9862
+ * @returns {Boolean}
9863
+ */
9864
+ get closeFractional() {
9865
+ return this._closeFractional;
9866
+ }
9867
+
9868
+ /**
9869
+ * Indicates if transaction sequences must be honored before calculating position
9870
+ * totals.
9871
+ *
9872
+ * @public
9873
+ * @returns {Boolean}
9874
+ */
9875
+ get strictOrdering() {
9876
+ return this._strictOrdering;
9877
+ }
9878
+
9879
+ /**
9880
+ * Indicates transaction quantities should be rounded.
9881
+ *
9882
+ * @public
9883
+ * @returns {Boolean}
9884
+ */
9885
+ get roundQuantity() {
9886
+ return this._roundQuantity;
9887
+ }
9888
+
9889
+ /**
9890
+ * Generates an identifier for the instrument.
9891
+ *
9892
+ * @public
9893
+ * @param {Object} instrument
9894
+ * @returns {String}
9895
+ */
9896
+ generateIdentifier(instrument) {
9897
+ assert.argumentIsRequired(instrument, 'instrument');
9898
+
9899
+ if (instrument.type !== this) {
9900
+ throw new Error('Unable to generate instrument identifier for incompatible type.');
9901
+ }
9902
+
9903
+ return this._generator(instrument);
9904
+ }
9905
+
9546
9906
  /**
9547
9907
  * Cash.
9548
9908
  *
@@ -9587,26 +9947,193 @@ module.exports = (() => {
9587
9947
  return other;
9588
9948
  }
9589
9949
 
9950
+ /**
9951
+ * Generates an identifier for the instrument.
9952
+ *
9953
+ * @public
9954
+ * @static
9955
+ * @param {Object} instrument
9956
+ * @returns {String}
9957
+ */
9958
+ static generateIdentifier(instrument) {
9959
+ return map[instrument.type.code].generateIdentifier(instrument);
9960
+ }
9961
+
9962
+ /**
9963
+ *
9964
+ * @public
9965
+ * @static
9966
+ * @param code
9967
+ * @returns {InstrumentType}
9968
+ */
9969
+ static fromSymbolType(code) {
9970
+ assert.argumentIsRequired(code, 'code', Number);
9971
+
9972
+ if (code === 1 || code === 6 || code === 7 || code === 11) {
9973
+ return InstrumentType.EQUITY;
9974
+ } else if (code === 5 || code == 15) {
9975
+ return InstrumentType.FUND;
9976
+ } else {
9977
+ throw new Error(`Unable to determine InstrumentType for [ ${code} ]`);
9978
+ }
9979
+ }
9980
+
9590
9981
  toString() {
9591
9982
  return '[InstrumentType]';
9592
9983
  }
9593
9984
  }
9594
9985
 
9595
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false);
9596
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true);
9597
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, true);
9598
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false);
9986
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
9987
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
9988
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
9989
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
9990
+
9991
+ const map = { };
9992
+
9993
+ map[cash.code] = cash;
9994
+ map[equity.code] = equity;
9995
+ map[fund.code] = fund;
9996
+ map[other.code] = other;
9599
9997
 
9600
9998
  return InstrumentType;
9601
9999
  })();
9602
10000
 
9603
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],52:[function(require,module,exports){
10001
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"uuid":95}],52:[function(require,module,exports){
10002
+ const assert = require('@barchart/common-js/lang/assert'),
10003
+ Decimal = require('@barchart/common-js/lang/Decimal'),
10004
+ Enum = require('@barchart/common-js/lang/Enum');
10005
+
10006
+ module.exports = (() => {
10007
+ 'use strict';
10008
+
10009
+ /**
10010
+ * Describes a position size -- positive values are long, negative values
10011
+ * are short and zero values are even.
10012
+ *
10013
+ * @public
10014
+ * @extends {Enum}
10015
+ * @param {String} code
10016
+ * @param {String} description
10017
+ * @param {sign} sign
10018
+ */
10019
+ class PositionDirection extends Enum {
10020
+ constructor(code, description, sign) {
10021
+ super(code, description);
10022
+
10023
+ assert.argumentIsRequired(sign, 'sign', String);
10024
+
10025
+ this._sign = sign;
10026
+ }
10027
+
10028
+ /**
10029
+ * A description of the positiveness or negativeness of the size of the
10030
+ * position.
10031
+ *
10032
+ * @public
10033
+ * @returns {String}
10034
+ */
10035
+ get sign() {
10036
+ return this._sign;
10037
+ }
10038
+
10039
+ /**
10040
+ * Indicates if the position size is positive (i.e. is {@link PositionDirection.LONG}).
10041
+ *
10042
+ * @public
10043
+ * @returns {boolean}
10044
+ */
10045
+ get positive() {
10046
+ return this === long;
10047
+ }
10048
+
10049
+ /**
10050
+ * Indicates if the position size is negative (i.e. is {@link PositionDirection.SHORT}).
10051
+ *
10052
+ * @public
10053
+ * @returns {boolean}
10054
+ */
10055
+ get negative() {
10056
+ return this === short;
10057
+ }
10058
+
10059
+ /**
10060
+ * Indicates if the position size is zero (i.e. is {@link PositionDirection.EVEN}).
10061
+ *
10062
+ * @public
10063
+ * @returns {boolean}
10064
+ */
10065
+ get closed() {
10066
+ return this === even;
10067
+ }
10068
+
10069
+ /**
10070
+ * A positive quantity position.
10071
+ *
10072
+ * @public
10073
+ * @static
10074
+ * @returns {PositionDirection}
10075
+ */
10076
+ static get LONG() {
10077
+ return long;
10078
+ }
10079
+
10080
+ /**
10081
+ * A positive quantity position.
10082
+ *
10083
+ * @public
10084
+ * @static
10085
+ * @returns {PositionDirection}
10086
+ */
10087
+ static get SHORT() {
10088
+ return short;
10089
+ }
10090
+
10091
+ /**
10092
+ * A zero quantity position.
10093
+ *
10094
+ * @public
10095
+ * @static
10096
+ * @returns {PositionDirection}
10097
+ */
10098
+ static get EVEN() {
10099
+ return even;
10100
+ }
10101
+
10102
+ /**
10103
+ * Given an open quantity, returns a {@link PositionDirection} that
10104
+ * describes the quantity.
10105
+ *
10106
+ * @public
10107
+ * @static
10108
+ * @param {Decimal} open
10109
+ * @returns {PositionDirection}
10110
+ */
10111
+ static for(open) {
10112
+ assert.argumentIsRequired(open, 'open', Decimal, 'Decimal');
10113
+
10114
+ if (open.getIsPositive()) {
10115
+ return long;
10116
+ } else if (open.getIsNegative()) {
10117
+ return short;
10118
+ } else {
10119
+ return even;
10120
+ }
10121
+ }
10122
+ }
10123
+
10124
+ const long = new PositionDirection('LONG', 'Long', 'positive');
10125
+ const short = new PositionDirection('SHORT', 'Short', 'negative');
10126
+ const even = new PositionDirection('EVEN', 'Even', 'zero');
10127
+
10128
+ return PositionDirection;
10129
+ })();
10130
+
10131
+ },{"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],53:[function(require,module,exports){
9604
10132
  const array = require('@barchart/common-js/lang/array'),
9605
10133
  assert = require('@barchart/common-js/lang/assert'),
9606
10134
  Day = require('@barchart/common-js/lang/Day'),
9607
10135
  Decimal = require('@barchart/common-js/lang/Decimal'),
9608
- Enum = require('@barchart/common-js/lang/Enum'),
9609
- is = require('@barchart/common-js/lang/is');
10136
+ Enum = require('@barchart/common-js/lang/Enum');
9610
10137
 
9611
10138
  module.exports = (() => {
9612
10139
  'use strict';
@@ -9623,25 +10150,41 @@ module.exports = (() => {
9623
10150
  * @param {Function} descriptionCalculator
9624
10151
  */
9625
10152
  class PositionSummaryFrame extends Enum {
9626
- constructor(code, description, rangeCalculator, startDateCalculator, descriptionCalculator) {
10153
+ constructor(code, description, unique, rangeCalculator, startDateCalculator, descriptionCalculator) {
9627
10154
  super(code, description);
9628
10155
 
10156
+ assert.argumentIsRequired(unique, 'unique', Boolean);
10157
+
9629
10158
  assert.argumentIsRequired(rangeCalculator, 'rangeCalculator', Function);
9630
10159
  assert.argumentIsRequired(startDateCalculator, 'startDateCalculator', Function);
9631
10160
  assert.argumentIsRequired(descriptionCalculator, 'descriptionCalculator', Function);
9632
10161
 
10162
+ this._unique = unique;
10163
+
9633
10164
  this._rangeCalculator = rangeCalculator;
9634
10165
  this._startDateCalculator = startDateCalculator;
9635
10166
  this._descriptionCalculator = descriptionCalculator;
9636
10167
  }
9637
10168
 
10169
+ /**
10170
+ * If true, only one summary, of the given type, can exist for a
10171
+ * position. If false, multiple summaries, of the given type, can
10172
+ * exist for a position.
10173
+ *
10174
+ * @public
10175
+ * @returns {Boolean}
10176
+ */
10177
+ get unique() {
10178
+ return this._unique;
10179
+ }
10180
+
9638
10181
  /**
9639
10182
  * Returns a human-readable description of the frame, given
9640
10183
  * start and end dates.
9641
10184
  *
9642
10185
  * @public
9643
- * @return {PositionSummaryRange} range
9644
- * @return {String}
10186
+ * @returns {PositionSummaryRange} range
10187
+ * @returns {String}
9645
10188
  */
9646
10189
  describeRange(range) {
9647
10190
  return this._descriptionCalculator(range.start, range.end);
@@ -9732,10 +10275,10 @@ module.exports = (() => {
9732
10275
  }
9733
10276
  }
9734
10277
 
9735
- const yearly = new PositionSummaryFrame('YEARLY', 'year', getYearlyRanges, getYearlyStartDate, getYearlyRangeDescription);
9736
- const quarterly = new PositionSummaryFrame('QUARTER', 'quarter', getQuarterlyRanges, getQuarterlyStartDate, getQuarterlyRangeDescription);
9737
- const monthly = new PositionSummaryFrame('MONTH', 'month', getMonthlyRanges, getMonthlyStartDate, getMonthlyRangeDescription);
9738
- const ytd = new PositionSummaryFrame('YTD', 'year-to-date', getYearToDateRanges, getYearToDateStartDate, getYearToDateRangeDescription);
10278
+ const yearly = new PositionSummaryFrame('YEARLY', 'year', false, getYearlyRanges, getYearlyStartDate, getYearlyRangeDescription);
10279
+ const quarterly = new PositionSummaryFrame('QUARTER', 'quarter', false, getQuarterlyRanges, getQuarterlyStartDate, getQuarterlyRangeDescription);
10280
+ const monthly = new PositionSummaryFrame('MONTH', 'month', false, getMonthlyRanges, getMonthlyStartDate, getMonthlyRangeDescription);
10281
+ const ytd = new PositionSummaryFrame('YTD', 'year-to-date', true, getYearToDateRanges, getYearToDateStartDate, getYearToDateRangeDescription);
9739
10282
 
9740
10283
  /**
9741
10284
  * The start and and date for a {@link PositionSummaryFrame}
@@ -9857,7 +10400,7 @@ module.exports = (() => {
9857
10400
  return PositionSummaryFrame;
9858
10401
  })();
9859
10402
 
9860
- },{"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/array":36,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40}],53:[function(require,module,exports){
10403
+ },{"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Decimal":30,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/array":36,"@barchart/common-js/lang/assert":37}],54:[function(require,module,exports){
9861
10404
  const assert = require('@barchart/common-js/lang/assert'),
9862
10405
  Enum = require('@barchart/common-js/lang/Enum');
9863
10406
 
@@ -9872,29 +10415,45 @@ module.exports = (() => {
9872
10415
  * @param {String} code
9873
10416
  * @param {String} description
9874
10417
  * @param {String} display
10418
+ * @param {Number} sequence
9875
10419
  * @param {Boolean} purchase
9876
10420
  * @param {Boolean} sale
9877
10421
  * @param {Boolean} income
9878
10422
  * @param {Boolean} opening
9879
10423
  * @param {Boolean} closing
9880
- */
10424
+ * @param {Boolean} fee
10425
+ * @param {Boolean} corporateAction
10426
+ * @param {Boolean} initial
10427
+ * @param {Boolean} significant
10428
+ * @param {Boolean} eod
10429
+ */
9881
10430
  class TransactionType extends Enum {
9882
- constructor(code, description, display, purchase, sale, income, opening, closing) {
10431
+ constructor(code, description, display, sequence, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
9883
10432
  super(code, description);
9884
10433
 
9885
10434
  assert.argumentIsRequired(display, 'display', String);
10435
+ assert.argumentIsRequired(sequence, 'sequence', Number);
9886
10436
  assert.argumentIsRequired(purchase, 'purchase', Boolean);
9887
10437
  assert.argumentIsRequired(sale, 'sale', Boolean);
9888
10438
  assert.argumentIsRequired(income, 'income', Boolean);
9889
10439
  assert.argumentIsRequired(opening, 'opening', Boolean);
9890
10440
  assert.argumentIsRequired(closing, 'closing', Boolean);
10441
+ assert.argumentIsRequired(fee, 'fee', Boolean);
10442
+ assert.argumentIsRequired(corporateAction, 'corporateAction', Boolean);
10443
+ assert.argumentIsRequired(initial, 'initial', Boolean);
10444
+ assert.argumentIsRequired(significant, 'significant', Boolean);
9891
10445
 
9892
10446
  this._display = display;
10447
+ this._sequence = sequence;
9893
10448
  this._purchase = purchase;
9894
10449
  this._sale = sale;
9895
10450
  this._income = income;
9896
10451
  this._opening = opening;
9897
10452
  this._closing = closing;
10453
+ this._fee = fee;
10454
+ this._corporateAction = corporateAction;
10455
+ this._initial = initial;
10456
+ this._significant = significant;
9898
10457
  }
9899
10458
 
9900
10459
  /**
@@ -9907,6 +10466,17 @@ module.exports = (() => {
9907
10466
  return this._display;
9908
10467
  }
9909
10468
 
10469
+ /**
10470
+ * Specifies ordering when multiple transactions occur on the same day, for
10471
+ * the same position.
10472
+ *
10473
+ * @public
10474
+ * @returns {Number}
10475
+ */
10476
+ get sequence() {
10477
+ return this._sequence;
10478
+ }
10479
+
9910
10480
  /**
9911
10481
  * Indicates if the transaction was a trade.
9912
10482
  *
@@ -9918,7 +10488,7 @@ module.exports = (() => {
9918
10488
  }
9919
10489
 
9920
10490
  /**
9921
- * Indicates if the trade was a purchase.
10491
+ * Indicates if the transaction was a purchase.
9922
10492
  *
9923
10493
  * @public
9924
10494
  * @returns {Boolean}
@@ -9928,7 +10498,7 @@ module.exports = (() => {
9928
10498
  }
9929
10499
 
9930
10500
  /**
9931
- * Indicates if the trade was a sale.
10501
+ * Indicates if the transaction was a sale.
9932
10502
  *
9933
10503
  * @public
9934
10504
  * @returns {Boolean}
@@ -9948,7 +10518,7 @@ module.exports = (() => {
9948
10518
  }
9949
10519
 
9950
10520
  /**
9951
- * Indicates if the transactions opens the position (i.e. increases its
10521
+ * Indicates if the transaction opens the position (i.e. increases its
9952
10522
  * magnitude).
9953
10523
  *
9954
10524
  * @public
@@ -9959,7 +10529,7 @@ module.exports = (() => {
9959
10529
  }
9960
10530
 
9961
10531
  /**
9962
- * Indicates if the transactions closes the position (i.e. decreases its
10532
+ * Indicates if the transaction closes the position (i.e. decreases its
9963
10533
  * magnitude).
9964
10534
  *
9965
10535
  * @public
@@ -9969,6 +10539,47 @@ module.exports = (() => {
9969
10539
  return this._closing;
9970
10540
  }
9971
10541
 
10542
+ /**
10543
+ * Indicates if the transaction is a chart that neither opens nor
10544
+ * closes the position.
10545
+ *
10546
+ * @public
10547
+ * @returns {Boolean}
10548
+ */
10549
+ get fee() {
10550
+ return this._fee;
10551
+ }
10552
+
10553
+ /**
10554
+ * Indicates if the transaction is a corporate action.
10555
+ *
10556
+ * @public
10557
+ * @returns {Boolean}
10558
+ */
10559
+ get corporateAction() {
10560
+ return this._corporateAction;
10561
+ }
10562
+
10563
+ /**
10564
+ * Indicates if the transaction can be the first transaction for a position.
10565
+ *
10566
+ * @public
10567
+ * @returns {Boolean}
10568
+ */
10569
+ get initial() {
10570
+ return this._initial;
10571
+ }
10572
+
10573
+ /**
10574
+ * Significant transactions cannot be discarded during transaction re-write.
10575
+ *
10576
+ * @public
10577
+ * @returns {Boolean}
10578
+ */
10579
+ get significant() {
10580
+ return this._significant;
10581
+ }
10582
+
9972
10583
  /**
9973
10584
  * A purchase.
9974
10585
  *
@@ -10068,6 +10679,17 @@ module.exports = (() => {
10068
10679
  return distributionFund;
10069
10680
  }
10070
10681
 
10682
+ /**
10683
+ * A mutual fund distribution in cash, reinvested.
10684
+ *
10685
+ * @public
10686
+ * @static
10687
+ * @returns {TransactionType}
10688
+ */
10689
+ static get DISTRIBUTION_REINVEST() {
10690
+ return distributionReinvest;
10691
+ }
10692
+
10071
10693
  /**
10072
10694
  * A split.
10073
10695
  *
@@ -10172,34 +10794,34 @@ module.exports = (() => {
10172
10794
  }
10173
10795
  }
10174
10796
 
10175
- const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false);
10176
- const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true);
10177
- const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true);
10178
- const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false);
10179
- const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false);
10180
- const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false);
10181
- const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false);
10182
- const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false);
10183
- const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, true, false);
10184
- const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, false);
10185
-
10186
- const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false);
10187
- const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false);
10188
-
10189
- const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false);
10190
- const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false);
10191
- const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false);
10192
- const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false);
10193
-
10194
- const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false);
10195
- const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false);
10797
+ const buy = new TransactionType('B', 'Buy', 'Buy', 0, true, false, false, true, false, false, false, true, true);
10798
+ const sell = new TransactionType('S', 'Sell', 'Sell', 0, false, true, false, false, true, false, false, false, true);
10799
+ const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', 0, true, false, false, false, true, false, false, false, true);
10800
+ const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', 0, false, true, false, true, false, false, false, true, true);
10801
+ const dividend = new TransactionType('DV', 'Dividend', 'Dividend', 1, false, false, true, false, false, false, true, false, false);
10802
+ const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', 1, false, false, false, true, false, false, true, false, false);
10803
+ const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', 1, false, false, false, true, false, false, true, false, false);
10804
+ const split = new TransactionType('SP', 'Split', 'Split', 1, false, false, false, true, false, false, true, false, false);
10805
+ const fee = new TransactionType('F', 'Fee', 'Fee', 0, false, false, false, false, false, true, false, false, false);
10806
+ const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', 0, false, false, false, false, true, false, false, false, false);
10807
+
10808
+ const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', 1, false, false, true, false, false, false, true, false, false);
10809
+ const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', 1, false, false, false, true, false, false, true, false, false);
10810
+ const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', 1, false, false, false, true, false, false, true, false, false);
10811
+
10812
+ const deposit = new TransactionType('D', 'Deposit', 'Deposit', 0, false, false, false, false, false, false, false, true, true);
10813
+ const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', 0, false, false, false, false, false, false, false, true, true);
10814
+ const debit = new TransactionType('DR', 'Debit', 'Debit', 0, false, false, false, false, false, false, false, true, true);
10815
+ const credit = new TransactionType('CR', 'Credit', 'Credit', 0, false, false, false, false, false, false, false, true, true);
10816
+
10817
+ const valuation = new TransactionType('V', 'Valuation', 'Valuation', 0, false, false, false, false, false, false, false, false, false);
10818
+ const income = new TransactionType('I', 'Income', 'Income', 0, false, false, true, false, false, false, false, false, false);
10196
10819
 
10197
10820
  return TransactionType;
10198
10821
  })();
10199
10822
 
10200
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],54:[function(require,module,exports){
10201
- const assert = require('@barchart/common-js/lang/assert'),
10202
- Enum = require('@barchart/common-js/lang/Enum');
10823
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
10824
+ const Enum = require('@barchart/common-js/lang/Enum');
10203
10825
 
10204
10826
  module.exports = (() => {
10205
10827
  'use strict';
@@ -10259,12 +10881,10 @@ module.exports = (() => {
10259
10881
  return ValuationType;
10260
10882
  })();
10261
10883
 
10262
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
10263
- const assert = require('@barchart/common-js/lang/assert'),
10264
- Currency = require('@barchart/common-js/lang/Currency'),
10884
+ },{"@barchart/common-js/lang/Enum":32}],56:[function(require,module,exports){
10885
+ const Currency = require('@barchart/common-js/lang/Currency'),
10265
10886
  DataType = require('@barchart/common-js/serialization/json/DataType'),
10266
10887
  Enum = require('@barchart/common-js/lang/Enum'),
10267
- is = require('@barchart/common-js/lang/is'),
10268
10888
  Schema = require('@barchart/common-js/serialization/json/Schema'),
10269
10889
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder'),
10270
10890
  Timezones = require('@barchart/common-js/lang/Timezones');
@@ -10363,7 +10983,7 @@ module.exports = (() => {
10363
10983
  .withField('name', DataType.STRING)
10364
10984
  .withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
10365
10985
  .withField('dates.create', DataType.DAY)
10366
- .withField('dates.cash', DataType.DAY, true)
10986
+ .withField('defaults.cash', DataType.BOOLEAN, true)
10367
10987
  .withField('defaults.currency', DataType.forEnum(Currency, 'Currency'))
10368
10988
  .withField('defaults.reinvest', DataType.BOOLEAN, true)
10369
10989
  .withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'))
@@ -10385,7 +11005,7 @@ module.exports = (() => {
10385
11005
  .withField('name', DataType.STRING)
10386
11006
  .withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
10387
11007
  .withField('dates.create', DataType.DAY)
10388
- .withField('dates.cash', DataType.DAY, true)
11008
+ .withField('defaults.cash', DataType.BOOLEAN, true)
10389
11009
  .withField('defaults.currency', DataType.forEnum(Currency, 'Currency'))
10390
11010
  .withField('defaults.reinvest', DataType.BOOLEAN, true)
10391
11011
  .withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'))
@@ -10408,7 +11028,7 @@ module.exports = (() => {
10408
11028
  const create = new PortfolioSchema(SchemaBuilder.withName('create')
10409
11029
  .withField('name', DataType.STRING)
10410
11030
  .withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
10411
- .withField('dates.cash', DataType.DAY, true)
11031
+ .withField('defaults.cash', DataType.BOOLEAN, true)
10412
11032
  .withField('defaults.currency', DataType.forEnum(Currency, 'Currency'), true)
10413
11033
  .withField('defaults.reinvest', DataType.BOOLEAN, true)
10414
11034
  .withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'), true)
@@ -10420,6 +11040,7 @@ module.exports = (() => {
10420
11040
  .withField('portfolio', DataType.STRING)
10421
11041
  .withField('name', DataType.STRING)
10422
11042
  .withField('timezone', DataType.forEnum(Timezones, 'Timezone'), true)
11043
+ .withField('defaults.cash', DataType.BOOLEAN, true)
10423
11044
  .withField('defaults.currency', DataType.forEnum(Currency, 'Currency'), true)
10424
11045
  .withField('defaults.reinvest', DataType.BOOLEAN, true)
10425
11046
  .withField('miscellany', DataType.AD_HOC, true)
@@ -10429,16 +11050,15 @@ module.exports = (() => {
10429
11050
  return PortfolioSchema;
10430
11051
  })();
10431
11052
 
10432
- },{"./../data/ValuationType":54,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/Timezones":35,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],56:[function(require,module,exports){
10433
- const assert = require('@barchart/common-js/lang/assert'),
10434
- Currency = require('@barchart/common-js/lang/Currency'),
11053
+ },{"./../data/ValuationType":55,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/Timezones":35,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],57:[function(require,module,exports){
11054
+ const Currency = require('@barchart/common-js/lang/Currency'),
10435
11055
  DataType = require('@barchart/common-js/serialization/json/DataType'),
10436
11056
  Enum = require('@barchart/common-js/lang/Enum'),
10437
- is = require('@barchart/common-js/lang/is'),
10438
11057
  Schema = require('@barchart/common-js/serialization/json/Schema'),
10439
11058
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10440
11059
 
10441
11060
  const InstrumentType = require('./../data/InstrumentType'),
11061
+ PositionDirection = require('./../data/PositionDirection'),
10442
11062
  ValuationType = require('./../data/ValuationType');
10443
11063
 
10444
11064
  module.exports = (() => {
@@ -10489,6 +11109,17 @@ module.exports = (() => {
10489
11109
  return client;
10490
11110
  }
10491
11111
 
11112
+ /**
11113
+ * Data required to update a position.
11114
+ *
11115
+ * @static
11116
+ * @public
11117
+ * @returns {PositionSchema}
11118
+ */
11119
+ static get UPDATE() {
11120
+ return update;
11121
+ }
11122
+
10492
11123
  toString() {
10493
11124
  return '[PositionSchema]';
10494
11125
  }
@@ -10507,10 +11138,12 @@ module.exports = (() => {
10507
11138
  .withField('position', DataType.STRING)
10508
11139
  .withField('open', DataType.BOOLEAN, true)
10509
11140
  .withField('transaction', DataType.NUMBER)
11141
+ .withField('cash', DataType.BOOLEAN, true)
11142
+ .withField('reinvest', DataType.BOOLEAN, true)
10510
11143
  .withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
10511
- .withField('reinvest', DataType.BOOLEAN)
10512
11144
  .withField('snapshot.date', DataType.DAY)
10513
11145
  .withField('snapshot.open', DataType.DECIMAL)
11146
+ .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10514
11147
  .withField('snapshot.buys', DataType.DECIMAL)
10515
11148
  .withField('snapshot.sells', DataType.DECIMAL)
10516
11149
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10522,6 +11155,7 @@ module.exports = (() => {
10522
11155
  .withField('legacy.portfolio', DataType.STRING, true)
10523
11156
  .withField('legacy.position', DataType.STRING, true)
10524
11157
  .withField('system.version', DataType.NUMBER, true)
11158
+ .withField('root', DataType.STRING, true)
10525
11159
  .schema
10526
11160
  );
10527
11161
 
@@ -10538,10 +11172,12 @@ module.exports = (() => {
10538
11172
  .withField('position', DataType.STRING)
10539
11173
  .withField('open', DataType.BOOLEAN, true)
10540
11174
  .withField('transaction', DataType.NUMBER)
11175
+ .withField('cash', DataType.BOOLEAN, true)
11176
+ .withField('reinvest', DataType.BOOLEAN, true)
10541
11177
  .withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
10542
- .withField('reinvest', DataType.BOOLEAN)
10543
11178
  .withField('snapshot.date', DataType.DAY)
10544
11179
  .withField('snapshot.open', DataType.DECIMAL)
11180
+ .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10545
11181
  .withField('snapshot.buys', DataType.DECIMAL)
10546
11182
  .withField('snapshot.sells', DataType.DECIMAL)
10547
11183
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10552,19 +11188,31 @@ module.exports = (() => {
10552
11188
  .schema
10553
11189
  );
10554
11190
 
11191
+ const update = new PositionSchema(SchemaBuilder.withName('update')
11192
+ .withField('portfolio', DataType.STRING)
11193
+ .withField('position', DataType.STRING)
11194
+ .withField('mapping.name', DataType.STRING, true)
11195
+ .withField('mapping.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
11196
+ .withField('mapping.currency', DataType.forEnum(Currency, 'Currency'), true)
11197
+ .withField('mapping.symbol.barchart', DataType.STRING, true)
11198
+ .withField('mapping.symbol.display', DataType.STRING, true)
11199
+ .withField('cash', DataType.BOOLEAN, true)
11200
+ .withField('reinvest', DataType.BOOLEAN, true)
11201
+ .schema
11202
+ );
11203
+
10555
11204
  return PositionSchema;
10556
11205
  })();
10557
11206
 
10558
- },{"./../data/InstrumentType":51,"./../data/ValuationType":54,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],57:[function(require,module,exports){
10559
- const assert = require('@barchart/common-js/lang/assert'),
10560
- Currency = require('@barchart/common-js/lang/Currency'),
11207
+ },{"./../data/InstrumentType":51,"./../data/PositionDirection":52,"./../data/ValuationType":55,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],58:[function(require,module,exports){
11208
+ const Currency = require('@barchart/common-js/lang/Currency'),
10561
11209
  DataType = require('@barchart/common-js/serialization/json/DataType'),
10562
11210
  Enum = require('@barchart/common-js/lang/Enum'),
10563
- is = require('@barchart/common-js/lang/is'),
10564
11211
  Schema = require('@barchart/common-js/serialization/json/Schema'),
10565
11212
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10566
11213
 
10567
- const PositionSummaryFrame = require('./../data/PositionSummaryFrame');
11214
+ const PositionDirection = require('./../data/PositionDirection'),
11215
+ PositionSummaryFrame = require('./../data/PositionSummaryFrame');
10568
11216
 
10569
11217
  module.exports = (() => {
10570
11218
  'use strict';
@@ -10623,22 +11271,17 @@ module.exports = (() => {
10623
11271
  .withField('user', DataType.STRING)
10624
11272
  .withField('portfolio', DataType.STRING)
10625
11273
  .withField('position', DataType.STRING)
10626
- .withField('instrument.id', DataType.STRING)
10627
- .withField('instrument.name', DataType.STRING)
10628
- .withField('instrument.type', DataType.STRING)
10629
- .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
10630
- .withField('instrument.delist', DataType.DAY, true)
10631
- .withField('instrument.symbol.barchart', DataType.STRING, true)
10632
- .withField('instrument.symbol.display', DataType.STRING, true)
10633
11274
  .withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
10634
11275
  .withField('start.date', DataType.DAY)
10635
11276
  .withField('start.sequence', DataType.NUMBER)
10636
11277
  .withField('start.open', DataType.DECIMAL)
11278
+ .withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10637
11279
  .withField('start.basis', DataType.DECIMAL)
10638
11280
  .withField('start.value', DataType.DECIMAL)
10639
11281
  .withField('end.date', DataType.DAY)
10640
11282
  .withField('end.sequence', DataType.NUMBER)
10641
11283
  .withField('end.open', DataType.DECIMAL)
11284
+ .withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10642
11285
  .withField('end.basis', DataType.DECIMAL)
10643
11286
  .withField('end.value', DataType.DECIMAL)
10644
11287
  .withField('period.buys', DataType.DECIMAL)
@@ -10655,22 +11298,17 @@ module.exports = (() => {
10655
11298
  .withField('user', DataType.STRING)
10656
11299
  .withField('portfolio', DataType.STRING)
10657
11300
  .withField('position', DataType.STRING)
10658
- .withField('instrument.id', DataType.STRING)
10659
- .withField('instrument.name', DataType.STRING)
10660
- .withField('instrument.type', DataType.STRING)
10661
- .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
10662
- .withField('instrument.delist', DataType.DAY, true)
10663
- .withField('instrument.symbol.barchart', DataType.STRING, true)
10664
- .withField('instrument.symbol.display', DataType.STRING, true)
10665
11301
  .withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
10666
11302
  .withField('start.date', DataType.DAY)
10667
11303
  .withField('start.sequence', DataType.NUMBER)
10668
11304
  .withField('start.open', DataType.DECIMAL)
11305
+ .withField('start.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10669
11306
  .withField('start.basis', DataType.DECIMAL)
10670
11307
  .withField('start.value', DataType.DECIMAL)
10671
11308
  .withField('end.date', DataType.DAY)
10672
11309
  .withField('end.sequence', DataType.NUMBER)
10673
11310
  .withField('end.open', DataType.DECIMAL)
11311
+ .withField('end.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10674
11312
  .withField('end.basis', DataType.DECIMAL)
10675
11313
  .withField('end.value', DataType.DECIMAL)
10676
11314
  .withField('period.buys', DataType.DECIMAL)
@@ -10684,9 +11322,8 @@ module.exports = (() => {
10684
11322
  return PositionSummarySchema;
10685
11323
  })();
10686
11324
 
10687
- },{"./../data/PositionSummaryFrame":52,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],58:[function(require,module,exports){
10688
- const assert = require('@barchart/common-js/lang/assert'),
10689
- is = require('@barchart/common-js/lang/is'),
11325
+ },{"./../data/PositionDirection":52,"./../data/PositionSummaryFrame":53,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],59:[function(require,module,exports){
11326
+ const is = require('@barchart/common-js/lang/is'),
10690
11327
  Currency = require('@barchart/common-js/lang/Currency'),
10691
11328
  DataType = require('@barchart/common-js/serialization/json/DataType'),
10692
11329
  Enum = require('@barchart/common-js/lang/Enum'),
@@ -10694,6 +11331,7 @@ const assert = require('@barchart/common-js/lang/assert'),
10694
11331
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
10695
11332
 
10696
11333
  const InstrumentType = require('./../data/InstrumentType'),
11334
+ PositionDirection = require('./../data/PositionDirection'),
10697
11335
  TransactionType = require('./../data/TransactionType');
10698
11336
 
10699
11337
  module.exports = (() => {
@@ -10789,38 +11427,6 @@ module.exports = (() => {
10789
11427
  return sellShort;
10790
11428
  }
10791
11429
 
10792
- static get DIVIDEND() {
10793
- return dividend;
10794
- }
10795
-
10796
- static get DIVIDEND_REINVEST() {
10797
- return dividendReinvest;
10798
- }
10799
-
10800
- static get DIVIDEND_STOCK() {
10801
- return dividendStock;
10802
- }
10803
-
10804
- static get DISTRIBUTION_CASH() {
10805
- return distributionCash;
10806
- }
10807
-
10808
- static get DISTRIBUTION_FUND() {
10809
- return distributionFund;
10810
- }
10811
-
10812
- static get SPLIT() {
10813
- return split;
10814
- }
10815
-
10816
- static get FEE() {
10817
- return fee;
10818
- }
10819
-
10820
- static get FEE_UNITS() {
10821
- return feeUnits;
10822
- }
10823
-
10824
11430
  static get DEPOSIT() {
10825
11431
  return deposit;
10826
11432
  }
@@ -10829,14 +11435,6 @@ module.exports = (() => {
10829
11435
  return withdrawal;
10830
11436
  }
10831
11437
 
10832
- static get DEBIT() {
10833
- return debit;
10834
- }
10835
-
10836
- static get CREDIT() {
10837
- return credit;
10838
- }
10839
-
10840
11438
  static get VALUATION() {
10841
11439
  return valuation;
10842
11440
  }
@@ -10863,6 +11461,7 @@ module.exports = (() => {
10863
11461
  .withField('reference.position', DataType.STRING, true)
10864
11462
  .withField('reference.sequence', DataType.NUMBER, true)
10865
11463
  .withField('snapshot.open', DataType.DECIMAL)
11464
+ .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10866
11465
  .withField('snapshot.buys', DataType.DECIMAL)
10867
11466
  .withField('snapshot.sells', DataType.DECIMAL)
10868
11467
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10886,6 +11485,7 @@ module.exports = (() => {
10886
11485
  .withField('split.reference', DataType.STRING, true)
10887
11486
  .withField('charge.amount', DataType.DECIMAL, true)
10888
11487
  .withField('income.amount', DataType.DECIMAL, true)
11488
+ .withField('valuation.rate', DataType.DECIMAL, true)
10889
11489
  .withField('valuation.value', DataType.DECIMAL, true)
10890
11490
  .withField('system.sequence', DataType.NUMBER)
10891
11491
  .withField('system.version', DataType.STRING)
@@ -10906,6 +11506,7 @@ module.exports = (() => {
10906
11506
  .withField('reference.position', DataType.STRING, true)
10907
11507
  .withField('reference.sequence', DataType.NUMBER, true)
10908
11508
  .withField('snapshot.open', DataType.DECIMAL)
11509
+ .withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
10909
11510
  .withField('snapshot.buys', DataType.DECIMAL)
10910
11511
  .withField('snapshot.sells', DataType.DECIMAL)
10911
11512
  .withField('snapshot.gain', DataType.DECIMAL)
@@ -10917,13 +11518,13 @@ module.exports = (() => {
10917
11518
  .withField('dividend.effective', DataType.DAY, true)
10918
11519
  .withField('dividend.price', DataType.DECIMAL, true)
10919
11520
  .withField('dividend.amount', DataType.DECIMAL, true)
10920
- .withField('dividend.reference', DataType.STRING, true)
10921
11521
  .withField('split.numerator', DataType.DECIMAL, true)
10922
11522
  .withField('split.denominator', DataType.DECIMAL, true)
10923
11523
  .withField('split.effective', DataType.DAY, true)
10924
11524
  .withField('split.reference', DataType.STRING, true)
10925
11525
  .withField('charge.amount', DataType.DECIMAL, true)
10926
11526
  .withField('income.amount', DataType.DECIMAL, true)
11527
+ .withField('valuation.rate', DataType.DECIMAL, true)
10927
11528
  .withField('valuation.value', DataType.DECIMAL, true)
10928
11529
  .schema
10929
11530
  );
@@ -10931,16 +11532,21 @@ module.exports = (() => {
10931
11532
  const buy = new TransactionSchema(SchemaBuilder.withName(TransactionType.BUY.code)
10932
11533
  .withField('portfolio', DataType.STRING)
10933
11534
  .withField('position', DataType.STRING)
11535
+ .withField('sequence', DataType.NUMBER, true)
10934
11536
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
10935
11537
  .withField('instrument.name', DataType.STRING, true)
11538
+ .withField('instrument.exchange', DataType.STRING, true)
11539
+ .withField('instrument.code', DataType.NUMBER, true)
10936
11540
  .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
10937
11541
  .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
10938
11542
  .withField('instrument.symbol.barchart', DataType.STRING, true)
10939
11543
  .withField('instrument.symbol.display', DataType.STRING, true)
10940
11544
  .withField('date', DataType.DAY)
10941
- .withField('price', DataType.DECIMAL)
11545
+ .withField('price', DataType.DECIMAL, true)
10942
11546
  .withField('quantity', DataType.DECIMAL)
10943
11547
  .withField('fee', DataType.DECIMAL, true)
11548
+ .withField('reinvest', DataType.BOOLEAN, true)
11549
+ .withField('cash', DataType.BOOLEAN, true)
10944
11550
  .withField('force', DataType.BOOLEAN, true)
10945
11551
  .schema
10946
11552
  );
@@ -10948,9 +11554,10 @@ module.exports = (() => {
10948
11554
  const sell = new TransactionSchema(SchemaBuilder.withName(TransactionType.SELL.code)
10949
11555
  .withField('portfolio', DataType.STRING)
10950
11556
  .withField('position', DataType.STRING)
11557
+ .withField('sequence', DataType.NUMBER, true)
10951
11558
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
10952
11559
  .withField('date', DataType.DAY)
10953
- .withField('price', DataType.DECIMAL)
11560
+ .withField('price', DataType.DECIMAL, true)
10954
11561
  .withField('quantity', DataType.DECIMAL)
10955
11562
  .withField('fee', DataType.DECIMAL, true)
10956
11563
  .withField('force', DataType.BOOLEAN, true)
@@ -10960,6 +11567,7 @@ module.exports = (() => {
10960
11567
  const buyShort = new TransactionSchema(SchemaBuilder.withName(TransactionType.BUY_SHORT.code)
10961
11568
  .withField('portfolio', DataType.STRING)
10962
11569
  .withField('position', DataType.STRING)
11570
+ .withField('sequence', DataType.NUMBER, true)
10963
11571
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
10964
11572
  .withField('date', DataType.DAY)
10965
11573
  .withField('price', DataType.DECIMAL)
@@ -10972,8 +11580,11 @@ module.exports = (() => {
10972
11580
  const sellShort = new TransactionSchema(SchemaBuilder.withName(TransactionType.SELL_SHORT.code)
10973
11581
  .withField('portfolio', DataType.STRING)
10974
11582
  .withField('position', DataType.STRING)
11583
+ .withField('sequence', DataType.NUMBER, true)
10975
11584
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
10976
11585
  .withField('instrument.name', DataType.STRING, true)
11586
+ .withField('instrument.exchange', DataType.STRING, true)
11587
+ .withField('instrument.code', DataType.NUMBER, true)
10977
11588
  .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
10978
11589
  .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
10979
11590
  .withField('instrument.symbol.barchart', DataType.STRING, true)
@@ -10982,82 +11593,8 @@ module.exports = (() => {
10982
11593
  .withField('price', DataType.DECIMAL)
10983
11594
  .withField('quantity', DataType.DECIMAL)
10984
11595
  .withField('fee', DataType.DECIMAL, true)
10985
- .withField('force', DataType.BOOLEAN, true)
10986
- .schema
10987
- );
10988
-
10989
- const dividend = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND.code)
10990
- .withField('portfolio', DataType.STRING)
10991
- .withField('position', DataType.STRING)
10992
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
10993
- .withField('date', DataType.DAY)
10994
- .withField('rate', DataType.DECIMAL)
10995
- .withField('effective', DataType.DAY)
10996
- .withField('fee', DataType.DECIMAL, true)
10997
- .withField('force', DataType.BOOLEAN, true)
10998
- .schema
10999
- );
11000
-
11001
- const dividendReinvest = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND_REINVEST.code)
11002
- .withField('portfolio', DataType.STRING)
11003
- .withField('position', DataType.STRING)
11004
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11005
- .withField('date', DataType.DAY)
11006
- .withField('rate', DataType.DECIMAL)
11007
- .withField('effective', DataType.DAY)
11008
- .withField('price', DataType.DECIMAL)
11009
- .withField('fee', DataType.DECIMAL, true)
11010
- .withField('force', DataType.BOOLEAN, true)
11011
- .schema
11012
- );
11013
-
11014
- const dividendStock = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND_STOCK.code)
11015
- .withField('portfolio', DataType.STRING)
11016
- .withField('position', DataType.STRING)
11017
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11018
- .withField('date', DataType.DAY)
11019
- .withField('rate', DataType.DECIMAL)
11020
- .withField('effective', DataType.DAY)
11021
- .withField('price', DataType.DECIMAL)
11022
- .withField('fee', DataType.DECIMAL, true)
11023
- .withField('force', DataType.BOOLEAN, true)
11024
- .schema
11025
- );
11026
-
11027
- const distributionCash = new TransactionSchema(SchemaBuilder.withName(TransactionType.DISTRIBUTION_CASH.code)
11028
- .withField('portfolio', DataType.STRING)
11029
- .withField('position', DataType.STRING)
11030
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11031
- .withField('date', DataType.DAY)
11032
- .withField('rate', DataType.DECIMAL)
11033
- .withField('effective', DataType.DAY)
11034
- .withField('fee', DataType.DECIMAL, true)
11035
- .withField('force', DataType.BOOLEAN, true)
11036
- .schema
11037
- );
11038
-
11039
- const distributionFund = new TransactionSchema(SchemaBuilder.withName(TransactionType.DISTRIBUTION_FUND.code)
11040
- .withField('portfolio', DataType.STRING)
11041
- .withField('position', DataType.STRING)
11042
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11043
- .withField('date', DataType.DAY)
11044
- .withField('rate', DataType.DECIMAL)
11045
- .withField('effective', DataType.DAY)
11046
- .withField('price', DataType.DECIMAL)
11047
- .withField('fee', DataType.DECIMAL, true)
11048
- .withField('force', DataType.BOOLEAN, true)
11049
- .schema
11050
- );
11051
-
11052
- const split = new TransactionSchema(SchemaBuilder.withName(TransactionType.SPLIT.code)
11053
- .withField('portfolio', DataType.STRING)
11054
- .withField('position', DataType.STRING)
11055
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11056
- .withField('date', DataType.DAY)
11057
- .withField('numerator', DataType.DECIMAL)
11058
- .withField('denominator', DataType.DECIMAL)
11059
- .withField('effective', DataType.DAY)
11060
- .withField('fee', DataType.DECIMAL, true)
11596
+ .withField('reinvest', DataType.BOOLEAN, true)
11597
+ .withField('cash', DataType.BOOLEAN, true)
11061
11598
  .withField('force', DataType.BOOLEAN, true)
11062
11599
  .schema
11063
11600
  );
@@ -11065,6 +11602,7 @@ module.exports = (() => {
11065
11602
  const fee = new TransactionSchema(SchemaBuilder.withName(TransactionType.FEE.code)
11066
11603
  .withField('portfolio', DataType.STRING)
11067
11604
  .withField('position', DataType.STRING)
11605
+ .withField('sequence', DataType.NUMBER, true)
11068
11606
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11069
11607
  .withField('date', DataType.DAY)
11070
11608
  .withField('fee', DataType.DECIMAL)
@@ -11072,26 +11610,15 @@ module.exports = (() => {
11072
11610
  .schema
11073
11611
  );
11074
11612
 
11075
- const feeUnits = new TransactionSchema(SchemaBuilder.withName(TransactionType.FEE_UNITS.code)
11076
- .withField('portfolio', DataType.STRING)
11077
- .withField('position', DataType.STRING)
11078
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11079
- .withField('date', DataType.DAY)
11080
- .withField('fee', DataType.DECIMAL)
11081
- .withField('price', DataType.DECIMAL)
11082
- .withField('force', DataType.BOOLEAN, true)
11083
- .schema
11084
- );
11085
-
11086
11613
  const deposit = new TransactionSchema(SchemaBuilder.withName(TransactionType.DEPOSIT.code)
11087
11614
  .withField('portfolio', DataType.STRING)
11088
11615
  .withField('position', DataType.STRING)
11616
+ .withField('sequence', DataType.NUMBER, true)
11089
11617
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11090
11618
  .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
11091
11619
  .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
11092
11620
  .withField('date', DataType.DAY)
11093
11621
  .withField('amount', DataType.DECIMAL)
11094
- .withField('fee', DataType.DECIMAL, true)
11095
11622
  .withField('force', DataType.BOOLEAN, true)
11096
11623
  .schema
11097
11624
  );
@@ -11099,32 +11626,12 @@ module.exports = (() => {
11099
11626
  const withdrawal = new TransactionSchema(SchemaBuilder.withName(TransactionType.WITHDRAWAL.code)
11100
11627
  .withField('portfolio', DataType.STRING)
11101
11628
  .withField('position', DataType.STRING)
11629
+ .withField('sequence', DataType.NUMBER, true)
11102
11630
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11631
+ .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
11632
+ .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
11103
11633
  .withField('date', DataType.DAY)
11104
11634
  .withField('amount', DataType.DECIMAL)
11105
- .withField('fee', DataType.DECIMAL, true)
11106
- .withField('force', DataType.BOOLEAN, true)
11107
- .schema
11108
- );
11109
-
11110
- const debit = new TransactionSchema(SchemaBuilder.withName(TransactionType.DEBIT.code)
11111
- .withField('portfolio', DataType.STRING)
11112
- .withField('position', DataType.STRING)
11113
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11114
- .withField('date', DataType.DAY)
11115
- .withField('amount', DataType.DECIMAL)
11116
- .withField('fee', DataType.DECIMAL, true)
11117
- .withField('force', DataType.BOOLEAN, true)
11118
- .schema
11119
- );
11120
-
11121
- const credit = new TransactionSchema(SchemaBuilder.withName(TransactionType.CREDIT.code)
11122
- .withField('portfolio', DataType.STRING)
11123
- .withField('position', DataType.STRING)
11124
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11125
- .withField('date', DataType.DAY)
11126
- .withField('amount', DataType.DECIMAL)
11127
- .withField('fee', DataType.DECIMAL, true)
11128
11635
  .withField('force', DataType.BOOLEAN, true)
11129
11636
  .schema
11130
11637
  );
@@ -11132,10 +11639,10 @@ module.exports = (() => {
11132
11639
  const valuation = new TransactionSchema(SchemaBuilder.withName(TransactionType.VALUATION.code)
11133
11640
  .withField('portfolio', DataType.STRING)
11134
11641
  .withField('position', DataType.STRING)
11642
+ .withField('sequence', DataType.NUMBER, true)
11135
11643
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11136
11644
  .withField('date', DataType.DAY)
11137
11645
  .withField('value', DataType.DECIMAL)
11138
- .withField('fee', DataType.DECIMAL, true)
11139
11646
  .withField('force', DataType.BOOLEAN, true)
11140
11647
  .schema
11141
11648
  );
@@ -11143,6 +11650,7 @@ module.exports = (() => {
11143
11650
  const income = new TransactionSchema(SchemaBuilder.withName(TransactionType.INCOME.code)
11144
11651
  .withField('portfolio', DataType.STRING)
11145
11652
  .withField('position', DataType.STRING)
11653
+ .withField('sequence', DataType.NUMBER, true)
11146
11654
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
11147
11655
  .withField('date', DataType.DAY)
11148
11656
  .withField('income', DataType.DECIMAL)
@@ -11161,12 +11669,7 @@ module.exports = (() => {
11161
11669
  addSchemaToMap(TransactionType.SELL, sell);
11162
11670
  addSchemaToMap(TransactionType.BUY_SHORT, buyShort);
11163
11671
  addSchemaToMap(TransactionType.SELL_SHORT, sellShort);
11164
- addSchemaToMap(TransactionType.DIVIDEND, dividend);
11165
- addSchemaToMap(TransactionType.DIVIDEND_STOCK, dividendStock);
11166
- addSchemaToMap(TransactionType.DIVIDEND_REINVEST, dividendReinvest);
11167
- addSchemaToMap(TransactionType.SPLIT, split);
11168
11672
  addSchemaToMap(TransactionType.FEE, fee);
11169
- addSchemaToMap(TransactionType.FEE_UNITS, feeUnits);
11170
11673
  addSchemaToMap(TransactionType.DEPOSIT, deposit);
11171
11674
  addSchemaToMap(TransactionType.WITHDRAWAL, withdrawal);
11172
11675
  addSchemaToMap(TransactionType.VALUATION, valuation);
@@ -11175,7 +11678,7 @@ module.exports = (() => {
11175
11678
  return TransactionSchema;
11176
11679
  })();
11177
11680
 
11178
- },{"./../data/InstrumentType":51,"./../data/TransactionType":53,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],59:[function(require,module,exports){
11681
+ },{"./../data/InstrumentType":51,"./../data/PositionDirection":52,"./../data/TransactionType":54,"@barchart/common-js/lang/Currency":28,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/is":40,"@barchart/common-js/serialization/json/DataType":45,"@barchart/common-js/serialization/json/Schema":47,"@barchart/common-js/serialization/json/builders/SchemaBuilder":49}],60:[function(require,module,exports){
11179
11682
  'use strict';
11180
11683
 
11181
11684
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
@@ -11188,8 +11691,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
11188
11691
 
11189
11692
  var assert = require('@barchart/common-js/lang/assert'),
11190
11693
  Disposable = require('@barchart/common-js/lang/Disposable'),
11191
- Enum = require('@barchart/common-js/lang/Enum'),
11192
- is = require('@barchart/common-js/lang/is'),
11193
11694
  Scheduler = require('@barchart/common-js/timing/Scheduler');
11194
11695
 
11195
11696
  var EndpointBuilder = require('@barchart/common-js/api/http/builders/EndpointBuilder'),
@@ -11213,7 +11714,7 @@ module.exports = function () {
11213
11714
  * Web service gateway for obtaining JWT tokens from TGAM (The Globe and Mail).
11214
11715
  *
11215
11716
  * @public
11216
- * @param {Enpoint} endpoint
11717
+ * @param {JwtGateway~tokenGenerator} tokenGenerator
11217
11718
  * @param {Number=} refreshInterval - Interval, in milliseconds, which a token refresh should occur. If zero, the token does not need to be refreshed.
11218
11719
  * @extends {Disposable}
11219
11720
  */
@@ -11221,18 +11722,18 @@ module.exports = function () {
11221
11722
  var JwtGateway = function (_Disposable) {
11222
11723
  _inherits(JwtGateway, _Disposable);
11223
11724
 
11224
- function JwtGateway(endpoint, refreshInterval) {
11725
+ function JwtGateway(tokenGenerator, refreshInterval) {
11225
11726
  _classCallCheck(this, JwtGateway);
11226
11727
 
11227
11728
  var _this = _possibleConstructorReturn(this, (JwtGateway.__proto__ || Object.getPrototypeOf(JwtGateway)).call(this));
11228
11729
 
11229
- assert.argumentIsRequired(endpoint, 'endpoint', Endpoint, 'Endpoint');
11730
+ assert.argumentIsRequired(tokenGenerator, 'tokenGenerator', Function);
11230
11731
  assert.argumentIsOptional(refreshInterval, 'refreshInterval', Number);
11231
11732
 
11232
11733
  _this._started = false;
11233
11734
  _this._startPromise = null;
11234
11735
 
11235
- _this._endpoint = endpoint;
11736
+ _this._tokenGenerator = tokenGenerator;
11236
11737
 
11237
11738
  _this._refreshInterval = refreshInterval || 0;
11238
11739
  _this._refreshJitter = Math.floor(_this._refreshInterval / 10);
@@ -11285,7 +11786,7 @@ module.exports = function () {
11285
11786
  return Promise.resolve().then(function () {
11286
11787
  checkStart.call(_this3);
11287
11788
 
11288
- return Gateway.invoke(_this3._endpoint);
11789
+ return _this3._tokenGenerator();
11289
11790
  }).catch(function (e) {
11290
11791
  var failure = FailureReason.forRequest({ endpoint: _this3._endpoint }).addItem(FailureType.REQUEST_IDENTITY_FAILURE).format();
11291
11792
 
@@ -11400,7 +11901,9 @@ module.exports = function () {
11400
11901
  key: 'forDevelopment',
11401
11902
  value: function forDevelopment(endpoint) {
11402
11903
  return Promise.resolve(endpoint).then(function (e) {
11403
- return start(new JwtGateway(e, 60000));
11904
+ return start(new JwtGateway(function () {
11905
+ return Gateway.invoke(e);
11906
+ }, 60000));
11404
11907
  });
11405
11908
  }
11406
11909
 
@@ -11409,7 +11912,7 @@ module.exports = function () {
11409
11912
  *
11410
11913
  * @public
11411
11914
  * @static
11412
- * @param {Promise.<Endpoint>|Endpoint}endpoint - The endpoint which vends JWT tokens.
11915
+ * @param {Promise.<Endpoint>|Endpoint} endpoint - The endpoint which vends JWT tokens.
11413
11916
  * @returns {Promise.<RequestInterceptor>}
11414
11917
  */
11415
11918
 
@@ -11480,6 +11983,40 @@ module.exports = function () {
11480
11983
  return jwtGateway.toRequestInterceptor();
11481
11984
  });
11482
11985
  }
11986
+
11987
+ /**
11988
+ * Creates and starts a new {@link JwtGateway} for use by the "tracker" system.
11989
+ *
11990
+ * @public
11991
+ * @static
11992
+ * @param {Function} tokenGenerator - A function which returns the JWT token.
11993
+ * @returns {Promise.<JwtGateway>}
11994
+ */
11995
+
11996
+ }, {
11997
+ key: 'forTracker',
11998
+ value: function forTracker(tokenGenerator) {
11999
+ return Promise.resolve().then(function () {
12000
+ return start(new JwtGateway(tokenGenerator, 0));
12001
+ });
12002
+ }
12003
+
12004
+ /**
12005
+ * Creates and starts a new {@link RequestInterceptor} for use by "tracker" system.
12006
+ *
12007
+ * @public
12008
+ * @static
12009
+ * @param {JwtGateway~tokenGenerator} tokenGenerator - A function which returns the JWT token.
12010
+ * @returns {Promise.<RequestInterceptor>}
12011
+ */
12012
+
12013
+ }, {
12014
+ key: 'forTrackerClient',
12015
+ value: function forTrackerClient(tokenGenerator) {
12016
+ return JwtGateway.forTracker(tokenGenerator).then(function (jwtGateway) {
12017
+ return jwtGateway.toRequestInterceptor();
12018
+ });
12019
+ }
11483
12020
  }]);
11484
12021
 
11485
12022
  return JwtGateway;
@@ -11510,7 +12047,7 @@ module.exports = function () {
11510
12047
  }
11511
12048
 
11512
12049
  function forTgam(host, secret, environment) {
11513
- return EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
12050
+ var endpoint = EndpointBuilder.for('read-jwt-token-for-' + environment, 'lookup user identity').withVerb(VerbType.GET).withProtocol(ProtocolType.HTTPS).withHeadersBuilder(function (hb) {
11514
12051
  return hb.withLiteralParameter('X-GAM-CLIENT-APP-ID', 'X-GAM-CLIENT-APP-ID', '1348').withLiteralParameter('X-GAM-CLIENT-APP-SECRET', 'X-GAM-CLIENT-APP-SECRET', secret);
11515
12052
  }).withHost(host).withRequestInterceptor(RequestInterceptor.fromDelegate(function (request) {
11516
12053
  request.withCredentials = true;
@@ -11519,32 +12056,40 @@ module.exports = function () {
11519
12056
  })).withResponseInterceptor(ResponseInterceptor.DATA).withResponseInterceptor(ResponseInterceptor.fromDelegate(function (response) {
11520
12057
  return response.token;
11521
12058
  })).endpoint;
12059
+
12060
+ return function () {
12061
+ return Gateway.invoke(endpoint);
12062
+ };
11522
12063
  }
11523
12064
 
11524
12065
  function getTime() {
11525
12066
  return new Date().getTime();
11526
12067
  }
11527
12068
 
12069
+ /**
12070
+ * A function returns a JWT token (or a promise for a JWT token).
12071
+ *
12072
+ * @callback JwtGateway~tokenGenerator
12073
+ * @returns {String|Promise.<String>}
12074
+ */
12075
+
11528
12076
  return JwtGateway;
11529
12077
  }();
11530
12078
 
11531
- },{"./index":60,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/failures/FailureType":8,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/Endpoint":12,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40,"@barchart/common-js/timing/Scheduler":50}],60:[function(require,module,exports){
12079
+ },{"./index":61,"@barchart/common-js/api/failures/FailureReason":6,"@barchart/common-js/api/failures/FailureType":8,"@barchart/common-js/api/http/Gateway":9,"@barchart/common-js/api/http/builders/EndpointBuilder":10,"@barchart/common-js/api/http/definitions/Endpoint":12,"@barchart/common-js/api/http/definitions/ProtocolType":15,"@barchart/common-js/api/http/definitions/VerbType":16,"@barchart/common-js/api/http/interceptors/RequestInterceptor":21,"@barchart/common-js/api/http/interceptors/ResponseInterceptor":22,"@barchart/common-js/lang/Disposable":31,"@barchart/common-js/lang/assert":37,"@barchart/common-js/timing/Scheduler":50}],61:[function(require,module,exports){
11532
12080
  'use strict';
11533
12081
 
11534
- var JwtGateway = require('./JwtGateway');
11535
-
11536
12082
  module.exports = function () {
11537
12083
  'use strict';
11538
12084
 
11539
12085
  return {
11540
- JwtGateway: JwtGateway,
11541
- version: '1.0.38'
12086
+ version: '1.0.42'
11542
12087
  };
11543
12088
  }();
11544
12089
 
11545
- },{"./JwtGateway":59}],61:[function(require,module,exports){
12090
+ },{}],62:[function(require,module,exports){
11546
12091
  module.exports = require('./lib/axios');
11547
- },{"./lib/axios":63}],62:[function(require,module,exports){
12092
+ },{"./lib/axios":64}],63:[function(require,module,exports){
11548
12093
  (function (process){
11549
12094
  'use strict';
11550
12095
 
@@ -11728,7 +12273,7 @@ module.exports = function xhrAdapter(config) {
11728
12273
  };
11729
12274
 
11730
12275
  }).call(this,require('_process'))
11731
- },{"../core/createError":69,"./../core/settle":72,"./../helpers/btoa":76,"./../helpers/buildURL":77,"./../helpers/cookies":79,"./../helpers/isURLSameOrigin":81,"./../helpers/parseHeaders":83,"./../utils":85,"_process":87}],63:[function(require,module,exports){
12276
+ },{"../core/createError":70,"./../core/settle":73,"./../helpers/btoa":77,"./../helpers/buildURL":78,"./../helpers/cookies":80,"./../helpers/isURLSameOrigin":82,"./../helpers/parseHeaders":84,"./../utils":86,"_process":88}],64:[function(require,module,exports){
11732
12277
  'use strict';
11733
12278
 
11734
12279
  var utils = require('./utils');
@@ -11782,7 +12327,7 @@ module.exports = axios;
11782
12327
  // Allow use of default import syntax in TypeScript
11783
12328
  module.exports.default = axios;
11784
12329
 
11785
- },{"./cancel/Cancel":64,"./cancel/CancelToken":65,"./cancel/isCancel":66,"./core/Axios":67,"./defaults":74,"./helpers/bind":75,"./helpers/spread":84,"./utils":85}],64:[function(require,module,exports){
12330
+ },{"./cancel/Cancel":65,"./cancel/CancelToken":66,"./cancel/isCancel":67,"./core/Axios":68,"./defaults":75,"./helpers/bind":76,"./helpers/spread":85,"./utils":86}],65:[function(require,module,exports){
11786
12331
  'use strict';
11787
12332
 
11788
12333
  /**
@@ -11803,7 +12348,7 @@ Cancel.prototype.__CANCEL__ = true;
11803
12348
 
11804
12349
  module.exports = Cancel;
11805
12350
 
11806
- },{}],65:[function(require,module,exports){
12351
+ },{}],66:[function(require,module,exports){
11807
12352
  'use strict';
11808
12353
 
11809
12354
  var Cancel = require('./Cancel');
@@ -11862,14 +12407,14 @@ CancelToken.source = function source() {
11862
12407
 
11863
12408
  module.exports = CancelToken;
11864
12409
 
11865
- },{"./Cancel":64}],66:[function(require,module,exports){
12410
+ },{"./Cancel":65}],67:[function(require,module,exports){
11866
12411
  'use strict';
11867
12412
 
11868
12413
  module.exports = function isCancel(value) {
11869
12414
  return !!(value && value.__CANCEL__);
11870
12415
  };
11871
12416
 
11872
- },{}],67:[function(require,module,exports){
12417
+ },{}],68:[function(require,module,exports){
11873
12418
  'use strict';
11874
12419
 
11875
12420
  var defaults = require('./../defaults');
@@ -11950,7 +12495,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
11950
12495
 
11951
12496
  module.exports = Axios;
11952
12497
 
11953
- },{"./../defaults":74,"./../utils":85,"./InterceptorManager":68,"./dispatchRequest":70}],68:[function(require,module,exports){
12498
+ },{"./../defaults":75,"./../utils":86,"./InterceptorManager":69,"./dispatchRequest":71}],69:[function(require,module,exports){
11954
12499
  'use strict';
11955
12500
 
11956
12501
  var utils = require('./../utils');
@@ -12004,7 +12549,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
12004
12549
 
12005
12550
  module.exports = InterceptorManager;
12006
12551
 
12007
- },{"./../utils":85}],69:[function(require,module,exports){
12552
+ },{"./../utils":86}],70:[function(require,module,exports){
12008
12553
  'use strict';
12009
12554
 
12010
12555
  var enhanceError = require('./enhanceError');
@@ -12024,7 +12569,7 @@ module.exports = function createError(message, config, code, request, response)
12024
12569
  return enhanceError(error, config, code, request, response);
12025
12570
  };
12026
12571
 
12027
- },{"./enhanceError":71}],70:[function(require,module,exports){
12572
+ },{"./enhanceError":72}],71:[function(require,module,exports){
12028
12573
  'use strict';
12029
12574
 
12030
12575
  var utils = require('./../utils');
@@ -12112,7 +12657,7 @@ module.exports = function dispatchRequest(config) {
12112
12657
  });
12113
12658
  };
12114
12659
 
12115
- },{"../cancel/isCancel":66,"../defaults":74,"./../helpers/combineURLs":78,"./../helpers/isAbsoluteURL":80,"./../utils":85,"./transformData":73}],71:[function(require,module,exports){
12660
+ },{"../cancel/isCancel":67,"../defaults":75,"./../helpers/combineURLs":79,"./../helpers/isAbsoluteURL":81,"./../utils":86,"./transformData":74}],72:[function(require,module,exports){
12116
12661
  'use strict';
12117
12662
 
12118
12663
  /**
@@ -12135,7 +12680,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
12135
12680
  return error;
12136
12681
  };
12137
12682
 
12138
- },{}],72:[function(require,module,exports){
12683
+ },{}],73:[function(require,module,exports){
12139
12684
  'use strict';
12140
12685
 
12141
12686
  var createError = require('./createError');
@@ -12163,7 +12708,7 @@ module.exports = function settle(resolve, reject, response) {
12163
12708
  }
12164
12709
  };
12165
12710
 
12166
- },{"./createError":69}],73:[function(require,module,exports){
12711
+ },{"./createError":70}],74:[function(require,module,exports){
12167
12712
  'use strict';
12168
12713
 
12169
12714
  var utils = require('./../utils');
@@ -12185,7 +12730,7 @@ module.exports = function transformData(data, headers, fns) {
12185
12730
  return data;
12186
12731
  };
12187
12732
 
12188
- },{"./../utils":85}],74:[function(require,module,exports){
12733
+ },{"./../utils":86}],75:[function(require,module,exports){
12189
12734
  (function (process){
12190
12735
  'use strict';
12191
12736
 
@@ -12281,7 +12826,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
12281
12826
  module.exports = defaults;
12282
12827
 
12283
12828
  }).call(this,require('_process'))
12284
- },{"./adapters/http":62,"./adapters/xhr":62,"./helpers/normalizeHeaderName":82,"./utils":85,"_process":87}],75:[function(require,module,exports){
12829
+ },{"./adapters/http":63,"./adapters/xhr":63,"./helpers/normalizeHeaderName":83,"./utils":86,"_process":88}],76:[function(require,module,exports){
12285
12830
  'use strict';
12286
12831
 
12287
12832
  module.exports = function bind(fn, thisArg) {
@@ -12294,7 +12839,7 @@ module.exports = function bind(fn, thisArg) {
12294
12839
  };
12295
12840
  };
12296
12841
 
12297
- },{}],76:[function(require,module,exports){
12842
+ },{}],77:[function(require,module,exports){
12298
12843
  'use strict';
12299
12844
 
12300
12845
  // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
@@ -12332,7 +12877,7 @@ function btoa(input) {
12332
12877
 
12333
12878
  module.exports = btoa;
12334
12879
 
12335
- },{}],77:[function(require,module,exports){
12880
+ },{}],78:[function(require,module,exports){
12336
12881
  'use strict';
12337
12882
 
12338
12883
  var utils = require('./../utils');
@@ -12402,7 +12947,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
12402
12947
  return url;
12403
12948
  };
12404
12949
 
12405
- },{"./../utils":85}],78:[function(require,module,exports){
12950
+ },{"./../utils":86}],79:[function(require,module,exports){
12406
12951
  'use strict';
12407
12952
 
12408
12953
  /**
@@ -12418,7 +12963,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
12418
12963
  : baseURL;
12419
12964
  };
12420
12965
 
12421
- },{}],79:[function(require,module,exports){
12966
+ },{}],80:[function(require,module,exports){
12422
12967
  'use strict';
12423
12968
 
12424
12969
  var utils = require('./../utils');
@@ -12473,7 +13018,7 @@ module.exports = (
12473
13018
  })()
12474
13019
  );
12475
13020
 
12476
- },{"./../utils":85}],80:[function(require,module,exports){
13021
+ },{"./../utils":86}],81:[function(require,module,exports){
12477
13022
  'use strict';
12478
13023
 
12479
13024
  /**
@@ -12489,7 +13034,7 @@ module.exports = function isAbsoluteURL(url) {
12489
13034
  return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
12490
13035
  };
12491
13036
 
12492
- },{}],81:[function(require,module,exports){
13037
+ },{}],82:[function(require,module,exports){
12493
13038
  'use strict';
12494
13039
 
12495
13040
  var utils = require('./../utils');
@@ -12559,7 +13104,7 @@ module.exports = (
12559
13104
  })()
12560
13105
  );
12561
13106
 
12562
- },{"./../utils":85}],82:[function(require,module,exports){
13107
+ },{"./../utils":86}],83:[function(require,module,exports){
12563
13108
  'use strict';
12564
13109
 
12565
13110
  var utils = require('../utils');
@@ -12573,7 +13118,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
12573
13118
  });
12574
13119
  };
12575
13120
 
12576
- },{"../utils":85}],83:[function(require,module,exports){
13121
+ },{"../utils":86}],84:[function(require,module,exports){
12577
13122
  'use strict';
12578
13123
 
12579
13124
  var utils = require('./../utils');
@@ -12628,7 +13173,7 @@ module.exports = function parseHeaders(headers) {
12628
13173
  return parsed;
12629
13174
  };
12630
13175
 
12631
- },{"./../utils":85}],84:[function(require,module,exports){
13176
+ },{"./../utils":86}],85:[function(require,module,exports){
12632
13177
  'use strict';
12633
13178
 
12634
13179
  /**
@@ -12657,7 +13202,7 @@ module.exports = function spread(callback) {
12657
13202
  };
12658
13203
  };
12659
13204
 
12660
- },{}],85:[function(require,module,exports){
13205
+ },{}],86:[function(require,module,exports){
12661
13206
  'use strict';
12662
13207
 
12663
13208
  var bind = require('./helpers/bind');
@@ -12962,7 +13507,7 @@ module.exports = {
12962
13507
  trim: trim
12963
13508
  };
12964
13509
 
12965
- },{"./helpers/bind":75,"is-buffer":88}],86:[function(require,module,exports){
13510
+ },{"./helpers/bind":76,"is-buffer":89}],87:[function(require,module,exports){
12966
13511
  /*
12967
13512
  * big.js v5.0.3
12968
13513
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
@@ -13903,7 +14448,7 @@ module.exports = {
13903
14448
  }
13904
14449
  })(this);
13905
14450
 
13906
- },{}],87:[function(require,module,exports){
14451
+ },{}],88:[function(require,module,exports){
13907
14452
  // shim for using process in browser
13908
14453
  var process = module.exports = {};
13909
14454
 
@@ -14089,7 +14634,7 @@ process.chdir = function (dir) {
14089
14634
  };
14090
14635
  process.umask = function() { return 0; };
14091
14636
 
14092
- },{}],88:[function(require,module,exports){
14637
+ },{}],89:[function(require,module,exports){
14093
14638
  /*!
14094
14639
  * Determine if an object is a Buffer
14095
14640
  *
@@ -14112,7 +14657,7 @@ function isSlowBuffer (obj) {
14112
14657
  return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
14113
14658
  }
14114
14659
 
14115
- },{}],89:[function(require,module,exports){
14660
+ },{}],90:[function(require,module,exports){
14116
14661
  //! moment-timezone.js
14117
14662
  //! version : 0.5.11
14118
14663
  //! Copyright (c) JS Foundation and other contributors
@@ -15314,7 +15859,7 @@ function isSlowBuffer (obj) {
15314
15859
  return moment;
15315
15860
  }));
15316
15861
 
15317
- },{"moment":93}],90:[function(require,module,exports){
15862
+ },{"moment":94}],91:[function(require,module,exports){
15318
15863
  module.exports={
15319
15864
  "version": "2016j",
15320
15865
  "zones": [
@@ -15914,11 +16459,11 @@ module.exports={
15914
16459
  "Pacific/Pohnpei|Pacific/Ponape"
15915
16460
  ]
15916
16461
  }
15917
- },{}],91:[function(require,module,exports){
16462
+ },{}],92:[function(require,module,exports){
15918
16463
  var moment = module.exports = require("./moment-timezone");
15919
16464
  moment.tz.load(require('./data/packed/latest.json'));
15920
16465
 
15921
- },{"./data/packed/latest.json":90,"./moment-timezone":92}],92:[function(require,module,exports){
16466
+ },{"./data/packed/latest.json":91,"./moment-timezone":93}],93:[function(require,module,exports){
15922
16467
  //! moment-timezone.js
15923
16468
  //! version : 0.5.11
15924
16469
  //! Copyright (c) JS Foundation and other contributors
@@ -16521,7 +17066,7 @@ moment.tz.load(require('./data/packed/latest.json'));
16521
17066
  return moment;
16522
17067
  }));
16523
17068
 
16524
- },{"moment":93}],93:[function(require,module,exports){
17069
+ },{"moment":94}],94:[function(require,module,exports){
16525
17070
  //! moment.js
16526
17071
 
16527
17072
  ;(function (global, factory) {
@@ -17996,9 +18541,9 @@ moment.tz.load(require('./data/packed/latest.json'));
17996
18541
 
17997
18542
  mom = createUTC([2000, 1]).day(i);
17998
18543
  if (strict && !this._fullWeekdaysParse[i]) {
17999
- this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
18000
- this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
18001
- this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
18544
+ this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
18545
+ this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
18546
+ this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
18002
18547
  }
18003
18548
  if (!this._weekdaysParse[i]) {
18004
18549
  regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
@@ -18801,7 +19346,7 @@ moment.tz.load(require('./data/packed/latest.json'));
18801
19346
 
18802
19347
  function preprocessRFC2822(s) {
18803
19348
  // Remove comments and folding whitespace and replace multiple-spaces with a single space
18804
- return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
19349
+ return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
18805
19350
  }
18806
19351
 
18807
19352
  function checkWeekday(weekdayStr, parsedInput, config) {
@@ -20183,7 +20728,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20183
20728
 
20184
20729
  addUnitAlias('date', 'D');
20185
20730
 
20186
- // PRIOROITY
20731
+ // PRIORITY
20187
20732
  addUnitPriority('date', 9);
20188
20733
 
20189
20734
  // PARSING
@@ -20980,7 +21525,7 @@ moment.tz.load(require('./data/packed/latest.json'));
20980
21525
  // Side effect imports
20981
21526
 
20982
21527
 
20983
- hooks.version = '2.22.0';
21528
+ hooks.version = '2.22.2';
20984
21529
 
20985
21530
  setHookCallback(createLocal);
20986
21531
 
@@ -21029,5 +21574,210 @@ moment.tz.load(require('./data/packed/latest.json'));
21029
21574
 
21030
21575
  })));
21031
21576
 
21032
- },{}]},{},[1,5])(5)
21577
+ },{}],95:[function(require,module,exports){
21578
+ var v1 = require('./v1');
21579
+ var v4 = require('./v4');
21580
+
21581
+ var uuid = v4;
21582
+ uuid.v1 = v1;
21583
+ uuid.v4 = v4;
21584
+
21585
+ module.exports = uuid;
21586
+
21587
+ },{"./v1":98,"./v4":99}],96:[function(require,module,exports){
21588
+ /**
21589
+ * Convert array of 16 byte values to UUID string format of the form:
21590
+ * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
21591
+ */
21592
+ var byteToHex = [];
21593
+ for (var i = 0; i < 256; ++i) {
21594
+ byteToHex[i] = (i + 0x100).toString(16).substr(1);
21595
+ }
21596
+
21597
+ function bytesToUuid(buf, offset) {
21598
+ var i = offset || 0;
21599
+ var bth = byteToHex;
21600
+ return bth[buf[i++]] + bth[buf[i++]] +
21601
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
21602
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
21603
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
21604
+ bth[buf[i++]] + bth[buf[i++]] + '-' +
21605
+ bth[buf[i++]] + bth[buf[i++]] +
21606
+ bth[buf[i++]] + bth[buf[i++]] +
21607
+ bth[buf[i++]] + bth[buf[i++]];
21608
+ }
21609
+
21610
+ module.exports = bytesToUuid;
21611
+
21612
+ },{}],97:[function(require,module,exports){
21613
+ (function (global){
21614
+ // Unique ID creation requires a high quality random # generator. In the
21615
+ // browser this is a little complicated due to unknown quality of Math.random()
21616
+ // and inconsistent support for the `crypto` API. We do the best we can via
21617
+ // feature-detection
21618
+ var rng;
21619
+
21620
+ var crypto = global.crypto || global.msCrypto; // for IE 11
21621
+ if (crypto && crypto.getRandomValues) {
21622
+ // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
21623
+ var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
21624
+ rng = function whatwgRNG() {
21625
+ crypto.getRandomValues(rnds8);
21626
+ return rnds8;
21627
+ };
21628
+ }
21629
+
21630
+ if (!rng) {
21631
+ // Math.random()-based (RNG)
21632
+ //
21633
+ // If all else fails, use Math.random(). It's fast, but is of unspecified
21634
+ // quality.
21635
+ var rnds = new Array(16);
21636
+ rng = function() {
21637
+ for (var i = 0, r; i < 16; i++) {
21638
+ if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
21639
+ rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
21640
+ }
21641
+
21642
+ return rnds;
21643
+ };
21644
+ }
21645
+
21646
+ module.exports = rng;
21647
+
21648
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
21649
+ },{}],98:[function(require,module,exports){
21650
+ var rng = require('./lib/rng');
21651
+ var bytesToUuid = require('./lib/bytesToUuid');
21652
+
21653
+ // **`v1()` - Generate time-based UUID**
21654
+ //
21655
+ // Inspired by https://github.com/LiosK/UUID.js
21656
+ // and http://docs.python.org/library/uuid.html
21657
+
21658
+ // random #'s we need to init node and clockseq
21659
+ var _seedBytes = rng();
21660
+
21661
+ // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
21662
+ var _nodeId = [
21663
+ _seedBytes[0] | 0x01,
21664
+ _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
21665
+ ];
21666
+
21667
+ // Per 4.2.2, randomize (14 bit) clockseq
21668
+ var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
21669
+
21670
+ // Previous uuid creation time
21671
+ var _lastMSecs = 0, _lastNSecs = 0;
21672
+
21673
+ // See https://github.com/broofa/node-uuid for API details
21674
+ function v1(options, buf, offset) {
21675
+ var i = buf && offset || 0;
21676
+ var b = buf || [];
21677
+
21678
+ options = options || {};
21679
+
21680
+ var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
21681
+
21682
+ // UUID timestamps are 100 nano-second units since the Gregorian epoch,
21683
+ // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
21684
+ // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
21685
+ // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
21686
+ var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
21687
+
21688
+ // Per 4.2.1.2, use count of uuid's generated during the current clock
21689
+ // cycle to simulate higher resolution clock
21690
+ var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
21691
+
21692
+ // Time since last uuid creation (in msecs)
21693
+ var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
21694
+
21695
+ // Per 4.2.1.2, Bump clockseq on clock regression
21696
+ if (dt < 0 && options.clockseq === undefined) {
21697
+ clockseq = clockseq + 1 & 0x3fff;
21698
+ }
21699
+
21700
+ // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
21701
+ // time interval
21702
+ if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
21703
+ nsecs = 0;
21704
+ }
21705
+
21706
+ // Per 4.2.1.2 Throw error if too many uuids are requested
21707
+ if (nsecs >= 10000) {
21708
+ throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
21709
+ }
21710
+
21711
+ _lastMSecs = msecs;
21712
+ _lastNSecs = nsecs;
21713
+ _clockseq = clockseq;
21714
+
21715
+ // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
21716
+ msecs += 12219292800000;
21717
+
21718
+ // `time_low`
21719
+ var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
21720
+ b[i++] = tl >>> 24 & 0xff;
21721
+ b[i++] = tl >>> 16 & 0xff;
21722
+ b[i++] = tl >>> 8 & 0xff;
21723
+ b[i++] = tl & 0xff;
21724
+
21725
+ // `time_mid`
21726
+ var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
21727
+ b[i++] = tmh >>> 8 & 0xff;
21728
+ b[i++] = tmh & 0xff;
21729
+
21730
+ // `time_high_and_version`
21731
+ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
21732
+ b[i++] = tmh >>> 16 & 0xff;
21733
+
21734
+ // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
21735
+ b[i++] = clockseq >>> 8 | 0x80;
21736
+
21737
+ // `clock_seq_low`
21738
+ b[i++] = clockseq & 0xff;
21739
+
21740
+ // `node`
21741
+ var node = options.node || _nodeId;
21742
+ for (var n = 0; n < 6; ++n) {
21743
+ b[i + n] = node[n];
21744
+ }
21745
+
21746
+ return buf ? buf : bytesToUuid(b);
21747
+ }
21748
+
21749
+ module.exports = v1;
21750
+
21751
+ },{"./lib/bytesToUuid":96,"./lib/rng":97}],99:[function(require,module,exports){
21752
+ var rng = require('./lib/rng');
21753
+ var bytesToUuid = require('./lib/bytesToUuid');
21754
+
21755
+ function v4(options, buf, offset) {
21756
+ var i = buf && offset || 0;
21757
+
21758
+ if (typeof(options) == 'string') {
21759
+ buf = options == 'binary' ? new Array(16) : null;
21760
+ options = null;
21761
+ }
21762
+ options = options || {};
21763
+
21764
+ var rnds = options.random || (options.rng || rng)();
21765
+
21766
+ // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
21767
+ rnds[6] = (rnds[6] & 0x0f) | 0x40;
21768
+ rnds[8] = (rnds[8] & 0x3f) | 0x80;
21769
+
21770
+ // Copy bytes to buffer, if provided
21771
+ if (buf) {
21772
+ for (var ii = 0; ii < 16; ++ii) {
21773
+ buf[i + ii] = rnds[ii];
21774
+ }
21775
+ }
21776
+
21777
+ return buf || bytesToUuid(rnds);
21778
+ }
21779
+
21780
+ module.exports = v4;
21781
+
21782
+ },{"./lib/bytesToUuid":96,"./lib/rng":97}]},{},[1,5])(5)
21033
21783
  });