@barchart/portfolio-api-common 1.2.72 → 1.2.76
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/api/failures/PortfolioFailureType.js +1 -1
- package/lib/data/TransactionValidator.js +1 -1
- package/lib/processing/PositionContainer.js +15 -0
- package/lib/processing/PositionGroup.js +11 -2
- package/lib/processing/PositionItem.js +44 -12
- package/lib/serialization/PositionSchema.js +2 -0
- package/package.json +1 -1
- package/test/SpecRunner.js +129 -22
|
@@ -230,7 +230,7 @@ module.exports = (() => {
|
|
|
230
230
|
const transactionCreateFailedInvalidInitialType = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_INITIAL_TYPE', 'Unable to process operation because the first transaction would to be a {U|transactionType.description}, which is not allowed -- since {U|transactionType.description} transactions cannot open a position.');
|
|
231
231
|
const transactionCreateFailedTypeReserved = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_RESERVED', 'Unable to create {U|type.description} transaction, this type of transaction is managed by the system.');
|
|
232
232
|
const transactionCreateFailedReinvestPriceUnavailable = new FailureType('TRANSACTION_CREATE_FAILED_REINVEST_PRICE_UNAVAILABLE', 'Unable to create transaction, a dividend was paid on {L|day}; however no historical price is available for this day. To successfully create this transaction, please turn off dividend reinvestment for this position.');
|
|
233
|
-
const transactionCreateFailedPositionLocked = new FailureType('TRANSACTION_CREATE_FAILED_POSITION_LOCKED', 'Unable to create transaction,
|
|
233
|
+
const transactionCreateFailedPositionLocked = new FailureType('TRANSACTION_CREATE_FAILED_POSITION_LOCKED', 'Unable to create transaction, your {L|description} history is being recalculated. Please re-enter this transaction in a minute or two.');
|
|
234
234
|
|
|
235
235
|
const transactionDeleteFailedOutOfSequence = new FailureType('TRANSACTION_DELETE_FAILED_OUT_OF_SEQUENCE', 'Deleting any transaction, except for the most recent, will cause transaction history to be re-written. Please confirm your intent to re-write transaction history (which could take some time and alter the historical results for this position).');
|
|
236
236
|
const transactionDeleteFailedNoTransaction = new FailureType('TRANSACTION_DELETE_FAILED_NO_TRANSACTION', 'Unable to delete transaction. The referenced transaction does not exist.');
|
|
@@ -104,7 +104,7 @@ module.exports = (() => {
|
|
|
104
104
|
assert.argumentIsArray(transactions, 'transactions');
|
|
105
105
|
assert.argumentIsOptional(strict, 'strict', Boolean);
|
|
106
106
|
|
|
107
|
-
return transactions.findIndex((t, i, a) =>
|
|
107
|
+
return transactions.findIndex((t, i, a) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)) || (i !== 0 && is.boolean(strict) && strict && t.date.getIsEqual(a[i - 1].date) && t.type.sequence < a[i - 1].type.sequence));
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
@@ -370,6 +370,19 @@ module.exports = (() => {
|
|
|
370
370
|
return array.unique(symbols);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
setPositionLock(position) {
|
|
374
|
+
assert.argumentIsRequired(position, 'position', Object);
|
|
375
|
+
assert.argumentIsRequired(position.position, 'position.position', String);
|
|
376
|
+
|
|
377
|
+
const item = this._items.find((i) => i.position.position === position.position);
|
|
378
|
+
|
|
379
|
+
if (item) {
|
|
380
|
+
const locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
|
|
381
|
+
|
|
382
|
+
item.setPositionLock(locked);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
373
386
|
/**
|
|
374
387
|
* Performs a batch update of both position quotes and forex quotes,
|
|
375
388
|
* triggering updates to position(s) and data aggregation(s).
|
|
@@ -717,6 +730,8 @@ module.exports = (() => {
|
|
|
717
730
|
});
|
|
718
731
|
}
|
|
719
732
|
}
|
|
733
|
+
|
|
734
|
+
recalculatePercentages.call(this);
|
|
720
735
|
}));
|
|
721
736
|
}
|
|
722
737
|
|
|
@@ -72,6 +72,7 @@ module.exports = (() => {
|
|
|
72
72
|
this._dataFormat.description = this._description;
|
|
73
73
|
this._dataFormat.hide = false;
|
|
74
74
|
this._dataFormat.invalid = false;
|
|
75
|
+
this._dataFormat.locked = false;
|
|
75
76
|
this._dataFormat.newsExists = false;
|
|
76
77
|
this._dataFormat.quantity = null;
|
|
77
78
|
this._dataFormat.basisPrice = null;
|
|
@@ -541,12 +542,17 @@ module.exports = (() => {
|
|
|
541
542
|
});
|
|
542
543
|
|
|
543
544
|
let newsBinding = Disposable.getEmpty();
|
|
545
|
+
let lockedBinding = Disposable.getEmpty();
|
|
544
546
|
|
|
545
547
|
if (this._single) {
|
|
546
548
|
newsBinding = item.registerNewsExistsChangeHandler((exists) => {
|
|
547
549
|
this._dataActual.newsExists = exists;
|
|
548
550
|
this._dataFormat.newsExists = exists;
|
|
549
551
|
});
|
|
552
|
+
|
|
553
|
+
lockedBinding = item.registerLockChangeHandler((locked) => {
|
|
554
|
+
this._dataFormat.locked = locked;
|
|
555
|
+
});
|
|
550
556
|
}
|
|
551
557
|
|
|
552
558
|
this._disposeStack.push(item.registerPortfolioChangeHandler((portfolio) => {
|
|
@@ -558,14 +564,16 @@ module.exports = (() => {
|
|
|
558
564
|
this._dataFormat.description = this._description;
|
|
559
565
|
}));
|
|
560
566
|
|
|
567
|
+
this._disposeStack.push(fundamentalBinding);
|
|
561
568
|
this._disposeStack.push(quoteBinding);
|
|
569
|
+
this._disposeStack.push(lockedBinding);
|
|
562
570
|
this._disposeStack.push(newsBinding);
|
|
563
|
-
this._disposeStack.push(fundamentalBinding);
|
|
564
571
|
|
|
565
572
|
this._disposeStack.push(item.registerPositionItemDisposeHandler(() => {
|
|
573
|
+
fundamentalBinding.dispose();
|
|
566
574
|
quoteBinding.dispose();
|
|
567
575
|
newsBinding.dispose();
|
|
568
|
-
|
|
576
|
+
lockedBinding.dispose();
|
|
569
577
|
|
|
570
578
|
array.remove(this._items, i => i === item);
|
|
571
579
|
array.remove(this._excludedItems, i => i === item);
|
|
@@ -692,6 +700,7 @@ module.exports = (() => {
|
|
|
692
700
|
format.basisPrice = formatCurrency(actual.basisPrice, currency);
|
|
693
701
|
|
|
694
702
|
format.invalid = definition.type === PositionLevelType.POSITION && item.invalid;
|
|
703
|
+
format.locked = definition.type === PositionLevelType.POSITION && item.data.locked;
|
|
695
704
|
}
|
|
696
705
|
|
|
697
706
|
const groupItems = group._items;
|
|
@@ -70,13 +70,15 @@ module.exports = (() => {
|
|
|
70
70
|
|
|
71
71
|
this._data.newsExists = false;
|
|
72
72
|
this._data.fundamental = { };
|
|
73
|
+
this._data.locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
|
|
73
74
|
|
|
74
75
|
calculateStaticData(this);
|
|
75
76
|
calculatePriceData(this, null);
|
|
76
77
|
|
|
77
78
|
this._quoteChangedEvent = new Event(this);
|
|
78
79
|
this._newsExistsChangedEvent = new Event(this);
|
|
79
|
-
this.
|
|
80
|
+
this._fundamentalDataChangedEvent = new Event(this);
|
|
81
|
+
this._lockChangedEvent = new Event(this);
|
|
80
82
|
this._portfolioChangedEvent = new Event(this);
|
|
81
83
|
this._positionItemDisposeEvent = new Event(this);
|
|
82
84
|
}
|
|
@@ -204,6 +206,25 @@ module.exports = (() => {
|
|
|
204
206
|
}
|
|
205
207
|
}
|
|
206
208
|
|
|
209
|
+
/**
|
|
210
|
+
* Sets a flag which indicates if news article(s) exist for the encapsulated position's
|
|
211
|
+
* symbol.
|
|
212
|
+
*
|
|
213
|
+
* @public
|
|
214
|
+
* @param {Boolean} value
|
|
215
|
+
*/
|
|
216
|
+
setNewsArticleExists(value) {
|
|
217
|
+
assert.argumentIsRequired(value, 'value', Boolean);
|
|
218
|
+
|
|
219
|
+
if (this.getIsDisposed()) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (this._data.newsExists !== value) {
|
|
224
|
+
this._newsExistsChangedEvent.fire(this._data.newsExists = value);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
207
228
|
/**
|
|
208
229
|
* Sets fundamental data for the position.
|
|
209
230
|
*
|
|
@@ -217,25 +238,24 @@ module.exports = (() => {
|
|
|
217
238
|
return;
|
|
218
239
|
}
|
|
219
240
|
|
|
220
|
-
this.
|
|
241
|
+
this._fundamentalDataChangedEvent.fire(this._data.fundamental = data);
|
|
221
242
|
}
|
|
222
243
|
|
|
223
244
|
/**
|
|
224
|
-
* Sets
|
|
225
|
-
* symbol.
|
|
245
|
+
* Sets position lock status.
|
|
226
246
|
*
|
|
227
247
|
* @public
|
|
228
248
|
* @param {Boolean} value
|
|
229
249
|
*/
|
|
230
|
-
|
|
250
|
+
setPositionLock(value) {
|
|
231
251
|
assert.argumentIsRequired(value, 'value', Boolean);
|
|
232
252
|
|
|
233
253
|
if (this.getIsDisposed()) {
|
|
234
254
|
return;
|
|
235
255
|
}
|
|
236
256
|
|
|
237
|
-
if (this._data.
|
|
238
|
-
this.
|
|
257
|
+
if (this._data.locked !== value) {
|
|
258
|
+
this._lockChangedEvent.fire(this._data.locked = value);
|
|
239
259
|
}
|
|
240
260
|
}
|
|
241
261
|
|
|
@@ -251,6 +271,17 @@ module.exports = (() => {
|
|
|
251
271
|
return this._quoteChangedEvent.register(handler);
|
|
252
272
|
}
|
|
253
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Registers an observer changes to the status of news existence.
|
|
276
|
+
*
|
|
277
|
+
* @public
|
|
278
|
+
* @param {Function} handler
|
|
279
|
+
* @returns {Disposable}
|
|
280
|
+
*/
|
|
281
|
+
registerNewsExistsChangeHandler(handler) {
|
|
282
|
+
return this._newsExistsChangedEvent.register(handler);
|
|
283
|
+
}
|
|
284
|
+
|
|
254
285
|
/**
|
|
255
286
|
* Registers an observer for fundamental data changes.
|
|
256
287
|
*
|
|
@@ -259,18 +290,18 @@ module.exports = (() => {
|
|
|
259
290
|
* @returns {Disposable}
|
|
260
291
|
*/
|
|
261
292
|
registerFundamentalDataChangeHandler(handler) {
|
|
262
|
-
return this.
|
|
293
|
+
return this._fundamentalDataChangedEvent.register(handler);
|
|
263
294
|
}
|
|
264
295
|
|
|
265
296
|
/**
|
|
266
|
-
* Registers an observer
|
|
297
|
+
* Registers an observer for position lock changes.
|
|
267
298
|
*
|
|
268
299
|
* @public
|
|
269
300
|
* @param {Function} handler
|
|
270
301
|
* @returns {Disposable}
|
|
271
302
|
*/
|
|
272
|
-
|
|
273
|
-
return this.
|
|
303
|
+
registerLockChangeHandler(handler) {
|
|
304
|
+
return this._lockChangedEvent.register(handler);
|
|
274
305
|
}
|
|
275
306
|
|
|
276
307
|
/**
|
|
@@ -300,7 +331,8 @@ module.exports = (() => {
|
|
|
300
331
|
|
|
301
332
|
this._quoteChangedEvent.clear();
|
|
302
333
|
this._newsExistsChangedEvent.clear();
|
|
303
|
-
this.
|
|
334
|
+
this._fundamentalDataChangedEvent.clear();
|
|
335
|
+
this._lockChangedEvent.clear();
|
|
304
336
|
this._portfolioChangedEvent.clear();
|
|
305
337
|
this._positionItemDisposeEvent.clear();
|
|
306
338
|
}
|
|
@@ -102,6 +102,7 @@ module.exports = (() => {
|
|
|
102
102
|
.withField('legacy.portfolio', DataType.STRING, true)
|
|
103
103
|
.withField('legacy.position', DataType.STRING, true)
|
|
104
104
|
.withField('system.version', DataType.NUMBER, true)
|
|
105
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
105
106
|
.withField('root', DataType.STRING, true)
|
|
106
107
|
.schema
|
|
107
108
|
);
|
|
@@ -131,6 +132,7 @@ module.exports = (() => {
|
|
|
131
132
|
.withField('snapshot.basis', DataType.DECIMAL)
|
|
132
133
|
.withField('snapshot.income', DataType.DECIMAL)
|
|
133
134
|
.withField('snapshot.value', DataType.DECIMAL)
|
|
135
|
+
.withField('system.locked', DataType.BOOLEAN, true)
|
|
134
136
|
.withField('previous', DataType.NUMBER, true)
|
|
135
137
|
.schema
|
|
136
138
|
);
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1187,7 +1187,7 @@ module.exports = (() => {
|
|
|
1187
1187
|
assert.argumentIsArray(transactions, 'transactions');
|
|
1188
1188
|
assert.argumentIsOptional(strict, 'strict', Boolean);
|
|
1189
1189
|
|
|
1190
|
-
return transactions.findIndex((t, i, a) =>
|
|
1190
|
+
return transactions.findIndex((t, i, a) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)) || (i !== 0 && is.boolean(strict) && strict && t.date.getIsEqual(a[i - 1].date) && t.type.sequence < a[i - 1].type.sequence));
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
1193
1193
|
/**
|
|
@@ -1749,6 +1749,19 @@ module.exports = (() => {
|
|
|
1749
1749
|
return array.unique(symbols);
|
|
1750
1750
|
}
|
|
1751
1751
|
|
|
1752
|
+
setPositionLock(position) {
|
|
1753
|
+
assert.argumentIsRequired(position, 'position', Object);
|
|
1754
|
+
assert.argumentIsRequired(position.position, 'position.position', String);
|
|
1755
|
+
|
|
1756
|
+
const item = this._items.find((i) => i.position.position === position.position);
|
|
1757
|
+
|
|
1758
|
+
if (item) {
|
|
1759
|
+
const locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
|
|
1760
|
+
|
|
1761
|
+
item.setPositionLock(locked);
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1752
1765
|
/**
|
|
1753
1766
|
* Performs a batch update of both position quotes and forex quotes,
|
|
1754
1767
|
* triggering updates to position(s) and data aggregation(s).
|
|
@@ -2096,6 +2109,8 @@ module.exports = (() => {
|
|
|
2096
2109
|
});
|
|
2097
2110
|
}
|
|
2098
2111
|
}
|
|
2112
|
+
|
|
2113
|
+
recalculatePercentages.call(this);
|
|
2099
2114
|
}));
|
|
2100
2115
|
}
|
|
2101
2116
|
|
|
@@ -2393,6 +2408,7 @@ module.exports = (() => {
|
|
|
2393
2408
|
this._dataFormat.description = this._description;
|
|
2394
2409
|
this._dataFormat.hide = false;
|
|
2395
2410
|
this._dataFormat.invalid = false;
|
|
2411
|
+
this._dataFormat.locked = false;
|
|
2396
2412
|
this._dataFormat.newsExists = false;
|
|
2397
2413
|
this._dataFormat.quantity = null;
|
|
2398
2414
|
this._dataFormat.basisPrice = null;
|
|
@@ -2862,12 +2878,17 @@ module.exports = (() => {
|
|
|
2862
2878
|
});
|
|
2863
2879
|
|
|
2864
2880
|
let newsBinding = Disposable.getEmpty();
|
|
2881
|
+
let lockedBinding = Disposable.getEmpty();
|
|
2865
2882
|
|
|
2866
2883
|
if (this._single) {
|
|
2867
2884
|
newsBinding = item.registerNewsExistsChangeHandler((exists) => {
|
|
2868
2885
|
this._dataActual.newsExists = exists;
|
|
2869
2886
|
this._dataFormat.newsExists = exists;
|
|
2870
2887
|
});
|
|
2888
|
+
|
|
2889
|
+
lockedBinding = item.registerLockChangeHandler((locked) => {
|
|
2890
|
+
this._dataFormat.locked = locked;
|
|
2891
|
+
});
|
|
2871
2892
|
}
|
|
2872
2893
|
|
|
2873
2894
|
this._disposeStack.push(item.registerPortfolioChangeHandler((portfolio) => {
|
|
@@ -2879,14 +2900,16 @@ module.exports = (() => {
|
|
|
2879
2900
|
this._dataFormat.description = this._description;
|
|
2880
2901
|
}));
|
|
2881
2902
|
|
|
2903
|
+
this._disposeStack.push(fundamentalBinding);
|
|
2882
2904
|
this._disposeStack.push(quoteBinding);
|
|
2905
|
+
this._disposeStack.push(lockedBinding);
|
|
2883
2906
|
this._disposeStack.push(newsBinding);
|
|
2884
|
-
this._disposeStack.push(fundamentalBinding);
|
|
2885
2907
|
|
|
2886
2908
|
this._disposeStack.push(item.registerPositionItemDisposeHandler(() => {
|
|
2909
|
+
fundamentalBinding.dispose();
|
|
2887
2910
|
quoteBinding.dispose();
|
|
2888
2911
|
newsBinding.dispose();
|
|
2889
|
-
|
|
2912
|
+
lockedBinding.dispose();
|
|
2890
2913
|
|
|
2891
2914
|
array.remove(this._items, i => i === item);
|
|
2892
2915
|
array.remove(this._excludedItems, i => i === item);
|
|
@@ -3013,6 +3036,7 @@ module.exports = (() => {
|
|
|
3013
3036
|
format.basisPrice = formatCurrency(actual.basisPrice, currency);
|
|
3014
3037
|
|
|
3015
3038
|
format.invalid = definition.type === PositionLevelType.POSITION && item.invalid;
|
|
3039
|
+
format.locked = definition.type === PositionLevelType.POSITION && item.data.locked;
|
|
3016
3040
|
}
|
|
3017
3041
|
|
|
3018
3042
|
const groupItems = group._items;
|
|
@@ -3251,13 +3275,15 @@ module.exports = (() => {
|
|
|
3251
3275
|
|
|
3252
3276
|
this._data.newsExists = false;
|
|
3253
3277
|
this._data.fundamental = { };
|
|
3278
|
+
this._data.locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
|
|
3254
3279
|
|
|
3255
3280
|
calculateStaticData(this);
|
|
3256
3281
|
calculatePriceData(this, null);
|
|
3257
3282
|
|
|
3258
3283
|
this._quoteChangedEvent = new Event(this);
|
|
3259
3284
|
this._newsExistsChangedEvent = new Event(this);
|
|
3260
|
-
this.
|
|
3285
|
+
this._fundamentalDataChangedEvent = new Event(this);
|
|
3286
|
+
this._lockChangedEvent = new Event(this);
|
|
3261
3287
|
this._portfolioChangedEvent = new Event(this);
|
|
3262
3288
|
this._positionItemDisposeEvent = new Event(this);
|
|
3263
3289
|
}
|
|
@@ -3385,6 +3411,25 @@ module.exports = (() => {
|
|
|
3385
3411
|
}
|
|
3386
3412
|
}
|
|
3387
3413
|
|
|
3414
|
+
/**
|
|
3415
|
+
* Sets a flag which indicates if news article(s) exist for the encapsulated position's
|
|
3416
|
+
* symbol.
|
|
3417
|
+
*
|
|
3418
|
+
* @public
|
|
3419
|
+
* @param {Boolean} value
|
|
3420
|
+
*/
|
|
3421
|
+
setNewsArticleExists(value) {
|
|
3422
|
+
assert.argumentIsRequired(value, 'value', Boolean);
|
|
3423
|
+
|
|
3424
|
+
if (this.getIsDisposed()) {
|
|
3425
|
+
return;
|
|
3426
|
+
}
|
|
3427
|
+
|
|
3428
|
+
if (this._data.newsExists !== value) {
|
|
3429
|
+
this._newsExistsChangedEvent.fire(this._data.newsExists = value);
|
|
3430
|
+
}
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3388
3433
|
/**
|
|
3389
3434
|
* Sets fundamental data for the position.
|
|
3390
3435
|
*
|
|
@@ -3398,25 +3443,24 @@ module.exports = (() => {
|
|
|
3398
3443
|
return;
|
|
3399
3444
|
}
|
|
3400
3445
|
|
|
3401
|
-
this.
|
|
3446
|
+
this._fundamentalDataChangedEvent.fire(this._data.fundamental = data);
|
|
3402
3447
|
}
|
|
3403
3448
|
|
|
3404
3449
|
/**
|
|
3405
|
-
* Sets
|
|
3406
|
-
* symbol.
|
|
3450
|
+
* Sets position lock status.
|
|
3407
3451
|
*
|
|
3408
3452
|
* @public
|
|
3409
3453
|
* @param {Boolean} value
|
|
3410
3454
|
*/
|
|
3411
|
-
|
|
3455
|
+
setPositionLock(value) {
|
|
3412
3456
|
assert.argumentIsRequired(value, 'value', Boolean);
|
|
3413
3457
|
|
|
3414
3458
|
if (this.getIsDisposed()) {
|
|
3415
3459
|
return;
|
|
3416
3460
|
}
|
|
3417
3461
|
|
|
3418
|
-
if (this._data.
|
|
3419
|
-
this.
|
|
3462
|
+
if (this._data.locked !== value) {
|
|
3463
|
+
this._lockChangedEvent.fire(this._data.locked = value);
|
|
3420
3464
|
}
|
|
3421
3465
|
}
|
|
3422
3466
|
|
|
@@ -3432,6 +3476,17 @@ module.exports = (() => {
|
|
|
3432
3476
|
return this._quoteChangedEvent.register(handler);
|
|
3433
3477
|
}
|
|
3434
3478
|
|
|
3479
|
+
/**
|
|
3480
|
+
* Registers an observer changes to the status of news existence.
|
|
3481
|
+
*
|
|
3482
|
+
* @public
|
|
3483
|
+
* @param {Function} handler
|
|
3484
|
+
* @returns {Disposable}
|
|
3485
|
+
*/
|
|
3486
|
+
registerNewsExistsChangeHandler(handler) {
|
|
3487
|
+
return this._newsExistsChangedEvent.register(handler);
|
|
3488
|
+
}
|
|
3489
|
+
|
|
3435
3490
|
/**
|
|
3436
3491
|
* Registers an observer for fundamental data changes.
|
|
3437
3492
|
*
|
|
@@ -3440,18 +3495,18 @@ module.exports = (() => {
|
|
|
3440
3495
|
* @returns {Disposable}
|
|
3441
3496
|
*/
|
|
3442
3497
|
registerFundamentalDataChangeHandler(handler) {
|
|
3443
|
-
return this.
|
|
3498
|
+
return this._fundamentalDataChangedEvent.register(handler);
|
|
3444
3499
|
}
|
|
3445
3500
|
|
|
3446
3501
|
/**
|
|
3447
|
-
* Registers an observer
|
|
3502
|
+
* Registers an observer for position lock changes.
|
|
3448
3503
|
*
|
|
3449
3504
|
* @public
|
|
3450
3505
|
* @param {Function} handler
|
|
3451
3506
|
* @returns {Disposable}
|
|
3452
3507
|
*/
|
|
3453
|
-
|
|
3454
|
-
return this.
|
|
3508
|
+
registerLockChangeHandler(handler) {
|
|
3509
|
+
return this._lockChangedEvent.register(handler);
|
|
3455
3510
|
}
|
|
3456
3511
|
|
|
3457
3512
|
/**
|
|
@@ -3481,7 +3536,8 @@ module.exports = (() => {
|
|
|
3481
3536
|
|
|
3482
3537
|
this._quoteChangedEvent.clear();
|
|
3483
3538
|
this._newsExistsChangedEvent.clear();
|
|
3484
|
-
this.
|
|
3539
|
+
this._fundamentalDataChangedEvent.clear();
|
|
3540
|
+
this._lockChangedEvent.clear();
|
|
3485
3541
|
this._portfolioChangedEvent.clear();
|
|
3486
3542
|
this._positionItemDisposeEvent.clear();
|
|
3487
3543
|
}
|
|
@@ -5920,12 +5976,11 @@ module.exports = function () {
|
|
|
5920
5976
|
}
|
|
5921
5977
|
|
|
5922
5978
|
/**
|
|
5923
|
-
*
|
|
5924
|
-
* a {@link Day} instance.
|
|
5979
|
+
* Clones a {@link Day} instance.
|
|
5925
5980
|
*
|
|
5926
5981
|
* @public
|
|
5927
5982
|
* @static
|
|
5928
|
-
* @param {
|
|
5983
|
+
* @param {Day} value
|
|
5929
5984
|
* @returns {Day}
|
|
5930
5985
|
*/
|
|
5931
5986
|
|
|
@@ -5966,6 +6021,24 @@ module.exports = function () {
|
|
|
5966
6021
|
return this._day;
|
|
5967
6022
|
}
|
|
5968
6023
|
}], [{
|
|
6024
|
+
key: 'clone',
|
|
6025
|
+
value: function clone(value) {
|
|
6026
|
+
assert.argumentIsRequired(value, 'value', Day, 'Day');
|
|
6027
|
+
|
|
6028
|
+
return new Day(value.year, value.month, value.day);
|
|
6029
|
+
}
|
|
6030
|
+
|
|
6031
|
+
/**
|
|
6032
|
+
* Converts a string (which matches the output of {@link Day#format} into
|
|
6033
|
+
* a {@link Day} instance.
|
|
6034
|
+
*
|
|
6035
|
+
* @public
|
|
6036
|
+
* @static
|
|
6037
|
+
* @param {String} value
|
|
6038
|
+
* @returns {Day}
|
|
6039
|
+
*/
|
|
6040
|
+
|
|
6041
|
+
}, {
|
|
5969
6042
|
key: 'parse',
|
|
5970
6043
|
value: function parse(value) {
|
|
5971
6044
|
assert.argumentIsRequired(value, 'value', String);
|
|
@@ -6476,10 +6549,11 @@ module.exports = function () {
|
|
|
6476
6549
|
}
|
|
6477
6550
|
|
|
6478
6551
|
/**
|
|
6479
|
-
*
|
|
6552
|
+
* Clones a {@link Decimal} instance.
|
|
6480
6553
|
*
|
|
6481
6554
|
* @public
|
|
6482
|
-
* @
|
|
6555
|
+
* @static
|
|
6556
|
+
* @param {Decimal} value
|
|
6483
6557
|
* @returns {Decimal}
|
|
6484
6558
|
*/
|
|
6485
6559
|
|
|
@@ -6489,6 +6563,22 @@ module.exports = function () {
|
|
|
6489
6563
|
return '[Decimal]';
|
|
6490
6564
|
}
|
|
6491
6565
|
}], [{
|
|
6566
|
+
key: 'clone',
|
|
6567
|
+
value: function clone(value) {
|
|
6568
|
+
assert.argumentIsRequired(value, 'value', Decimal, 'Decimal');
|
|
6569
|
+
|
|
6570
|
+
return new Decimal(value._big);
|
|
6571
|
+
}
|
|
6572
|
+
|
|
6573
|
+
/**
|
|
6574
|
+
* Parses the value emitted by {@link Decimal#toJSON}.
|
|
6575
|
+
*
|
|
6576
|
+
* @public
|
|
6577
|
+
* @param {String} value
|
|
6578
|
+
* @returns {Decimal}
|
|
6579
|
+
*/
|
|
6580
|
+
|
|
6581
|
+
}, {
|
|
6492
6582
|
key: 'parse',
|
|
6493
6583
|
value: function parse(value) {
|
|
6494
6584
|
return new Decimal(value);
|
|
@@ -7510,10 +7600,11 @@ module.exports = function () {
|
|
|
7510
7600
|
}
|
|
7511
7601
|
|
|
7512
7602
|
/**
|
|
7513
|
-
*
|
|
7603
|
+
* Clones a {@link Timestamp} instance.
|
|
7514
7604
|
*
|
|
7515
7605
|
* @public
|
|
7516
|
-
* @
|
|
7606
|
+
* @static
|
|
7607
|
+
* @param {Timestamp} value
|
|
7517
7608
|
* @returns {Timestamp}
|
|
7518
7609
|
*/
|
|
7519
7610
|
|
|
@@ -7549,6 +7640,22 @@ module.exports = function () {
|
|
|
7549
7640
|
return this._moment;
|
|
7550
7641
|
}
|
|
7551
7642
|
}], [{
|
|
7643
|
+
key: 'clone',
|
|
7644
|
+
value: function clone(value) {
|
|
7645
|
+
assert.argumentIsRequired(value, 'value', Timestamp, 'Timestamp');
|
|
7646
|
+
|
|
7647
|
+
return new Timestamp(value._timestamp, value._timezone);
|
|
7648
|
+
}
|
|
7649
|
+
|
|
7650
|
+
/**
|
|
7651
|
+
* Parses the value emitted by {@link Timestamp#toJSON}.
|
|
7652
|
+
*
|
|
7653
|
+
* @public
|
|
7654
|
+
* @param {Number} value
|
|
7655
|
+
* @returns {Timestamp}
|
|
7656
|
+
*/
|
|
7657
|
+
|
|
7658
|
+
}, {
|
|
7552
7659
|
key: 'parse',
|
|
7553
7660
|
value: function parse(value) {
|
|
7554
7661
|
return new Timestamp(value);
|