@barchart/portfolio-api-common 1.0.138 → 1.0.139

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.
@@ -264,7 +264,7 @@ module.exports = (() => {
264
264
  assert.argumentIsRequired(value, 'value', Boolean);
265
265
 
266
266
  if (this._showClosedPositions !== value) {
267
- this._showClosedPositionsChangeEvent(this._showClosedPositions = value);
267
+ this._showClosedPositionsChangeEvent.fire(this._showClosedPositions = value);
268
268
  }
269
269
  }
270
270
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.138",
3
+ "version": "1.0.139",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1423,7 +1423,7 @@ module.exports = (() => {
1423
1423
  assert.argumentIsRequired(value, 'value', Boolean);
1424
1424
 
1425
1425
  if (this._showClosedPositions !== value) {
1426
- this._showClosedPositionsChangeEvent(this._showClosedPositions = value);
1426
+ this._showClosedPositionsChangeEvent.fire(this._showClosedPositions = value);
1427
1427
  }
1428
1428
  }
1429
1429
 
@@ -2859,7 +2859,7 @@ module.exports = function () {
2859
2859
  var Currency = function (_Enum) {
2860
2860
  _inherits(Currency, _Enum);
2861
2861
 
2862
- function Currency(code, description, precision) {
2862
+ function Currency(code, description, precision, alternateDescription) {
2863
2863
  _classCallCheck(this, Currency);
2864
2864
 
2865
2865
  var _this = _possibleConstructorReturn(this, (Currency.__proto__ || Object.getPrototypeOf(Currency)).call(this, code, description));
@@ -2867,7 +2867,11 @@ module.exports = function () {
2867
2867
  assert.argumentIsRequired(precision, 'precision', Number);
2868
2868
  assert.argumentIsValid(precision, 'precision', is.integer, 'is an integer');
2869
2869
 
2870
+ assert.argumentIsOptional(alternateDescription, 'alternateDescription', String);
2871
+
2870
2872
  _this._precision = precision;
2873
+
2874
+ _this._alternateDescription = alternateDescription || description;
2871
2875
  return _this;
2872
2876
  }
2873
2877
 
@@ -2890,6 +2894,19 @@ module.exports = function () {
2890
2894
  return this._precision;
2891
2895
  }
2892
2896
 
2897
+ /**
2898
+ * An alternate human-readable description.
2899
+ *
2900
+ * @public
2901
+ * @returns {String}
2902
+ */
2903
+
2904
+ }, {
2905
+ key: 'alternateDescription',
2906
+ get: function get() {
2907
+ return this._alternateDescription;
2908
+ }
2909
+
2893
2910
  /**
2894
2911
  * Given a code, returns the enumeration item.
2895
2912
  *
@@ -2947,9 +2964,9 @@ module.exports = function () {
2947
2964
  return Currency;
2948
2965
  }(Enum);
2949
2966
 
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);
2967
+ var cad = new Currency('CAD', 'Canadian Dollar', 2, 'CAD$');
2968
+ var eur = new Currency('EUR', 'Euro', 2, 'EUR');
2969
+ var usd = new Currency('USD', 'US Dollar', 2, 'US$');
2953
2970
 
2954
2971
  return Currency;
2955
2972
  }();
@@ -3923,9 +3940,9 @@ module.exports = function () {
3923
3940
  assert.argumentIsRequired(a, 'a', Decimal, 'Decimal');
3924
3941
  assert.argumentIsRequired(b, 'b', Decimal, 'Decimal');
3925
3942
 
3926
- if (a._big.gt(b)) {
3943
+ if (a._big.gt(b._big)) {
3927
3944
  return 1;
3928
- } else if (a._big.lt(b)) {
3945
+ } else if (a._big.lt(b._big)) {
3929
3946
  return -1;
3930
3947
  } else {
3931
3948
  return 0;
@@ -4386,12 +4403,10 @@ var _createClass = function () { function defineProperties(target, props) { for
4386
4403
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4387
4404
 
4388
4405
  var assert = require('./assert'),
4389
- is = require('./is'),
4390
4406
  memoize = require('./memoize');
4391
4407
 
4392
4408
  var Currency = require('./Currency'),
4393
- Decimal = require('./Decimal'),
4394
- Enum = require('./Enum');
4409
+ Decimal = require('./Decimal');
4395
4410
 
4396
4411
  module.exports = function () {
4397
4412
  'use strict';
@@ -4571,12 +4586,7 @@ module.exports = function () {
4571
4586
  assert.argumentIsRequired(amount, 'amount', Decimal, 'Decimal');
4572
4587
  assert.argumentIsRequired(currency, 'currency', Currency, 'Currency');
4573
4588
  assert.argumentIsRequired(desiredCurrency, 'desiredCurrency', Currency, 'Currency');
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');
4589
+ //assert.argumentIsArray(rates, 'rates', Rate, 'Rate');
4580
4590
 
4581
4591
  var converted = void 0;
4582
4592
 
@@ -4586,6 +4596,10 @@ module.exports = function () {
4586
4596
  var numerator = desiredCurrency;
4587
4597
  var denominator = currency;
4588
4598
 
4599
+ for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
4600
+ rates[_key - 3] = arguments[_key];
4601
+ }
4602
+
4589
4603
  var rate = rates.find(function (r) {
4590
4604
  return r.numerator === numerator && r.denominator === denominator || r.numerator === denominator && r.denominator === numerator;
4591
4605
  });
@@ -4636,7 +4650,7 @@ module.exports = function () {
4636
4650
  return Rate;
4637
4651
  }();
4638
4652
 
4639
- },{"./Currency":12,"./Decimal":14,"./Enum":16,"./assert":19,"./is":21,"./memoize":22}],18:[function(require,module,exports){
4653
+ },{"./Currency":12,"./Decimal":14,"./assert":19,"./memoize":22}],18:[function(require,module,exports){
4640
4654
  'use strict';
4641
4655
 
4642
4656
  var assert = require('./assert'),