@barchart/portfolio-client-js 1.1.19 → 1.1.20

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.
@@ -27,8 +27,8 @@
27
27
 
28
28
  that.gateway = null;
29
29
 
30
- that.user = ko.observable('4a896279-ad66-4fba-9239-8124dc1d3967');
31
- that.userLegacy = ko.observable('10000120');
30
+ that.user = ko.observable('13cbd0cd-88d1-4efd-a7a1-b37f5af9963a');
31
+ that.userLegacy = ko.observable('10001981');
32
32
 
33
33
  that.connected = ko.observable(false);
34
34
  that.connecting = ko.observable(false);
@@ -158,13 +158,7 @@
158
158
  var readPositionSummaries = function() {
159
159
  var action = 'portfolioGateway.readPositionSummaries()';
160
160
 
161
- var query = {
162
- portfolio: that.portfolio() || null,
163
- position: that.position() || null,
164
- frame: 'YEARLY'
165
- };
166
-
167
- that.gateway.readPositionSummaries(query)
161
+ that.gateway.readPositionSummaries(that.portfolio() || null, that.position() || null, 'YEARLY', 2)
168
162
  .then((data) => {
169
163
  writeConsoleText(action, true);
170
164
  writeConsoleObject(data);
@@ -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":52,"@barchart/portfolio-api-common/lib/data/ValuationType":53,"@barchart/tgam-jwt-js/lib/JwtGateway":57}],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":53,"@barchart/portfolio-api-common/lib/data/ValuationType":54,"@barchart/tgam-jwt-js/lib/JwtGateway":59}],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; }; }();
@@ -122,6 +122,7 @@ var TransactionType = require('@barchart/portfolio-api-common/lib/data/Transacti
122
122
 
123
123
  var PortfolioSchema = require('@barchart/portfolio-api-common/lib/serialization/PortfolioSchema'),
124
124
  PositionSummarySchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema'),
125
+ PositionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSchema'),
125
126
  TransactionSchema = require('@barchart/portfolio-api-common/lib/serialization/TransactionSchema');
126
127
 
127
128
  var PositionSummaryFrame = require('@barchart/portfolio-api-common/lib/data/PositionSummaryFrame');
@@ -190,7 +191,7 @@ module.exports = function () {
190
191
 
191
192
  _this._readPositionsEndpoint = EndpointBuilder.for('read-positions', 'read positions').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
192
193
  pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', false);
193
- }).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPositionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
194
+ }).withRequestInterceptor(requestInterceptorToUse).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withResponseInterceptor(responseInterceptorForPositionDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
194
195
 
195
196
  _this._readPositionSummariesEndpoint = EndpointBuilder.for('read-position-summaries', 'read position summaries').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
196
197
  pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('summaries', 'summaries').withVariableParameter('position', 'position', 'position', false);
@@ -644,7 +645,11 @@ module.exports = function () {
644
645
  });
645
646
 
646
647
  var responseInterceptorForPositionDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
647
- return response.data;
648
+ try {
649
+ return JSON.parse(response.data, PositionSchema.CLIENT.schema.getReviver());
650
+ } catch (e) {
651
+ console.log('Error deserializing position summaries', e);
652
+ }
648
653
  });
649
654
 
650
655
  var responseInterceptorForPositionSummaryDeserialization = ResponseInterceptor.fromDelegate(function (response, ignored) {
@@ -682,7 +687,7 @@ module.exports = function () {
682
687
  return PortfolioGateway;
683
688
  }();
684
689
 
685
- },{"./../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/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":51,"@barchart/portfolio-api-common/lib/data/TransactionType":52,"@barchart/portfolio-api-common/lib/serialization/PortfolioSchema":54,"@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema":55,"@barchart/portfolio-api-common/lib/serialization/TransactionSchema":56}],4:[function(require,module,exports){
690
+ },{"./../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/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){
686
691
  'use strict';
687
692
 
688
693
  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; }; }();
@@ -995,7 +1000,7 @@ module.exports = function () {
995
1000
  return {
996
1001
  JwtGateway: JwtGateway,
997
1002
  PortfolioGateway: PortfolioGateway,
998
- version: '1.1.19'
1003
+ version: '1.1.20'
999
1004
  };
1000
1005
  }();
1001
1006
 
@@ -1732,7 +1737,7 @@ module.exports = function () {
1732
1737
  return Gateway;
1733
1738
  }();
1734
1739
 
1735
- },{"./../../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":59}],10:[function(require,module,exports){
1740
+ },{"./../../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){
1736
1741
  'use strict';
1737
1742
 
1738
1743
  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; }; }();
