@barchart/portfolio-api-common 1.2.61 → 1.2.65
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.
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
Currency = require('@barchart/common-js/lang/Currency'),
|
|
1
|
+
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
3
2
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
4
3
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
5
|
-
is = require('@barchart/common-js/lang/is'),
|
|
6
4
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
7
5
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder'),
|
|
8
6
|
Timezones = require('@barchart/common-js/lang/Timezones');
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
Currency = require('@barchart/common-js/lang/Currency'),
|
|
1
|
+
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
3
2
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
4
3
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
5
|
-
is = require('@barchart/common-js/lang/is'),
|
|
6
4
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
7
5
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
8
6
|
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
Currency = require('@barchart/common-js/lang/Currency'),
|
|
1
|
+
const Currency = require('@barchart/common-js/lang/Currency'),
|
|
3
2
|
DataType = require('@barchart/common-js/serialization/json/DataType'),
|
|
4
3
|
Enum = require('@barchart/common-js/lang/Enum'),
|
|
5
|
-
is = require('@barchart/common-js/lang/is'),
|
|
6
4
|
Schema = require('@barchart/common-js/serialization/json/Schema'),
|
|
7
5
|
SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
|
|
8
6
|
|
|
@@ -66,13 +64,6 @@ module.exports = (() => {
|
|
|
66
64
|
.withField('user', DataType.STRING)
|
|
67
65
|
.withField('portfolio', DataType.STRING)
|
|
68
66
|
.withField('position', DataType.STRING)
|
|
69
|
-
.withField('instrument.id', DataType.STRING)
|
|
70
|
-
.withField('instrument.name', DataType.STRING)
|
|
71
|
-
.withField('instrument.type', DataType.STRING)
|
|
72
|
-
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
|
|
73
|
-
.withField('instrument.delist', DataType.DAY, true)
|
|
74
|
-
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
75
|
-
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
76
67
|
.withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
|
|
77
68
|
.withField('start.date', DataType.DAY)
|
|
78
69
|
.withField('start.sequence', DataType.NUMBER)
|
|
@@ -100,13 +91,6 @@ module.exports = (() => {
|
|
|
100
91
|
.withField('user', DataType.STRING)
|
|
101
92
|
.withField('portfolio', DataType.STRING)
|
|
102
93
|
.withField('position', DataType.STRING)
|
|
103
|
-
.withField('instrument.id', DataType.STRING)
|
|
104
|
-
.withField('instrument.name', DataType.STRING)
|
|
105
|
-
.withField('instrument.type', DataType.STRING)
|
|
106
|
-
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
|
|
107
|
-
.withField('instrument.delist', DataType.DAY, true)
|
|
108
|
-
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
109
|
-
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
110
94
|
.withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
|
|
111
95
|
.withField('start.date', DataType.DAY)
|
|
112
96
|
.withField('start.sequence', DataType.NUMBER)
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -5179,8 +5179,8 @@ module.exports = function () {
|
|
|
5179
5179
|
* Compares two strings (in ascending order), using {@link String#localeCompare}.
|
|
5180
5180
|
*
|
|
5181
5181
|
* @static
|
|
5182
|
-
* @param {
|
|
5183
|
-
* @param {
|
|
5182
|
+
* @param {String} a
|
|
5183
|
+
* @param {String} b
|
|
5184
5184
|
* @returns {Number}
|
|
5185
5185
|
*/
|
|
5186
5186
|
compareStrings: function compareStrings(a, b) {
|
|
@@ -5870,7 +5870,7 @@ module.exports = function () {
|
|
|
5870
5870
|
* @returns {String}
|
|
5871
5871
|
*/
|
|
5872
5872
|
value: function format() {
|
|
5873
|
-
return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
|
|
5873
|
+
return leftPad(this._year, 4, '0') + '-' + leftPad(this._month, 2, '0') + '-' + leftPad(this._day, 2, '0');
|
|
5874
5874
|
}
|
|
5875
5875
|
|
|
5876
5876
|
/**
|
|
@@ -5987,7 +5987,7 @@ module.exports = function () {
|
|
|
5987
5987
|
*
|
|
5988
5988
|
* @static
|
|
5989
5989
|
* @public
|
|
5990
|
-
* @
|
|
5990
|
+
* @returns {Day}
|
|
5991
5991
|
*/
|
|
5992
5992
|
|
|
5993
5993
|
}, {
|
|
@@ -6079,8 +6079,11 @@ module.exports = function () {
|
|
|
6079
6079
|
|
|
6080
6080
|
var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
|
|
6081
6081
|
|
|
6082
|
-
function leftPad(value) {
|
|
6083
|
-
|
|
6082
|
+
function leftPad(value, digits, character) {
|
|
6083
|
+
var string = value.toString();
|
|
6084
|
+
var padding = digits - string.length;
|
|
6085
|
+
|
|
6086
|
+
return '' + character.repeat(padding) + string;
|
|
6084
6087
|
}
|
|
6085
6088
|
|
|
6086
6089
|
var comparator = ComparatorBuilder.startWith(function (a, b) {
|
|
@@ -6246,15 +6249,17 @@ module.exports = function () {
|
|
|
6246
6249
|
*
|
|
6247
6250
|
* @public
|
|
6248
6251
|
* @param {Boolean=} approximate
|
|
6252
|
+
* @param {Number=} places
|
|
6249
6253
|
* @returns {Boolean}
|
|
6250
6254
|
*/
|
|
6251
6255
|
|
|
6252
6256
|
}, {
|
|
6253
6257
|
key: 'getIsZero',
|
|
6254
|
-
value: function getIsZero(approximate) {
|
|
6258
|
+
value: function getIsZero(approximate, places) {
|
|
6255
6259
|
assert.argumentIsOptional(approximate, 'approximate', Boolean);
|
|
6260
|
+
assert.argumentIsOptional(places, 'places', Number);
|
|
6256
6261
|
|
|
6257
|
-
return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(
|
|
6262
|
+
return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(places || Big.DP, RoundingMode.NORMAL).getIsZero();
|
|
6258
6263
|
}
|
|
6259
6264
|
|
|
6260
6265
|
/**
|
|
@@ -6353,6 +6358,43 @@ module.exports = function () {
|
|
|
6353
6358
|
return this._big.eq(getBig(other));
|
|
6354
6359
|
}
|
|
6355
6360
|
|
|
6361
|
+
/**
|
|
6362
|
+
* Returns true if the current instance is an integer (i.e. has no decimal
|
|
6363
|
+
* component).
|
|
6364
|
+
*
|
|
6365
|
+
* @public
|
|
6366
|
+
* @return {Boolean}
|
|
6367
|
+
*/
|
|
6368
|
+
|
|
6369
|
+
}, {
|
|
6370
|
+
key: 'getIsInteger',
|
|
6371
|
+
value: function getIsInteger() {
|
|
6372
|
+
return this.getIsEqual(this.round(0));
|
|
6373
|
+
}
|
|
6374
|
+
|
|
6375
|
+
/**
|
|
6376
|
+
* Returns the number of decimal places used.
|
|
6377
|
+
*
|
|
6378
|
+
* @public
|
|
6379
|
+
* @returns {Number}
|
|
6380
|
+
*/
|
|
6381
|
+
|
|
6382
|
+
}, {
|
|
6383
|
+
key: 'getDecimalPlaces',
|
|
6384
|
+
value: function getDecimalPlaces() {
|
|
6385
|
+
var matches = this.toFixed().match(/-?\d*\.(\d*)/);
|
|
6386
|
+
|
|
6387
|
+
var returnVal = void 0;
|
|
6388
|
+
|
|
6389
|
+
if (matches === null) {
|
|
6390
|
+
returnVal = 0;
|
|
6391
|
+
} else {
|
|
6392
|
+
returnVal = matches[1].length;
|
|
6393
|
+
}
|
|
6394
|
+
|
|
6395
|
+
return returnVal;
|
|
6396
|
+
}
|
|
6397
|
+
|
|
6356
6398
|
/**
|
|
6357
6399
|
* Emits a floating point value that approximates the value of the current
|
|
6358
6400
|
* instance.
|
|
@@ -6435,7 +6477,7 @@ module.exports = function () {
|
|
|
6435
6477
|
*
|
|
6436
6478
|
* @public
|
|
6437
6479
|
* @param {Decimal} instance
|
|
6438
|
-
* @
|
|
6480
|
+
* @returns {Boolean}
|
|
6439
6481
|
*/
|
|
6440
6482
|
value: function getIsZero(instance) {
|
|
6441
6483
|
assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
|
|
@@ -6448,7 +6490,7 @@ module.exports = function () {
|
|
|
6448
6490
|
*
|
|
6449
6491
|
* @public
|
|
6450
6492
|
* @param {Decimal} instance
|
|
6451
|
-
* @
|
|
6493
|
+
* @returns {Boolean}
|
|
6452
6494
|
*/
|
|
6453
6495
|
|
|
6454
6496
|
}, {
|
|
@@ -6464,7 +6506,7 @@ module.exports = function () {
|
|
|
6464
6506
|
*
|
|
6465
6507
|
* @public
|
|
6466
6508
|
* @param {Decimal} instance
|
|
6467
|
-
* @
|
|
6509
|
+
* @returns {Boolean}
|
|
6468
6510
|
*/
|
|
6469
6511
|
|
|
6470
6512
|
}, {
|
|
@@ -6480,7 +6522,7 @@ module.exports = function () {
|
|
|
6480
6522
|
*
|
|
6481
6523
|
* @public
|
|
6482
6524
|
* @param {Decimal} instance
|
|
6483
|
-
* @
|
|
6525
|
+
* @returns {Boolean}
|
|
6484
6526
|
*/
|
|
6485
6527
|
|
|
6486
6528
|
}, {
|
|
@@ -6496,7 +6538,7 @@ module.exports = function () {
|
|
|
6496
6538
|
*
|
|
6497
6539
|
* @public
|
|
6498
6540
|
* @param {Decimal} instance
|
|
6499
|
-
* @
|
|
6541
|
+
* @returns {Boolean}
|
|
6500
6542
|
*/
|
|
6501
6543
|
|
|
6502
6544
|
}, {
|
|
@@ -6512,7 +6554,7 @@ module.exports = function () {
|
|
|
6512
6554
|
*
|
|
6513
6555
|
* @public
|
|
6514
6556
|
* @param {Decimal} instance
|
|
6515
|
-
* @
|
|
6557
|
+
* @returns {Boolean}
|
|
6516
6558
|
*/
|
|
6517
6559
|
|
|
6518
6560
|
}, {
|
|
@@ -6902,6 +6944,7 @@ module.exports = function () {
|
|
|
6902
6944
|
/**
|
|
6903
6945
|
* The unique code.
|
|
6904
6946
|
*
|
|
6947
|
+
* @public
|
|
6905
6948
|
* @returns {String}
|
|
6906
6949
|
*/
|
|
6907
6950
|
|
|
@@ -6914,6 +6957,7 @@ module.exports = function () {
|
|
|
6914
6957
|
* Returns true if the provided {@link Enum} argument is equal
|
|
6915
6958
|
* to the instance.
|
|
6916
6959
|
*
|
|
6960
|
+
* @public
|
|
6917
6961
|
* @param {Enum} other
|
|
6918
6962
|
* @returns {boolean}
|
|
6919
6963
|
*/
|
|
@@ -6938,6 +6982,7 @@ module.exports = function () {
|
|
|
6938
6982
|
* Looks up a enumeration item; given the enumeration type and the enumeration
|
|
6939
6983
|
* item's value. If no matching item can be found, a null value is returned.
|
|
6940
6984
|
*
|
|
6985
|
+
* @public
|
|
6941
6986
|
* @param {Function} type - The enumeration type.
|
|
6942
6987
|
* @param {String} code - The enumeration item's code.
|
|
6943
6988
|
* @returns {*|null}
|
|
@@ -6957,6 +7002,7 @@ module.exports = function () {
|
|
|
6957
7002
|
/**
|
|
6958
7003
|
* The description.
|
|
6959
7004
|
*
|
|
7005
|
+
* @public
|
|
6960
7006
|
* @returns {String}
|
|
6961
7007
|
*/
|
|
6962
7008
|
|
|
@@ -6976,6 +7022,7 @@ module.exports = function () {
|
|
|
6976
7022
|
/**
|
|
6977
7023
|
* Returns all of the enumeration's items (given an enumeration type).
|
|
6978
7024
|
*
|
|
7025
|
+
* @public
|
|
6979
7026
|
* @param {Function} type - The enumeration to list.
|
|
6980
7027
|
* @returns {Array}
|
|
6981
7028
|
*/
|
|
@@ -7433,7 +7480,7 @@ module.exports = function () {
|
|
|
7433
7480
|
* Parses the value emitted by {@link Timestamp#toJSON}.
|
|
7434
7481
|
*
|
|
7435
7482
|
* @public
|
|
7436
|
-
* @param {
|
|
7483
|
+
* @param {Number} value
|
|
7437
7484
|
* @returns {Timestamp}
|
|
7438
7485
|
*/
|
|
7439
7486
|
|
|
@@ -8069,7 +8116,7 @@ module.exports = function () {
|
|
|
8069
8116
|
|
|
8070
8117
|
if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
|
|
8071
8118
|
itemValidator = function itemValidator(value, index) {
|
|
8072
|
-
return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
|
|
8119
|
+
return itemConstraint.prototype !== undefined && value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
|
|
8073
8120
|
};
|
|
8074
8121
|
} else {
|
|
8075
8122
|
itemValidator = function itemValidator(value, index) {
|
|
@@ -8179,7 +8226,7 @@ module.exports = function () {
|
|
|
8179
8226
|
*
|
|
8180
8227
|
* @static
|
|
8181
8228
|
* @param {Object} target - The object to check for existence of the property.
|
|
8182
|
-
* @param {String|Array
|
|
8229
|
+
* @param {String|Array.<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
|
|
8183
8230
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8184
8231
|
* @returns {boolean}
|
|
8185
8232
|
*/
|
|
@@ -8205,7 +8252,7 @@ module.exports = function () {
|
|
|
8205
8252
|
*
|
|
8206
8253
|
* @static
|
|
8207
8254
|
* @param {Object} target - The object to read from.
|
|
8208
|
-
* @param {String|Array
|
|
8255
|
+
* @param {String|Array.<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
|
|
8209
8256
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8210
8257
|
* @returns {*}
|
|
8211
8258
|
*/
|
|
@@ -8240,7 +8287,8 @@ module.exports = function () {
|
|
|
8240
8287
|
*
|
|
8241
8288
|
* @static
|
|
8242
8289
|
* @param {Object} target - The object to write to.
|
|
8243
|
-
* @param {String|Array
|
|
8290
|
+
* @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
8291
|
+
* @param {*} value - The value to assign.
|
|
8244
8292
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8245
8293
|
*/
|
|
8246
8294
|
write: function write(target, propertyNames, value, separator) {
|
|
@@ -8266,7 +8314,7 @@ module.exports = function () {
|
|
|
8266
8314
|
*
|
|
8267
8315
|
* @static
|
|
8268
8316
|
* @param {Object} target - The object to erase a property from.
|
|
8269
|
-
* @param {String|Array
|
|
8317
|
+
* @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
8270
8318
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8271
8319
|
*/
|
|
8272
8320
|
erase: function erase(target, propertyNames, separator) {
|
|
@@ -9519,7 +9567,7 @@ module.exports = function () {
|
|
|
9519
9567
|
}
|
|
9520
9568
|
|
|
9521
9569
|
/**
|
|
9522
|
-
* Generates a function suitable for use by JSON.parse.
|
|
9570
|
+
* Generates a function suitable for use by {@link JSON.parse}.
|
|
9523
9571
|
*
|
|
9524
9572
|
* @public
|
|
9525
9573
|
* @returns {Function}
|
|
@@ -13644,9 +13692,9 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
13644
13692
|
|
|
13645
13693
|
mom = createUTC([2000, 1]).day(i);
|
|
13646
13694
|
if (strict && !this._fullWeekdaysParse[i]) {
|
|
13647
|
-
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '
|
|
13648
|
-
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '
|
|
13649
|
-
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '
|
|
13695
|
+
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
13696
|
+
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
13697
|
+
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
13650
13698
|
}
|
|
13651
13699
|
if (!this._weekdaysParse[i]) {
|
|
13652
13700
|
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
|
@@ -14449,7 +14497,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
14449
14497
|
|
|
14450
14498
|
function preprocessRFC2822(s) {
|
|
14451
14499
|
// Remove comments and folding whitespace and replace multiple-spaces with a single space
|
|
14452
|
-
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').
|
|
14500
|
+
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
|
14453
14501
|
}
|
|
14454
14502
|
|
|
14455
14503
|
function checkWeekday(weekdayStr, parsedInput, config) {
|
|
@@ -16628,7 +16676,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16628
16676
|
// Side effect imports
|
|
16629
16677
|
|
|
16630
16678
|
|
|
16631
|
-
hooks.version = '2.22.
|
|
16679
|
+
hooks.version = '2.22.2';
|
|
16632
16680
|
|
|
16633
16681
|
setHookCallback(createLocal);
|
|
16634
16682
|
|