@barchart/portfolio-api-common 1.0.164 → 1.0.165
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.
- package/lib/processing/PositionContainer.js +10 -0
- package/package.json +1 -1
- package/test/SpecRunner.js +26 -30
|
@@ -408,6 +408,16 @@ module.exports = (() => {
|
|
|
408
408
|
return findNode(this._trees[name], keys).getChildren().map(node => node.getValue());
|
|
409
409
|
}
|
|
410
410
|
|
|
411
|
+
/**
|
|
412
|
+
* Returns all portfolios in the container
|
|
413
|
+
*
|
|
414
|
+
* @public
|
|
415
|
+
* @return {Array.<Object>}
|
|
416
|
+
*/
|
|
417
|
+
getPortfolios() {
|
|
418
|
+
return this._portfolios;
|
|
419
|
+
}
|
|
420
|
+
|
|
411
421
|
/**
|
|
412
422
|
* Returns all positions for the given portfolio.
|
|
413
423
|
*
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1124,6 +1124,16 @@ module.exports = (() => {
|
|
|
1124
1124
|
return findNode(this._trees[name], keys).getChildren().map(node => node.getValue());
|
|
1125
1125
|
}
|
|
1126
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* Returns all portfolios in the container
|
|
1129
|
+
*
|
|
1130
|
+
* @public
|
|
1131
|
+
* @return {Array.<Object>}
|
|
1132
|
+
*/
|
|
1133
|
+
getPortfolios() {
|
|
1134
|
+
return this._portfolios;
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1127
1137
|
/**
|
|
1128
1138
|
* Returns all positions for the given portfolio.
|
|
1129
1139
|
*
|
|
@@ -3524,7 +3534,7 @@ module.exports = function () {
|
|
|
3524
3534
|
var Currency = function (_Enum) {
|
|
3525
3535
|
_inherits(Currency, _Enum);
|
|
3526
3536
|
|
|
3527
|
-
function Currency(code, description, precision
|
|
3537
|
+
function Currency(code, description, precision) {
|
|
3528
3538
|
_classCallCheck(this, Currency);
|
|
3529
3539
|
|
|
3530
3540
|
var _this = _possibleConstructorReturn(this, (Currency.__proto__ || Object.getPrototypeOf(Currency)).call(this, code, description));
|
|
@@ -3532,11 +3542,7 @@ module.exports = function () {
|
|
|
3532
3542
|
assert.argumentIsRequired(precision, 'precision', Number);
|
|
3533
3543
|
assert.argumentIsValid(precision, 'precision', is.integer, 'is an integer');
|
|
3534
3544
|
|
|
3535
|
-
assert.argumentIsOptional(alternateDescription, 'alternateDescription', String);
|
|
3536
|
-
|
|
3537
3545
|
_this._precision = precision;
|
|
3538
|
-
|
|
3539
|
-
_this._alternateDescription = alternateDescription || description;
|
|
3540
3546
|
return _this;
|
|
3541
3547
|
}
|
|
3542
3548
|
|
|
@@ -3559,19 +3565,6 @@ module.exports = function () {
|
|
|
3559
3565
|
return this._precision;
|
|
3560
3566
|
}
|
|
3561
3567
|
|
|
3562
|
-
/**
|
|
3563
|
-
* An alternate human-readable description.
|
|
3564
|
-
*
|
|
3565
|
-
* @public
|
|
3566
|
-
* @returns {String}
|
|
3567
|
-
*/
|
|
3568
|
-
|
|
3569
|
-
}, {
|
|
3570
|
-
key: 'alternateDescription',
|
|
3571
|
-
get: function get() {
|
|
3572
|
-
return this._alternateDescription;
|
|
3573
|
-
}
|
|
3574
|
-
|
|
3575
3568
|
/**
|
|
3576
3569
|
* Given a code, returns the enumeration item.
|
|
3577
3570
|
*
|
|
@@ -3629,9 +3622,9 @@ module.exports = function () {
|
|
|
3629
3622
|
return Currency;
|
|
3630
3623
|
}(Enum);
|
|
3631
3624
|
|
|
3632
|
-
var cad = new Currency('CAD', 'Canadian Dollar', 2
|
|
3633
|
-
var eur = new Currency('EUR', 'Euro', 2
|
|
3634
|
-
var usd = new Currency('USD', 'US Dollar', 2
|
|
3625
|
+
var cad = new Currency('CAD', 'Canadian Dollar', 2);
|
|
3626
|
+
var eur = new Currency('EUR', 'Euro', 2);
|
|
3627
|
+
var usd = new Currency('USD', 'US Dollar', 2);
|
|
3635
3628
|
|
|
3636
3629
|
return Currency;
|
|
3637
3630
|
}();
|
|
@@ -4605,9 +4598,9 @@ module.exports = function () {
|
|
|
4605
4598
|
assert.argumentIsRequired(a, 'a', Decimal, 'Decimal');
|
|
4606
4599
|
assert.argumentIsRequired(b, 'b', Decimal, 'Decimal');
|
|
4607
4600
|
|
|
4608
|
-
if (a._big.gt(b
|
|
4601
|
+
if (a._big.gt(b)) {
|
|
4609
4602
|
return 1;
|
|
4610
|
-
} else if (a._big.lt(b
|
|
4603
|
+
} else if (a._big.lt(b)) {
|
|
4611
4604
|
return -1;
|
|
4612
4605
|
} else {
|
|
4613
4606
|
return 0;
|
|
@@ -5068,10 +5061,12 @@ var _createClass = function () { function defineProperties(target, props) { for
|
|
|
5068
5061
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5069
5062
|
|
|
5070
5063
|
var assert = require('./assert'),
|
|
5064
|
+
is = require('./is'),
|
|
5071
5065
|
memoize = require('./memoize');
|
|
5072
5066
|
|
|
5073
5067
|
var Currency = require('./Currency'),
|
|
5074
|
-
Decimal = require('./Decimal')
|
|
5068
|
+
Decimal = require('./Decimal'),
|
|
5069
|
+
Enum = require('./Enum');
|
|
5075
5070
|
|
|
5076
5071
|
module.exports = function () {
|
|
5077
5072
|
'use strict';
|
|
@@ -5251,7 +5246,12 @@ module.exports = function () {
|
|
|
5251
5246
|
assert.argumentIsRequired(amount, 'amount', Decimal, 'Decimal');
|
|
5252
5247
|
assert.argumentIsRequired(currency, 'currency', Currency, 'Currency');
|
|
5253
5248
|
assert.argumentIsRequired(desiredCurrency, 'desiredCurrency', Currency, 'Currency');
|
|
5254
|
-
|
|
5249
|
+
|
|
5250
|
+
for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
5251
|
+
rates[_key - 3] = arguments[_key];
|
|
5252
|
+
}
|
|
5253
|
+
|
|
5254
|
+
assert.argumentIsArray(rates, 'rates', Rate, 'Rate');
|
|
5255
5255
|
|
|
5256
5256
|
var converted = void 0;
|
|
5257
5257
|
|
|
@@ -5261,10 +5261,6 @@ module.exports = function () {
|
|
|
5261
5261
|
var numerator = desiredCurrency;
|
|
5262
5262
|
var denominator = currency;
|
|
5263
5263
|
|
|
5264
|
-
for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
5265
|
-
rates[_key - 3] = arguments[_key];
|
|
5266
|
-
}
|
|
5267
|
-
|
|
5268
5264
|
var rate = rates.find(function (r) {
|
|
5269
5265
|
return r.numerator === numerator && r.denominator === denominator || r.numerator === denominator && r.denominator === numerator;
|
|
5270
5266
|
});
|
|
@@ -5315,7 +5311,7 @@ module.exports = function () {
|
|
|
5315
5311
|
return Rate;
|
|
5316
5312
|
}();
|
|
5317
5313
|
|
|
5318
|
-
},{"./Currency":14,"./Decimal":16,"./assert":21,"./memoize":24}],20:[function(require,module,exports){
|
|
5314
|
+
},{"./Currency":14,"./Decimal":16,"./Enum":18,"./assert":21,"./is":23,"./memoize":24}],20:[function(require,module,exports){
|
|
5319
5315
|
'use strict';
|
|
5320
5316
|
|
|
5321
5317
|
var assert = require('./assert'),
|