@@ -4381,7 +4386,7 @@ module.exports = function () {
4381
4386
  var Currency = function (_Enum) {
4382
4387
  _inherits(Currency, _Enum);
4383
4388
 
4384
- function Currency(code, description, precision) {
4389
+ function Currency(code, description, precision, alternateDescription) {
4385
4390
  _classCallCheck(this, Currency);
4386
4391
 
4387
4392
  var _this = _possibleConstructorReturn(this, (Currency.__proto__ || Object.getPrototypeOf(Currency)).call(this, code, description));
@@ -4389,7 +4394,11 @@ module.exports = function () {
4389
4394
  assert.argumentIsRequired(precision, 'precision', Number);
4390
4395
  assert.argumentIsValid(precision, 'precision', is.integer, 'is an integer');
4391
4396
 
4397
+ assert.argumentIsOptional(alternateDescription, 'alternateDescription', String);
4398
+
4392
4399
  _this._precision = precision;
4400
+
4401
+ _this._alternateDescription = alternateDescription || description;
4393
4402
  return _this;
4394
4403
  }
4395
4404
 
@@ -4412,6 +4421,19 @@ module.exports = function () {
4412
4421
  return this._precision;
4413
4422
  }
4414
4423
 
4424
+ /**
4425
+ * An alternate human-readable description.
4426
+ *
4427
+ * @public
4428
+ * @returns {String}
4429
+ */
4430
+
4431
+ }, {
4432
+ key: 'alternateDescription',
4433
+ get: function get() {
4434
+ return this._alternateDescription;
4435
+ }
4436
+
4415
4437
  /**
4416
4438
  * Given a code, returns the enumeration item.
4417
4439
  *
@@ -4469,9 +4491,9 @@ module.exports = function () {
4469
4491
  return Currency;
4470
4492
  }(Enum);
4471
4493
 
4472
- var cad = new Currency('CAD', 'Canadian Dollar', 2);
4473
- var eur = new Currency('EUR', 'Euro', 2);
4474
- var usd = new Currency('USD', 'US Dollar', 2);
4494
+ var cad = new Currency('CAD', 'Canadian Dollar', 2, 'CAD$');
4495
+ var eur = new Currency('EUR', 'Euro', 2, 'EUR');
4496
+ var usd = new Currency('USD', 'US Dollar', 2, 'US$');
4475
4497
 
4476
4498
  return Currency;
4477
4499
  }();
@@ -5609,7 +5631,7 @@ module.exports = function () {
5609
5631
  return Decimal;
5610
5632
  }();
5611
5633
 
5612
- },{"./Enum":32,"./assert":37,"./is":40,"big.js":84}],31:[function(require,module,exports){
5634
+ },{"./Enum":32,"./assert":37,"./is":40,"big.js":86}],31:[function(require,module,exports){
5613
5635
  'use strict';
5614
5636
 
5615
5637
  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; }; }();
@@ -6146,7 +6168,7 @@ module.exports = function () {
6146
6168
  return Timestamp;
6147
6169
  }();
6148
6170
 
6149
- },{"./assert":37,"./is":40,"moment-timezone":89}],35:[function(require,module,exports){
6171
+ },{"./assert":37,"./is":40,"moment-timezone":91}],35:[function(require,module,exports){
6150
6172
  'use strict';
6151
6173
 
6152
6174
  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; }; }();
@@ -7609,7 +7631,7 @@ module.exports = function () {
7609
7631
  };
7610
7632
  }();
7611
7633
 
7612
- },{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":87}],44:[function(require,module,exports){
7634
+ },{"./assert":37,"moment-timezone/builds/moment-timezone-with-data-2010-2020":89}],44:[function(require,module,exports){
7613
7635
  'use strict';
7614
7636
 
7615
7637
  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; }; }();
@@ -8085,7 +8107,7 @@ module.exports = function () {
8085
8107
  return DataType;
8086
8108
  }();
8087
8109
 
8088
- },{"./../../lang/AdHoc":27,"./../../lang/Day":29,"./../../lang/Decimal":30,"./../../lang/Enum":32,"./../../lang/Timestamp":34,"./../../lang/assert":37,"./../../lang/is":40,"moment":91}],46:[function(require,module,exports){
8110
+ },{"./../../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){
8089
8111
  'use strict';
8090
8112
 
8091
8113
  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; }; }();
@@ -9018,6 +9040,97 @@ module.exports = function () {
9018
9040
  }();
9019
9041
 
9020
9042
  },{"./../lang/Disposable":31,"./../lang/assert":37,"./../lang/is":40,"./../lang/object":41,"./../lang/promise":42}],51:[function(require,module,exports){
9043
+ const assert = require('@barchart/common-js/lang/assert'),
9044
+ Enum = require('@barchart/common-js/lang/Enum');
9045
+
9046
+ module.exports = (() => {
9047
+ 'use strict';
9048
+
9049
+ /**
9050
+ * An enumeration used to classify instruments.
9051
+ *
9052
+ * @public
9053
+ * @extends {Enum}
9054
+ * @param {String} description
9055
+ * @param {String} alternateDescription
9056
+ * @param {String} code
9057
+ * @param {Boolean} canReinvest
9058
+ */
9059
+ class InstrumentType extends Enum {
9060
+ constructor(code, description, alternateDescription, canReinvest) {
9061
+ super(code, description);
9062
+
9063
+ this._alternateDescription = alternateDescription;
9064
+ this._canReinvest = canReinvest;
9065
+ }
9066
+
9067
+ get alternateDescription() {
9068
+ return this._alternateDescription;
9069
+ }
9070
+
9071
+ /**
9072
+ * Indicates if the instrument type allows automatic reinvestment.
9073
+ *
9074
+ * @returns {Boolean}
9075
+ */
9076
+ get canReinvest() {
9077
+ return this._canReinvest;
9078
+ }
9079
+
9080
+ /**
9081
+ * Cash.
9082
+ *
9083
+ * @public
9084
+ * @returns {InstrumentType}
9085
+ */
9086
+ static get CASH() {
9087
+ return cash;
9088
+ }
9089
+
9090
+ /**
9091
+ * An equity issue.
9092
+ *
9093
+ * @public
9094
+ * @returns {InstrumentType}
9095
+ */
9096
+ static get EQUITY() {
9097
+ return equity;
9098
+ }
9099
+
9100
+ /**
9101
+ * A mutual fund.
9102
+ *
9103
+ * @public
9104
+ * @returns {InstrumentType}
9105
+ */
9106
+ static get FUND() {
9107
+ return fund;
9108
+ }
9109
+
9110
+ /**
9111
+ * An undefined asset (e.g. a house, or a collectible, or a salvaged alien spaceship).
9112
+ *
9113
+ * @public
9114
+ * @returns {InstrumentType}
9115
+ */
9116
+ static get OTHER() {
9117
+ return other;
9118
+ }
9119
+
9120
+ toString() {
9121
+ return '[InstrumentType]';
9122
+ }
9123
+ }
9124
+
9125
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false);
9126
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true);
9127
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true);
9128
+ const other = new InstrumentType('OTHER', 'other', 'Other', false);
9129
+
9130
+ return InstrumentType;
9131
+ })();
9132
+
9133
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],52:[function(require,module,exports){
9021
9134
  const array = require('@barchart/common-js/lang/array'),
9022
9135
  assert = require('@barchart/common-js/lang/assert'),
9023
9136
  Day = require('@barchart/common-js/lang/Day'),
@@ -9204,7 +9317,7 @@ module.exports = (() => {
9204
9317
  return PositionSummaryFrame;
9205
9318
  })();
9206
9319
 
9207
- },{"@barchart/common-js/lang/Day":29,"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/array":36,"@barchart/common-js/lang/assert":37,"@barchart/common-js/lang/is":40}],52:[function(require,module,exports){
9320
+ },{"@barchart/common-js/lang/Day":29,"@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){
9208
9321
  const assert = require('@barchart/common-js/lang/assert'),
9209
9322
  Enum = require('@barchart/common-js/lang/Enum');
9210
9323
 
@@ -9531,7 +9644,7 @@ module.exports = (() => {
9531
9644
  return TransactionType;
9532
9645
  })();
9533
9646
 
9534
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],53:[function(require,module,exports){
9647
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],54:[function(require,module,exports){
9535
9648
  const assert = require('@barchart/common-js/lang/assert'),
9536
9649
  Enum = require('@barchart/common-js/lang/Enum');
9537
9650
 
@@ -9593,7 +9706,7 @@ module.exports = (() => {
9593
9706
  return ValuationType;
9594
9707
  })();
9595
9708
 
9596
- },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],54:[function(require,module,exports){
9709
+ },{"@barchart/common-js/lang/Enum":32,"@barchart/common-js/lang/assert":37}],55:[function(require,module,exports){
9597
9710
  const assert = require('@barchart/common-js/lang/assert'),
9598
9711
  Currency = require('@barchart/common-js/lang/Currency'),
9599
9712
  DataType = require('@barchart/common-js/serialization/json/DataType'),
@@ -9762,7 +9875,133 @@ module.exports = (() => {
9762
9875
  return PortfolioSchema;
9763
9876
  })();
9764
9877
 
9765
- },{"./../data/ValuationType":53,"@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}],55:[function(require,module,exports){
9878
+ },{"./../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){
9879
+ const assert = require('@barchart/common-js/lang/assert'),
9880
+ Currency = require('@barchart/common-js/lang/Currency'),
9881
+ DataType = require('@barchart/common-js/serialization/json/DataType'),
9882
+ Enum = require('@barchart/common-js/lang/Enum'),
9883
+ is = require('@barchart/common-js/lang/is'),
9884
+ Schema = require('@barchart/common-js/serialization/json/Schema'),
9885
+ SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
9886
+
9887
+ const InstrumentType = require('./../data/InstrumentType'),
9888
+ ValuationType = require('./../data/ValuationType');
9889
+
9890
+ module.exports = (() => {
9891
+ 'use strict';
9892
+
9893
+ /**
9894
+ * The schemas which can be used to represent position objects.
9895
+ *
9896
+ * @public
9897
+ * @extends {Enum}
9898
+ */
9899
+ class PositionSchema extends Enum {
9900
+ constructor(schema) {
9901
+ super(schema.name, schema.name);
9902
+
9903
+ this._schema = schema;
9904
+ }
9905
+
9906
+ /**
9907
+ * The actual {@link Schema}.
9908
+ *
9909
+ * @public
9910
+ * @returns {Schema}
9911
+ */
9912
+ get schema() {
9913
+ return this._schema;
9914
+ }
9915
+
9916
+ /**
9917
+ * The complete position schema.
9918
+ *
9919
+ * @static
9920
+ * @public
9921
+ * @returns {PositionSchema}
9922
+ */
9923
+ static get COMPLETE() {
9924
+ return complete;
9925
+ }
9926
+
9927
+ /**
9928
+ * Position data transmitted to the client, omitting some system data.
9929
+ *
9930
+ * @static
9931
+ * @public
9932
+ * @returns {PositionSchema}
9933
+ */
9934
+ static get CLIENT() {
9935
+ return client;
9936
+ }
9937
+
9938
+ toString() {
9939
+ return '[PositionSchema]';
9940
+ }
9941
+ }
9942
+
9943
+ const complete = new PositionSchema(SchemaBuilder.withName('complete')
9944
+ .withField('user', DataType.STRING)
9945
+ .withField('portfolio', DataType.STRING)
9946
+ .withField('instrument.id', DataType.STRING)
9947
+ .withField('instrument.name', DataType.STRING)
9948
+ .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'))
9949
+ .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
9950
+ .withField('instrument.delist', DataType.DAY, true)
9951
+ .withField('instrument.symbol.barchart', DataType.STRING, true)
9952
+ .withField('instrument.symbol.display', DataType.STRING, true)
9953
+ .withField('position', DataType.STRING)
9954
+ .withField('open', DataType.BOOLEAN, true)
9955
+ .withField('transaction', DataType.NUMBER)
9956
+ .withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
9957
+ .withField('reinvest', DataType.BOOLEAN)
9958
+ .withField('snapshot.date', DataType.DAY)
9959
+ .withField('snapshot.open', DataType.DECIMAL)
9960
+ .withField('snapshot.buys', DataType.DECIMAL)
9961
+ .withField('snapshot.sells', DataType.DECIMAL)
9962
+ .withField('snapshot.gain', DataType.DECIMAL)
9963
+ .withField('snapshot.basis', DataType.DECIMAL)
9964
+ .withField('snapshot.income', DataType.DECIMAL)
9965
+ .withField('snapshot.value', DataType.DECIMAL)
9966
+ .withField('legacy.system', DataType.STRING, true)
9967
+ .withField('legacy.user', DataType.STRING, true)
9968
+ .withField('legacy.portfolio', DataType.STRING, true)
9969
+ .withField('legacy.position', DataType.STRING, true)
9970
+ .withField('system.version', DataType.NUMBER, true)
9971
+ .schema
9972
+ );
9973
+
9974
+ const client = new PositionSchema(SchemaBuilder.withName('client')
9975
+ .withField('user', DataType.STRING)
9976
+ .withField('portfolio', DataType.STRING)
9977
+ .withField('instrument.id', DataType.STRING)
9978
+ .withField('instrument.name', DataType.STRING)
9979
+ .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'))
9980
+ .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
9981
+ .withField('instrument.delist', DataType.DAY, true)
9982
+ .withField('instrument.symbol.barchart', DataType.STRING, true)
9983
+ .withField('instrument.symbol.display', DataType.STRING, true)
9984
+ .withField('position', DataType.STRING)
9985
+ .withField('open', DataType.BOOLEAN, true)
9986
+ .withField('transaction', DataType.NUMBER)
9987
+ .withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
9988
+ .withField('reinvest', DataType.BOOLEAN)
9989
+ .withField('snapshot.date', DataType.DAY)
9990
+ .withField('snapshot.open', DataType.DECIMAL)
9991
+ .withField('snapshot.buys', DataType.DECIMAL)
9992
+ .withField('snapshot.sells', DataType.DECIMAL)
9993
+ .withField('snapshot.gain', DataType.DECIMAL)
9994
+ .withField('snapshot.basis', DataType.DECIMAL)
9995
+ .withField('snapshot.income', DataType.DECIMAL)
9996
+ .withField('snapshot.value', DataType.DECIMAL)
9997
+ .withField('previous', DataType.NUMBER, true)
9998
+ .schema
9999
+ );
10000
+
10001
+ return PositionSchema;
10002
+ })();
10003
+
10004
+ },{"./../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){
9766
10005
  const assert = require('@barchart/common-js/lang/assert'),
9767
10006
  Currency = require('@barchart/common-js/lang/Currency'),
9768
10007
  DataType = require('@barchart/common-js/serialization/json/DataType'),
@@ -9891,7 +10130,7 @@ module.exports = (() => {
9891
10130
  return PositionSummarySchema;
9892
10131
  })();
9893
10132
 
9894
- },{"./../data/PositionSummaryFrame":51,"@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}],56:[function(require,module,exports){
10133
+ },{"./../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){
9895
10134
  const assert = require('@barchart/common-js/lang/assert'),
9896
10135
  is = require('@barchart/common-js/lang/is'),
9897
10136
  Currency = require('@barchart/common-js/lang/Currency'),
@@ -10367,7 +10606,7 @@ module.exports = (() => {
10367
10606
  return TransactionSchema;
10368
10607
  })();
10369
10608
 
10370
- },{"./../data/TransactionType":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}],57:[function(require,module,exports){
10609
+ },{"./../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){
10371
10610
  'use strict';
10372
10611
 
10373
10612
  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; }; }();
@@ -10720,7 +10959,7 @@ module.exports = function () {
10720
10959
  return JwtGateway;
10721
10960
  }();
10722
10961
 
10723
- },{"./index":58,"@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}],58:[function(require,module,exports){
10962
+ },{"./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){
10724
10963
  'use strict';
10725
10964
 
10726
10965
  var JwtGateway = require('./JwtGateway');
@@ -10734,9 +10973,9 @@ module.exports = function () {
10734
10973
  };
10735
10974
  }();
10736
10975
 
10737
- },{"./JwtGateway":57}],59:[function(require,module,exports){
10976
+ },{"./JwtGateway":59}],61:[function(require,module,exports){
10738
10977
  module.exports = require('./lib/axios');
10739
- },{"./lib/axios":61}],60:[function(require,module,exports){
10978
+ },{"./lib/axios":63}],62:[function(require,module,exports){
10740
10979
  (function (process){
10741
10980
  'use strict';
10742
10981
 
@@ -10920,7 +11159,7 @@ module.exports = function xhrAdapter(config) {
10920
11159
  };
10921
11160
 
10922
11161
  }).call(this,require('_process'))
10923
- },{"../core/createError":67,"./../core/settle":70,"./../helpers/btoa":74,"./../helpers/buildURL":75,"./../helpers/cookies":77,"./../helpers/isURLSameOrigin":79,"./../helpers/parseHeaders":81,"./../utils":83,"_process":85}],61:[function(require,module,exports){
11162
+ },{"../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){
10924
11163
  'use strict';
10925
11164
 
10926
11165
  var utils = require('./utils');
@@ -10974,7 +11213,7 @@ module.exports = axios;
10974
11213
  // Allow use of default import syntax in TypeScript
10975
11214
  module.exports.default = axios;
10976
11215
 
10977
- },{"./cancel/Cancel":62,"./cancel/CancelToken":63,"./cancel/isCancel":64,"./core/Axios":65,"./defaults":72,"./helpers/bind":73,"./helpers/spread":82,"./utils":83}],62:[function(require,module,exports){
11216
+ },{"./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){
10978
11217
  'use strict';
10979
11218
 
10980
11219
  /**
@@ -10995,7 +11234,7 @@ Cancel.prototype.__CANCEL__ = true;
10995
11234
 
10996
11235
  module.exports = Cancel;
10997
11236
 
10998
- },{}],63:[function(require,module,exports){
11237
+ },{}],65:[function(require,module,exports){
10999
11238
  'use strict';
11000
11239
 
11001
11240
  var Cancel = require('./Cancel');
@@ -11054,14 +11293,14 @@ CancelToken.source = function source() {
11054
11293
 
11055
11294
  module.exports = CancelToken;
11056
11295
 
11057
- },{"./Cancel":62}],64:[function(require,module,exports){
11296
+ },{"./Cancel":64}],66:[function(require,module,exports){
11058
11297
  'use strict';
11059
11298
 
11060
11299
  module.exports = function isCancel(value) {
11061
11300
  return !!(value && value.__CANCEL__);
11062
11301
  };
11063
11302
 
11064
- },{}],65:[function(require,module,exports){
11303
+ },{}],67:[function(require,module,exports){
11065
11304
  'use strict';
11066
11305
 
11067
11306
  var defaults = require('./../defaults');
@@ -11142,7 +11381,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
11142
11381
 
11143
11382
  module.exports = Axios;
11144
11383
 
11145
- },{"./../defaults":72,"./../utils":83,"./InterceptorManager":66,"./dispatchRequest":68}],66:[function(require,module,exports){
11384
+ },{"./../defaults":74,"./../utils":85,"./InterceptorManager":68,"./dispatchRequest":70}],68:[function(require,module,exports){
11146
11385
  'use strict';
11147
11386
 
11148
11387
  var utils = require('./../utils');
@@ -11196,7 +11435,7 @@ InterceptorManager.prototype.forEach = function forEach(fn) {
11196
11435
 
11197
11436
  module.exports = InterceptorManager;
11198
11437
 
11199
- },{"./../utils":83}],67:[function(require,module,exports){
11438
+ },{"./../utils":85}],69:[function(require,module,exports){
11200
11439
  'use strict';
11201
11440
 
11202
11441
  var enhanceError = require('./enhanceError');
@@ -11216,7 +11455,7 @@ module.exports = function createError(message, config, code, request, response)
11216
11455
  return enhanceError(error, config, code, request, response);
11217
11456
  };
11218
11457
 
11219
- },{"./enhanceError":69}],68:[function(require,module,exports){
11458
+ },{"./enhanceError":71}],70:[function(require,module,exports){
11220
11459
  'use strict';
11221
11460
 
11222
11461
  var utils = require('./../utils');
@@ -11304,7 +11543,7 @@ module.exports = function dispatchRequest(config) {
11304
11543
  });
11305
11544
  };
11306
11545
 
11307
- },{"../cancel/isCancel":64,"../defaults":72,"./../helpers/combineURLs":76,"./../helpers/isAbsoluteURL":78,"./../utils":83,"./transformData":71}],69:[function(require,module,exports){
11546
+ },{"../cancel/isCancel":66,"../defaults":74,"./../helpers/combineURLs":78,"./../helpers/isAbsoluteURL":80,"./../utils":85,"./transformData":73}],71:[function(require,module,exports){
11308
11547
  'use strict';
11309
11548
 
11310
11549
  /**
@@ -11327,7 +11566,7 @@ module.exports = function enhanceError(error, config, code, request, response) {
11327
11566
  return error;
11328
11567
  };
11329
11568
 
11330
- },{}],70:[function(require,module,exports){
11569
+ },{}],72:[function(require,module,exports){
11331
11570
  'use strict';
11332
11571
 
11333
11572
  var createError = require('./createError');
@@ -11355,7 +11594,7 @@ module.exports = function settle(resolve, reject, response) {
11355
11594
  }
11356
11595
  };
11357
11596
 
11358
- },{"./createError":67}],71:[function(require,module,exports){
11597
+ },{"./createError":69}],73:[function(require,module,exports){
11359
11598
  'use strict';
11360
11599
 
11361
11600
  var utils = require('./../utils');
@@ -11377,7 +11616,7 @@ module.exports = function transformData(data, headers, fns) {
11377
11616
  return data;
11378
11617
  };
11379
11618
 
11380
- },{"./../utils":83}],72:[function(require,module,exports){
11619
+ },{"./../utils":85}],74:[function(require,module,exports){
11381
11620
  (function (process){
11382
11621
  'use strict';
11383
11622
 
@@ -11473,7 +11712,7 @@ utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
11473
11712
  module.exports = defaults;
11474
11713
 
11475
11714
  }).call(this,require('_process'))
11476
- },{"./adapters/http":60,"./adapters/xhr":60,"./helpers/normalizeHeaderName":80,"./utils":83,"_process":85}],73:[function(require,module,exports){
11715
+ },{"./adapters/http":62,"./adapters/xhr":62,"./helpers/normalizeHeaderName":82,"./utils":85,"_process":87}],75:[function(require,module,exports){
11477
11716
  'use strict';
11478
11717
 
11479
11718
  module.exports = function bind(fn, thisArg) {
@@ -11486,7 +11725,7 @@ module.exports = function bind(fn, thisArg) {
11486
11725
  };
11487
11726
  };
11488
11727
 
11489
- },{}],74:[function(require,module,exports){
11728
+ },{}],76:[function(require,module,exports){
11490
11729
  'use strict';
11491
11730
 
11492
11731
  // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
@@ -11524,7 +11763,7 @@ function btoa(input) {
11524
11763
 
11525
11764
  module.exports = btoa;
11526
11765
 
11527
- },{}],75:[function(require,module,exports){
11766
+ },{}],77:[function(require,module,exports){
11528
11767
  'use strict';
11529
11768
 
11530
11769
  var utils = require('./../utils');
@@ -11594,7 +11833,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
11594
11833
  return url;
11595
11834
  };
11596
11835
 
11597
- },{"./../utils":83}],76:[function(require,module,exports){
11836
+ },{"./../utils":85}],78:[function(require,module,exports){
11598
11837
  'use strict';
11599
11838
 
11600
11839
  /**
@@ -11610,7 +11849,7 @@ module.exports = function combineURLs(baseURL, relativeURL) {
11610
11849
  : baseURL;
11611
11850
  };
11612
11851
 
11613
- },{}],77:[function(require,module,exports){
11852
+ },{}],79:[function(require,module,exports){
11614
11853
  'use strict';
11615
11854
 
11616
11855
  var utils = require('./../utils');
@@ -11665,7 +11904,7 @@ module.exports = (
11665
11904
  })()
11666
11905
  );
11667
11906
 
11668
- },{"./../utils":83}],78:[function(require,module,exports){
11907
+ },{"./../utils":85}],80:[function(require,module,exports){
11669
11908
  'use strict';
11670
11909
 
11671
11910
  /**
@@ -11681,7 +11920,7 @@ module.exports = function isAbsoluteURL(url) {
11681
11920
  return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
11682
11921
  };
11683
11922
 
11684
- },{}],79:[function(require,module,exports){
11923
+ },{}],81:[function(require,module,exports){
11685
11924
  'use strict';
11686
11925
 
11687
11926
  var utils = require('./../utils');
@@ -11751,7 +11990,7 @@ module.exports = (
11751
11990
  })()
11752
11991
  );
11753
11992
 
11754
- },{"./../utils":83}],80:[function(require,module,exports){
11993
+ },{"./../utils":85}],82:[function(require,module,exports){
11755
11994
  'use strict';
11756
11995
 
11757
11996
  var utils = require('../utils');
@@ -11765,7 +12004,7 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
11765
12004
  });
11766
12005
  };
11767
12006
 
11768
- },{"../utils":83}],81:[function(require,module,exports){
12007
+ },{"../utils":85}],83:[function(require,module,exports){
11769
12008
  'use strict';
11770
12009
 
11771
12010
  var utils = require('./../utils');
@@ -11820,7 +12059,7 @@ module.exports = function parseHeaders(headers) {
11820
12059
  return parsed;
11821
12060
  };
11822
12061
 
11823
- },{"./../utils":83}],82:[function(require,module,exports){
12062
+ },{"./../utils":85}],84:[function(require,module,exports){
11824
12063
  'use strict';
11825
12064
 
11826
12065
  /**
@@ -11849,7 +12088,7 @@ module.exports = function spread(callback) {
11849
12088
  };
11850
12089
  };
11851
12090
 
11852
- },{}],83:[function(require,module,exports){
12091
+ },{}],85:[function(require,module,exports){
11853
12092
  'use strict';
11854
12093
 
11855
12094
  var bind = require('./helpers/bind');
@@ -12154,7 +12393,7 @@ module.exports = {
12154
12393
  trim: trim
12155
12394
  };
12156
12395
 
12157
- },{"./helpers/bind":73,"is-buffer":86}],84:[function(require,module,exports){
12396
+ },{"./helpers/bind":75,"is-buffer":88}],86:[function(require,module,exports){
12158
12397
  /*
12159
12398
  * big.js v5.0.3
12160
12399
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
@@ -13095,7 +13334,7 @@ module.exports = {
13095
13334
  }
13096
13335
  })(this);
13097
13336
 
13098
- },{}],85:[function(require,module,exports){
13337
+ },{}],87:[function(require,module,exports){
13099
13338
  // shim for using process in browser
13100
13339
  var process = module.exports = {};
13101
13340
 
@@ -13281,7 +13520,7 @@ process.chdir = function (dir) {
13281
13520
  };
13282
13521
  process.umask = function() { return 0; };
13283
13522
 
13284
- },{}],86:[function(require,module,exports){
13523
+ },{}],88:[function(require,module,exports){
13285
13524
  /*!
13286
13525
  * Determine if an object is a Buffer
13287
13526
  *
@@ -13304,7 +13543,7 @@ function isSlowBuffer (obj) {
13304
13543
  return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
13305
13544
  }
13306
13545
 
13307
- },{}],87:[function(require,module,exports){
13546
+ },{}],89:[function(require,module,exports){
13308
13547
  //! moment-timezone.js
13309
13548
  //! version : 0.5.11
13310
13549
  //! Copyright (c) JS Foundation and other contributors
@@ -14506,7 +14745,7 @@ function isSlowBuffer (obj) {
14506
14745
  return moment;
14507
14746
  }));
14508
14747
 
14509
- },{"moment":91}],88:[function(require,module,exports){
14748
+ },{"moment":93}],90:[function(require,module,exports){
14510
14749
  module.exports={
14511
14750
  "version": "2016j",
14512
14751
  "zones": [
@@ -15106,11 +15345,11 @@ module.exports={
15106
15345
  "Pacific/Pohnpei|Pacific/Ponape"
15107
15346
  ]
15108
15347
  }
15109
- },{}],89:[function(require,module,exports){
15348
+ },{}],91:[function(require,module,exports){
15110
15349
  var moment = module.exports = require("./moment-timezone");
15111
15350
  moment.tz.load(require('./data/packed/latest.json'));
15112
15351
 
15113
- },{"./data/packed/latest.json":88,"./moment-timezone":90}],90:[function(require,module,exports){
15352
+ },{"./data/packed/latest.json":90,"./moment-timezone":92}],92:[function(require,module,exports){
15114
15353
  //! moment-timezone.js
15115
15354
  //! version : 0.5.11
15116
15355
  //! Copyright (c) JS Foundation and other contributors
@@ -15713,7 +15952,7 @@ moment.tz.load(require('./data/packed/latest.json'));
15713
15952
  return moment;
15714
15953
  }));
15715
15954
 
15716
- },{"moment":91}],91:[function(require,module,exports){
15955
+ },{"moment":93}],93:[function(require,module,exports){
15717
15956
  //! moment.js
15718
15957
 
15719
15958
  ;(function (global, factory) {
@@ -7,6 +7,7 @@ const TransactionType = require('@barchart/portfolio-api-common/lib/data/Transac
7
7
 
8
8
  const PortfolioSchema = require('@barchart/portfolio-api-common/lib/serialization/PortfolioSchema'),
9
9
  PositionSummarySchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema'),
10
+ PositionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSchema'),
10
11
  TransactionSchema = require('@barchart/portfolio-api-common/lib/serialization/TransactionSchema');
11
12
 
12
13
  const PositionSummaryFrame = require('@barchart/portfolio-api-common/lib/data/PositionSummaryFrame');
@@ -123,6 +124,7 @@ module.exports = (() => {
123
124
  .withVariableParameter('position', 'position', 'position', false);
124
125
  })
125
126
  .withRequestInterceptor(requestInterceptorToUse)
127
+ .withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
126
128
  .withResponseInterceptor(responseInterceptorForPositionDeserialization)
127
129
  .withErrorInterceptor(ErrorInterceptor.GENERAL)
128
130
  .endpoint;
@@ -605,7 +607,11 @@ module.exports = (() => {
605
607
  });
606
608
 
607
609
  const responseInterceptorForPositionDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
608
- return response.data;
610
+ try {
611
+ return JSON.parse(response.data, PositionSchema.CLIENT.schema.getReviver());
612
+ } catch (e) {
613
+ console.log('Error deserializing position summaries', e);
614
+ }
609
615
  });
610
616
 
611
617
  const responseInterceptorForPositionSummaryDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
package/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtGateway: JwtGateway,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '1.1.19'
10
+ version: '1.1.20'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "1.1.19",
3
+ "version": "1.1.20",
4
4
  "description": "JavaScript library for interfacing with Barchart's Portfolio API",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",