@barchart/portfolio-api-common 1.0.134 → 1.0.138

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.
@@ -38,15 +38,18 @@ module.exports = (() => {
38
38
 
39
39
  this._excluded = false;
40
40
  this._suspended = false;
41
+ this._showClosedPositions = false;
41
42
 
42
43
  this._marketPercentChangeEvent = new Event(this);
43
44
  this._excludedChangeEvent = new Event(this);
45
+ this._showClosedPositionsChangeEvent = new Event(this);
44
46
 
45
47
  this._dataFormat = { };
46
48
  this._dataActual = { };
47
49
 
48
50
  this._dataFormat.key = this._key;
49
51
  this._dataFormat.description = this._description;
52
+ this._dataFormat.hide = false;
50
53
  this._dataFormat.newsExists = false;
51
54
  this._dataFormat.quantity = null;
52
55
  this._dataFormat.basisPrice = null;
@@ -143,7 +146,7 @@ module.exports = (() => {
143
146
  this._dataFormat.newsExists = exists;
144
147
  });
145
148
 
146
- item._fundamentalDataChangeEvent((data, sender) => {
149
+ item.registerFundamentalDataChangeHandler((data, sender) => {
147
150
  this._dataFormat.fundamental = data;
148
151
  });
149
152
  }
@@ -257,6 +260,14 @@ module.exports = (() => {
257
260
  }
258
261
  }
259
262
 
263
+ setShowClosedPositions(value) {
264
+ assert.argumentIsRequired(value, 'value', Boolean);
265
+
266
+ if (this._showClosedPositions !== value) {
267
+ this._showClosedPositionsChangeEvent(this._showClosedPositions = value);
268
+ }
269
+ }
270
+
260
271
  setSuspended(value) {
261
272
  assert.argumentIsRequired(value, 'value', Boolean);
262
273
 
@@ -172,7 +172,7 @@ module.exports = (() => {
172
172
  setPositionFundamentalData(data) {
173
173
  assert.argumentIsRequired(data, 'data', Object);
174
174
 
175
- this._fundamentalDataChangeEvent(this._data.fundamental = data);
175
+ this._fundamentalDataChangeEvent.fire(this._data.fundamental = data);
176
176
  }
177
177
 
178
178
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.134",
3
+ "version": "1.0.138",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1197,15 +1197,18 @@ module.exports = (() => {
1197
1197
 
1198
1198
  this._excluded = false;
1199
1199
  this._suspended = false;
1200
+ this._showClosedPositions = false;
1200
1201
 
1201
1202
  this._marketPercentChangeEvent = new Event(this);
1202
1203
  this._excludedChangeEvent = new Event(this);
1204
+ this._showClosedPositionsChangeEvent = new Event(this);
1203
1205
 
1204
1206
  this._dataFormat = { };
1205
1207
  this._dataActual = { };
1206
1208
 
1207
1209
  this._dataFormat.key = this._key;
1208
1210
  this._dataFormat.description = this._description;
1211
+ this._dataFormat.hide = false;
1209
1212
  this._dataFormat.newsExists = false;
1210
1213
  this._dataFormat.quantity = null;
1211
1214
  this._dataFormat.basisPrice = null;
@@ -1302,7 +1305,7 @@ module.exports = (() => {
1302
1305
  this._dataFormat.newsExists = exists;
1303
1306
  });
1304
1307
 
1305
- item._fundamentalDataChangeEvent((data, sender) => {
1308
+ item.registerFundamentalDataChangeHandler((data, sender) => {
1306
1309
  this._dataFormat.fundamental = data;
1307
1310
  });
1308
1311
  }
@@ -1416,6 +1419,14 @@ module.exports = (() => {
1416
1419
  }
1417
1420
  }
1418
1421
 
1422
+ setShowClosedPositions(value) {
1423
+ assert.argumentIsRequired(value, 'value', Boolean);
1424
+
1425
+ if (this._showClosedPositions !== value) {
1426
+ this._showClosedPositionsChangeEvent(this._showClosedPositions = value);
1427
+ }
1428
+ }
1429
+
1419
1430
  setSuspended(value) {
1420
1431
  assert.argumentIsRequired(value, 'value', Boolean);
1421
1432
 
@@ -1888,7 +1899,7 @@ module.exports = (() => {
1888
1899
  setPositionFundamentalData(data) {
1889
1900
  assert.argumentIsRequired(data, 'data', Object);
1890
1901
 
1891
- this._fundamentalDataChangeEvent(this._data.fundamental = data);
1902
+ this._fundamentalDataChangeEvent.fire(this._data.fundamental = data);
1892
1903
  }
1893
1904
 
1894
1905
  /**
@@ -2848,7 +2859,7 @@ module.exports = function () {
2848
2859
  var Currency = function (_Enum) {
2849
2860
  _inherits(Currency, _Enum);
2850
2861
 
2851
- function Currency(code, description, precision, alternateDescription) {
2862
+ function Currency(code, description, precision) {
2852
2863
  _classCallCheck(this, Currency);
2853
2864
 
2854
2865
  var _this = _possibleConstructorReturn(this, (Currency.__proto__ || Object.getPrototypeOf(Currency)).call(this, code, description));
@@ -2856,11 +2867,7 @@ module.exports = function () {
2856
2867
  assert.argumentIsRequired(precision, 'precision', Number);
2857
2868
  assert.argumentIsValid(precision, 'precision', is.integer, 'is an integer');
2858
2869
 
2859
- assert.argumentIsOptional(alternateDescription, 'alternateDescription', String);
2860
-
2861
2870
  _this._precision = precision;
2862
-
2863
- _this._alternateDescription = alternateDescription || description;
2864
2871
  return _this;
2865
2872
  }
2866
2873
 
@@ -2883,19 +2890,6 @@ module.exports = function () {
2883
2890
  return this._precision;
2884
2891
  }
2885
2892
 
2886
- /**
2887
- * An alternate human-readable description.
2888
- *
2889
- * @public
2890
- * @returns {String}
2891
- */
2892
-
2893
- }, {
2894
- key: 'alternateDescription',
2895
- get: function get() {
2896
- return this._alternateDescription;
2897
- }
2898
-
2899
2893
  /**
2900
2894
  * Given a code, returns the enumeration item.
2901
2895
  *
@@ -2953,9 +2947,9 @@ module.exports = function () {
2953
2947
  return Currency;
2954
2948
  }(Enum);
2955
2949
 
2956
- var cad = new Currency('CAD', 'Canadian Dollar', 2, 'CAD$');
2957
- var eur = new Currency('EUR', 'Euro', 2, 'EUR');
2958
- var usd = new Currency('USD', 'US Dollar', 2, 'US$');
2950
+ var cad = new Currency('CAD', 'Canadian Dollar', 2);
2951
+ var eur = new Currency('EUR', 'Euro', 2);
2952
+ var usd = new Currency('USD', 'US Dollar', 2);
2959
2953
 
2960
2954
  return Currency;
2961
2955
  }();
@@ -3929,9 +3923,9 @@ module.exports = function () {
3929
3923
  assert.argumentIsRequired(a, 'a', Decimal, 'Decimal');
3930
3924
  assert.argumentIsRequired(b, 'b', Decimal, 'Decimal');
3931
3925
 
3932
- if (a._big.gt(b._big)) {
3926
+ if (a._big.gt(b)) {
3933
3927
  return 1;
3934
- } else if (a._big.lt(b._big)) {
3928
+ } else if (a._big.lt(b)) {
3935
3929
  return -1;
3936
3930
  } else {
3937
3931
  return 0;
@@ -4392,10 +4386,12 @@ var _createClass = function () { function defineProperties(target, props) { for
4392
4386
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4393
4387
 
4394
4388
  var assert = require('./assert'),
4389
+ is = require('./is'),
4395
4390
  memoize = require('./memoize');
4396
4391
 
4397
4392
  var Currency = require('./Currency'),
4398
- Decimal = require('./Decimal');
4393
+ Decimal = require('./Decimal'),
4394
+ Enum = require('./Enum');
4399
4395
 
4400
4396
  module.exports = function () {
4401
4397
  'use strict';
@@ -4575,7 +4571,12 @@ module.exports = function () {
4575
4571
  assert.argumentIsRequired(amount, 'amount', Decimal, 'Decimal');
4576
4572
  assert.argumentIsRequired(currency, 'currency', Currency, 'Currency');
4577
4573
  assert.argumentIsRequired(desiredCurrency, 'desiredCurrency', Currency, 'Currency');
4578
- //assert.argumentIsArray(rates, 'rates', Rate, 'Rate');
4574
+
4575
+ for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
4576
+ rates[_key - 3] = arguments[_key];
4577
+ }
4578
+
4579
+ assert.argumentIsArray(rates, 'rates', Rate, 'Rate');
4579
4580
 
4580
4581
  var converted = void 0;
4581
4582
 
@@ -4585,10 +4586,6 @@ module.exports = function () {
4585
4586
  var numerator = desiredCurrency;
4586
4587
  var denominator = currency;
4587
4588
 
4588
- for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
4589
- rates[_key - 3] = arguments[_key];
4590
- }
4591
-
4592
4589
  var rate = rates.find(function (r) {
4593
4590
  return r.numerator === numerator && r.denominator === denominator || r.numerator === denominator && r.denominator === numerator;
4594
4591
  });
@@ -4639,7 +4636,7 @@ module.exports = function () {
4639
4636
  return Rate;
4640
4637
  }();
4641
4638
 
4642
- },{"./Currency":12,"./Decimal":14,"./assert":19,"./memoize":22}],18:[function(require,module,exports){
4639
+ },{"./Currency":12,"./Decimal":14,"./Enum":16,"./assert":19,"./is":21,"./memoize":22}],18:[function(require,module,exports){
4643
4640
  'use strict';
4644
4641
 
4645
4642
  var assert = require('./assert'),