@barchart/portfolio-api-common 1.0.184 → 1.0.185
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.
|
@@ -486,7 +486,7 @@ module.exports = (() => {
|
|
|
486
486
|
getPositions(portfolio) {
|
|
487
487
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
488
488
|
|
|
489
|
-
return getPositionItemsForPortfolio(this._items, portfolio)
|
|
489
|
+
return getPositionItemsForPortfolio(this._items, portfolio);
|
|
490
490
|
}
|
|
491
491
|
|
|
492
492
|
/**
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){function
|
|
1
|
+
(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
|
|
2
2
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
3
3
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
4
4
|
|
|
@@ -1202,7 +1202,7 @@ module.exports = (() => {
|
|
|
1202
1202
|
getPositions(portfolio) {
|
|
1203
1203
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
1204
1204
|
|
|
1205
|
-
return getPositionItemsForPortfolio(this._items, portfolio)
|
|
1205
|
+
return getPositionItemsForPortfolio(this._items, portfolio);
|
|
1206
1206
|
}
|
|
1207
1207
|
|
|
1208
1208
|
/**
|
|
@@ -3343,23 +3343,6 @@ module.exports = function () {
|
|
|
3343
3343
|
}
|
|
3344
3344
|
}
|
|
3345
3345
|
|
|
3346
|
-
/**
|
|
3347
|
-
* Removes the current node from the parent tree. Use on a root node
|
|
3348
|
-
* has no effect.
|
|
3349
|
-
*
|
|
3350
|
-
* @public
|
|
3351
|
-
*/
|
|
3352
|
-
|
|
3353
|
-
}, {
|
|
3354
|
-
key: 'sever',
|
|
3355
|
-
value: function sever() {
|
|
3356
|
-
if (this.getIsRoot()) {
|
|
3357
|
-
return;
|
|
3358
|
-
}
|
|
3359
|
-
|
|
3360
|
-
this.getParent().removeChild(this);
|
|
3361
|
-
}
|
|
3362
|
-
|
|
3363
3346
|
/**
|
|
3364
3347
|
* Searches the children nodes for the first child node that matches the
|
|
3365
3348
|
* predicate.
|
|
@@ -3886,7 +3869,7 @@ module.exports = function () {
|
|
|
3886
3869
|
var Currency = function (_Enum) {
|
|
3887
3870
|
_inherits(Currency, _Enum);
|
|
3888
3871
|
|
|
3889
|
-
function Currency(code, description, precision
|
|
3872
|
+
function Currency(code, description, precision) {
|
|
3890
3873
|
_classCallCheck(this, Currency);
|
|
3891
3874
|
|
|
3892
3875
|
var _this = _possibleConstructorReturn(this, (Currency.__proto__ || Object.getPrototypeOf(Currency)).call(this, code, description));
|
|
@@ -3894,11 +3877,7 @@ module.exports = function () {
|
|
|
3894
3877
|
assert.argumentIsRequired(precision, 'precision', Number);
|
|
3895
3878
|
assert.argumentIsValid(precision, 'precision', is.integer, 'is an integer');
|
|
3896
3879
|
|
|
3897
|
-
assert.argumentIsOptional(alternateDescription, 'alternateDescription', String);
|
|
3898
|
-
|
|
3899
3880
|
_this._precision = precision;
|
|
3900
|
-
|
|
3901
|
-
_this._alternateDescription = alternateDescription || description;
|
|
3902
3881
|
return _this;
|
|
3903
3882
|
}
|
|
3904
3883
|
|
|
@@ -3921,19 +3900,6 @@ module.exports = function () {
|
|
|
3921
3900
|
return this._precision;
|
|
3922
3901
|
}
|
|
3923
3902
|
|
|
3924
|
-
/**
|
|
3925
|
-
* An alternate human-readable description.
|
|
3926
|
-
*
|
|
3927
|
-
* @public
|
|
3928
|
-
* @returns {String}
|
|
3929
|
-
*/
|
|
3930
|
-
|
|
3931
|
-
}, {
|
|
3932
|
-
key: 'alternateDescription',
|
|
3933
|
-
get: function get() {
|
|
3934
|
-
return this._alternateDescription;
|
|
3935
|
-
}
|
|
3936
|
-
|
|
3937
3903
|
/**
|
|
3938
3904
|
* Given a code, returns the enumeration item.
|
|
3939
3905
|
*
|
|
@@ -3991,9 +3957,9 @@ module.exports = function () {
|
|
|
3991
3957
|
return Currency;
|
|
3992
3958
|
}(Enum);
|
|
3993
3959
|
|
|
3994
|
-
var cad = new Currency('CAD', 'Canadian Dollar', 2
|
|
3995
|
-
var eur = new Currency('EUR', 'Euro', 2
|
|
3996
|
-
var usd = new Currency('USD', 'US Dollar', 2
|
|
3960
|
+
var cad = new Currency('CAD', 'Canadian Dollar', 2);
|
|
3961
|
+
var eur = new Currency('EUR', 'Euro', 2);
|
|
3962
|
+
var usd = new Currency('USD', 'US Dollar', 2);
|
|
3997
3963
|
|
|
3998
3964
|
return Currency;
|
|
3999
3965
|
}();
|
|
@@ -4754,20 +4720,6 @@ module.exports = function () {
|
|
|
4754
4720
|
return this._big.gt(getBig(other));
|
|
4755
4721
|
}
|
|
4756
4722
|
|
|
4757
|
-
/**
|
|
4758
|
-
* Returns true if the current instance is greater than or equal to the value.
|
|
4759
|
-
*
|
|
4760
|
-
* @public
|
|
4761
|
-
* @param {Decimal|Number|String} other - The value to compare.
|
|
4762
|
-
* @returns {Boolean}
|
|
4763
|
-
*/
|
|
4764
|
-
|
|
4765
|
-
}, {
|
|
4766
|
-
key: 'getIsGreaterThanOrEqual',
|
|
4767
|
-
value: function getIsGreaterThanOrEqual(other) {
|
|
4768
|
-
return this._big.gte(getBig(other));
|
|
4769
|
-
}
|
|
4770
|
-
|
|
4771
4723
|
/**
|
|
4772
4724
|
* Returns true if the current instance is less than the value.
|
|
4773
4725
|
*
|
|
@@ -4782,20 +4734,6 @@ module.exports = function () {
|
|
|
4782
4734
|
return this._big.lt(getBig(other));
|
|
4783
4735
|
}
|
|
4784
4736
|
|
|
4785
|
-
/**
|
|
4786
|
-
* Returns true if the current instance is less than or equal to the value.
|
|
4787
|
-
*
|
|
4788
|
-
* @public
|
|
4789
|
-
* @param {Decimal|Number|String} other - The value to compare.
|
|
4790
|
-
* @returns {Boolean}
|
|
4791
|
-
*/
|
|
4792
|
-
|
|
4793
|
-
}, {
|
|
4794
|
-
key: 'getIsLessThanOrEqual',
|
|
4795
|
-
value: function getIsLessThanOrEqual(other) {
|
|
4796
|
-
return this._big.lte(getBig(other));
|
|
4797
|
-
}
|
|
4798
|
-
|
|
4799
4737
|
/**
|
|
4800
4738
|
* Returns true if the current instance is equal to the value.
|
|
4801
4739
|
*
|
|
@@ -4995,9 +4933,9 @@ module.exports = function () {
|
|
|
4995
4933
|
assert.argumentIsRequired(a, 'a', Decimal, 'Decimal');
|
|
4996
4934
|
assert.argumentIsRequired(b, 'b', Decimal, 'Decimal');
|
|
4997
4935
|
|
|
4998
|
-
if (a._big.gt(b
|
|
4936
|
+
if (a._big.gt(b)) {
|
|
4999
4937
|
return 1;
|
|
5000
|
-
} else if (a._big.lt(b
|
|
4938
|
+
} else if (a._big.lt(b)) {
|
|
5001
4939
|
return -1;
|
|
5002
4940
|
} else {
|
|
5003
4941
|
return 0;
|
|
@@ -5458,10 +5396,12 @@ var _createClass = function () { function defineProperties(target, props) { for
|
|
|
5458
5396
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5459
5397
|
|
|
5460
5398
|
var assert = require('./assert'),
|
|
5399
|
+
is = require('./is'),
|
|
5461
5400
|
memoize = require('./memoize');
|
|
5462
5401
|
|
|
5463
5402
|
var Currency = require('./Currency'),
|
|
5464
|
-
Decimal = require('./Decimal')
|
|
5403
|
+
Decimal = require('./Decimal'),
|
|
5404
|
+
Enum = require('./Enum');
|
|
5465
5405
|
|
|
5466
5406
|
module.exports = function () {
|
|
5467
5407
|
'use strict';
|
|
@@ -5641,7 +5581,12 @@ module.exports = function () {
|
|
|
5641
5581
|
assert.argumentIsRequired(amount, 'amount', Decimal, 'Decimal');
|
|
5642
5582
|
assert.argumentIsRequired(currency, 'currency', Currency, 'Currency');
|
|
5643
5583
|
assert.argumentIsRequired(desiredCurrency, 'desiredCurrency', Currency, 'Currency');
|
|
5644
|
-
|
|
5584
|
+
|
|
5585
|
+
for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
5586
|
+
rates[_key - 3] = arguments[_key];
|
|
5587
|
+
}
|
|
5588
|
+
|
|
5589
|
+
assert.argumentIsArray(rates, 'rates', Rate, 'Rate');
|
|
5645
5590
|
|
|
5646
5591
|
var converted = void 0;
|
|
5647
5592
|
|
|
@@ -5651,10 +5596,6 @@ module.exports = function () {
|
|
|
5651
5596
|
var numerator = desiredCurrency;
|
|
5652
5597
|
var denominator = currency;
|
|
5653
5598
|
|
|
5654
|
-
for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
5655
|
-
rates[_key - 3] = arguments[_key];
|
|
5656
|
-
}
|
|
5657
|
-
|
|
5658
5599
|
var rate = rates.find(function (r) {
|
|
5659
5600
|
return r.numerator === numerator && r.denominator === denominator || r.numerator === denominator && r.denominator === numerator;
|
|
5660
5601
|
});
|
|
@@ -5705,7 +5646,7 @@ module.exports = function () {
|
|
|
5705
5646
|
return Rate;
|
|
5706
5647
|
}();
|
|
5707
5648
|
|
|
5708
|
-
},{"./Currency":15,"./Decimal":17,"./assert":22,"./memoize":25}],21:[function(require,module,exports){
|
|
5649
|
+
},{"./Currency":15,"./Decimal":17,"./Enum":19,"./assert":22,"./is":24,"./memoize":25}],21:[function(require,module,exports){
|
|
5709
5650
|
'use strict';
|
|
5710
5651
|
|
|
5711
5652
|
var assert = require('./assert'),
|
|
@@ -6082,26 +6023,6 @@ module.exports = function () {
|
|
|
6082
6023
|
});
|
|
6083
6024
|
|
|
6084
6025
|
return returnRef;
|
|
6085
|
-
},
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
/**
|
|
6089
|
-
* Removes the first item from an array which matches a predicate.
|
|
6090
|
-
*
|
|
6091
|
-
* @static
|
|
6092
|
-
* @public
|
|
6093
|
-
* @param {Array} a
|
|
6094
|
-
* @param {Function} predicate
|
|
6095
|
-
*/
|
|
6096
|
-
remove: function remove(a, predicate) {
|
|
6097
|
-
assert.argumentIsArray(a, 'a');
|
|
6098
|
-
assert.argumentIsRequired(predicate, 'predicate', Function);
|
|
6099
|
-
|
|
6100
|
-
var index = a.findIndex(predicate);
|
|
6101
|
-
|
|
6102
|
-
if (!(index < 0)) {
|
|
6103
|
-
a.splice(index, 1);
|
|
6104
|
-
}
|
|
6105
6026
|
}
|
|
6106
6027
|
};
|
|
6107
6028
|
}();
|