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