@barchart/portfolio-api-common 1.5.2 → 1.6.0
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.
|
@@ -326,6 +326,18 @@ module.exports = (() => {
|
|
|
326
326
|
return transactionEditFailedTypeReserved;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
+
/**
|
|
330
|
+
* A transaction's type cannot be changed.
|
|
331
|
+
*
|
|
332
|
+
* @public
|
|
333
|
+
* @static
|
|
334
|
+
* @returns {FailureType}
|
|
335
|
+
*/
|
|
336
|
+
static get TRANSACTION_EDIT_FAILED_TYPE_CHANGED() {
|
|
337
|
+
return transactionEditFailedTypeChanged;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
|
|
329
341
|
toString() {
|
|
330
342
|
return '[PortfolioFailureType]';
|
|
331
343
|
}
|
|
@@ -364,6 +376,7 @@ module.exports = (() => {
|
|
|
364
376
|
const transactionEditFailedInvalidDate = new FailureType('TRANSACTION_EDIT_FAILED_INVALID_DATE', 'Unable to edit transaction with given date.');
|
|
365
377
|
const transactionEditFailedNoTransaction = new FailureType('TRANSACTION_EDIT_FAILED_NO_TRANSACTION', 'Unable to edit transaction. The referenced transaction does not exist.', false);
|
|
366
378
|
const transactionEditFailedTypeReserved = new FailureType('TRANSACTION_EDIT_FAILED_TYPE_RESERVED', 'Unable to edit {U|type.description} transaction, this type of transaction is managed by the system.');
|
|
379
|
+
const transactionEditFailedTypeChanged = new FailureType('TRANSACTION_EDIT_FAILED_TYPE_CHANGED', 'Changing a transaction type is forbidden. You must delete the existing transaction then recreate it.');
|
|
367
380
|
|
|
368
381
|
return PortfolioFailureType;
|
|
369
382
|
})();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
2
2
|
array = require('@barchart/common-js/lang/array'),
|
|
3
|
-
is = require('@barchart/common-js/lang/is')
|
|
4
|
-
Day = require('@barchart/common-js/lang/Day');
|
|
3
|
+
is = require('@barchart/common-js/lang/is');
|
|
5
4
|
|
|
6
5
|
const InstrumentType = require('./InstrumentType'),
|
|
7
6
|
PositionDirection = require('./PositionDirection'),
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1291,8 +1291,7 @@ module.exports = (() => {
|
|
|
1291
1291
|
},{"@barchart/common-js/lang/Enum":26,"@barchart/common-js/lang/assert":31}],5:[function(require,module,exports){
|
|
1292
1292
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
1293
1293
|
array = require('@barchart/common-js/lang/array'),
|
|
1294
|
-
is = require('@barchart/common-js/lang/is')
|
|
1295
|
-
Day = require('@barchart/common-js/lang/Day');
|
|
1294
|
+
is = require('@barchart/common-js/lang/is');
|
|
1296
1295
|
|
|
1297
1296
|
const InstrumentType = require('./InstrumentType'),
|
|
1298
1297
|
PositionDirection = require('./PositionDirection'),
|
|
@@ -1595,7 +1594,7 @@ module.exports = (() => {
|
|
|
1595
1594
|
return TransactionValidator;
|
|
1596
1595
|
})();
|
|
1597
1596
|
|
|
1598
|
-
},{"./InstrumentType":1,"./PositionDirection":2,"./TransactionType":4,"@barchart/common-js/lang/
|
|
1597
|
+
},{"./InstrumentType":1,"./PositionDirection":2,"./TransactionType":4,"@barchart/common-js/lang/array":30,"@barchart/common-js/lang/assert":31,"@barchart/common-js/lang/is":35}],6:[function(require,module,exports){
|
|
1599
1598
|
const Enum = require('@barchart/common-js/lang/Enum');
|
|
1600
1599
|
|
|
1601
1600
|
module.exports = (() => {
|
|
@@ -8204,11 +8203,8 @@ const moment = require('moment-timezone');
|
|
|
8204
8203
|
|
|
8205
8204
|
module.exports = (() => {
|
|
8206
8205
|
'use strict';
|
|
8207
|
-
|
|
8208
|
-
const MILLISECONDS_PER_SECOND = 1000;
|
|
8209
8206
|
/**
|
|
8210
|
-
*
|
|
8211
|
-
* a moment (see https://momentjs.com/).
|
|
8207
|
+
* A data structure encapsulates (and lazy loads) a moment (see https://momentjs.com/).
|
|
8212
8208
|
*
|
|
8213
8209
|
* @public
|
|
8214
8210
|
* @param {Number} timestamp
|
|
@@ -8224,7 +8220,7 @@ module.exports = (() => {
|
|
|
8224
8220
|
this._moment = null;
|
|
8225
8221
|
}
|
|
8226
8222
|
/**
|
|
8227
|
-
* The timestamp
|
|
8223
|
+
* The timestamp.
|
|
8228
8224
|
*
|
|
8229
8225
|
* @public
|
|
8230
8226
|
* @returns {Number}
|
|
@@ -8253,34 +8249,6 @@ module.exports = (() => {
|
|
|
8253
8249
|
|
|
8254
8250
|
return this._moment;
|
|
8255
8251
|
}
|
|
8256
|
-
/**
|
|
8257
|
-
* Returns a new {@link Timestamp} instance shifted forward (or backward)
|
|
8258
|
-
* by a specific number of seconds.
|
|
8259
|
-
*
|
|
8260
|
-
* @public
|
|
8261
|
-
* @param {Number} milliseconds
|
|
8262
|
-
* @returns {Timestamp}
|
|
8263
|
-
*/
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
add(milliseconds) {
|
|
8267
|
-
assert.argumentIsRequired(milliseconds, 'seconds', Number);
|
|
8268
|
-
return new Timestamp(this._timestamp + milliseconds, this._timezone);
|
|
8269
|
-
}
|
|
8270
|
-
/**
|
|
8271
|
-
* Returns a new {@link Timestamp} instance shifted forward (or backward)
|
|
8272
|
-
* by a specific number of seconds.
|
|
8273
|
-
*
|
|
8274
|
-
* @public
|
|
8275
|
-
* @param {Number} seconds
|
|
8276
|
-
* @returns {Timestamp}
|
|
8277
|
-
*/
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
addSeconds(seconds) {
|
|
8281
|
-
assert.argumentIsRequired(seconds, 'seconds', Number);
|
|
8282
|
-
return this.add(seconds * MILLISECONDS_PER_SECOND);
|
|
8283
|
-
}
|
|
8284
8252
|
/**
|
|
8285
8253
|
* Returns the JSON representation.
|
|
8286
8254
|
*
|