@barchart/portfolio-api-common 1.2.118 → 1.2.119

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.
@@ -218,23 +218,6 @@ module.exports = (() => {
218
218
  static validateDirectionSwitch(instrumentType, currentDirection, proposedDirection) {
219
219
  return currentDirection === null || instrumentType.canSwitchDirection || (currentDirection.closed || proposedDirection.closed || currentDirection.positive === proposedDirection.positive);
220
220
  }
221
-
222
- /**
223
- * Assuming the transaction list is ordered by sequence, validates that
224
- * no opening transactions exist after delisting date.
225
- *
226
- * @static
227
- * @public
228
- * @param {Array.<Object>} transactions
229
- * @returns {Boolean}
230
- */
231
- static validateDelisting(transactions) {
232
- assert.argumentIsArray(transactions, 'transactions');
233
-
234
- const delistIndex = transactions.findIndex(t => t.type === TransactionType.DELIST);
235
-
236
- return delistIndex < 0 || !transactions.some((t, i) => delistIndex < i && t.type.opening);
237
- }
238
221
 
239
222
  toString() {
240
223
  return '[TransactionValidator]';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.118",
3
+ "version": "1.2.119",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1386,23 +1386,6 @@ module.exports = (() => {
1386
1386
  static validateDirectionSwitch(instrumentType, currentDirection, proposedDirection) {
1387
1387
  return currentDirection === null || instrumentType.canSwitchDirection || (currentDirection.closed || proposedDirection.closed || currentDirection.positive === proposedDirection.positive);
1388
1388
  }
1389
-
1390
- /**
1391
- * Assuming the transaction list is ordered by sequence, validates that
1392
- * no opening transactions exist after delisting date.
1393
- *
1394
- * @static
1395
- * @public
1396
- * @param {Array.<Object>} transactions
1397
- * @returns {Boolean}
1398
- */
1399
- static validateDelisting(transactions) {
1400
- assert.argumentIsArray(transactions, 'transactions');
1401
-
1402
- const delistIndex = transactions.findIndex(t => t.type === TransactionType.DELIST);
1403
-
1404
- return delistIndex < 0 || !transactions.some((t, i) => delistIndex < i && t.type.opening);
1405
- }
1406
1389
 
1407
1390
  toString() {
1408
1391
  return '[TransactionValidator]';
@@ -18239,28 +18222,6 @@ describe('When validating transaction references', () => {
18239
18222
  });
18240
18223
  });
18241
18224
 
18242
- describe('When validating transactions which could include instrument delisting', () => {
18243
- const build = (type) => {
18244
- return { type: type };
18245
- };
18246
-
18247
- it('An array without a DELSIT transaction should be valid', () => {
18248
- expect(TransactionValidator.validateDelisting([ build(TransactionType.BUY), build(TransactionType.SELL) ])).toEqual(true);
18249
- });
18250
-
18251
- it('An array with a final DELSIT transaction should be valid', () => {
18252
- expect(TransactionValidator.validateDelisting([ build(TransactionType.BUY), build(TransactionType.SELL), build(TransactionType.DELIST) ])).toEqual(true);
18253
- });
18254
-
18255
- it('An array with a closing transaction after a DELIST transaction should be valid', () => {
18256
- expect(TransactionValidator.validateDelisting([ build(TransactionType.BUY), build(TransactionType.SELL), build(TransactionType.DELIST), build(TransactionType.SELL) ])).toEqual(true);
18257
- });
18258
-
18259
- it('An array with an opening transaction after a DELIST transaction should not be valid', () => {
18260
- expect(TransactionValidator.validateDelisting([ build(TransactionType.BUY), build(TransactionType.SELL), build(TransactionType.DELIST), build(TransactionType.BUY) ])).toEqual(false);
18261
- });
18262
- });
18263
-
18264
18225
  describe('When requesting all the user-initiated transaction types', () => {
18265
18226
  'use strict';
18266
18227
 
@@ -79,28 +79,6 @@ describe('When validating transaction references', () => {
79
79
  });
80
80
  });
81
81
 
82
- describe('When validating transactions which could include instrument delisting', () => {
83
- const build = (type) => {
84
- return { type: type };
85
- };
86
-
87
- it('An array without a DELSIT transaction should be valid', () => {
88
- expect(TransactionValidator.validateDelisting([ build(TransactionType.BUY), build(TransactionType.SELL) ])).toEqual(true);
89
- });
90
-
91
- it('An array with a final DELSIT transaction should be valid', () => {
92
- expect(TransactionValidator.validateDelisting([ build(TransactionType.BUY), build(TransactionType.SELL), build(TransactionType.DELIST) ])).toEqual(true);
93
- });
94
-
95
- it('An array with a closing transaction after a DELIST transaction should be valid', () => {
96
- expect(TransactionValidator.validateDelisting([ build(TransactionType.BUY), build(TransactionType.SELL), build(TransactionType.DELIST), build(TransactionType.SELL) ])).toEqual(true);
97
- });
98
-
99
- it('An array with an opening transaction after a DELIST transaction should not be valid', () => {
100
- expect(TransactionValidator.validateDelisting([ build(TransactionType.BUY), build(TransactionType.SELL), build(TransactionType.DELIST), build(TransactionType.BUY) ])).toEqual(false);
101
- });
102
- });
103
-
104
82
  describe('When requesting all the user-initiated transaction types', () => {
105
83
  'use strict';
106
84