@barchart/portfolio-api-common 1.2.34 → 1.2.38

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.
@@ -267,7 +267,7 @@ module.exports = (() => {
267
267
  }
268
268
 
269
269
  const comparator = ComparatorBuilder.startWith((a, b) => {
270
- return Day.compareDays(b.date, a.date);
270
+ return Day.compareDays(a.date, b.date);
271
271
  }).thenBy((a, b) => {
272
272
  return comparators.compareNumbers(getInstrumentTypePriority(a.instrument.type), getInstrumentTypePriority(b.instrument.type));
273
273
  }).thenBy((a, b) => {
@@ -122,7 +122,7 @@ module.exports = (() => {
122
122
  }
123
123
 
124
124
  /**
125
- * The year-to-date position summary of the encapsulated position.
125
+ * The year-to-date summary of the encapsulated position.
126
126
  *
127
127
  * @public
128
128
  * @returns {Object}
@@ -103,38 +103,6 @@ module.exports = (() => {
103
103
  return sellShort;
104
104
  }
105
105
 
106
- static get DIVIDEND() {
107
- return dividend;
108
- }
109
-
110
- static get DIVIDEND_REINVEST() {
111
- return dividendReinvest;
112
- }
113
-
114
- static get DIVIDEND_STOCK() {
115
- return dividendStock;
116
- }
117
-
118
- static get DISTRIBUTION_CASH() {
119
- return distributionCash;
120
- }
121
-
122
- static get DISTRIBUTION_FUND() {
123
- return distributionFund;
124
- }
125
-
126
- static get SPLIT() {
127
- return split;
128
- }
129
-
130
- static get FEE() {
131
- return fee;
132
- }
133
-
134
- static get FEE_UNITS() {
135
- return feeUnits;
136
- }
137
-
138
106
  static get DEPOSIT() {
139
107
  return deposit;
140
108
  }
@@ -143,14 +111,6 @@ module.exports = (() => {
143
111
  return withdrawal;
144
112
  }
145
113
 
146
- static get DEBIT() {
147
- return debit;
148
- }
149
-
150
- static get CREDIT() {
151
- return credit;
152
- }
153
-
154
114
  static get VALUATION() {
155
115
  return valuation;
156
116
  }
@@ -259,8 +219,9 @@ module.exports = (() => {
259
219
  .withField('price', DataType.DECIMAL)
260
220
  .withField('quantity', DataType.DECIMAL)
261
221
  .withField('fee', DataType.DECIMAL, true)
262
- .withField('force', DataType.BOOLEAN, true)
263
222
  .withField('reinvest', DataType.BOOLEAN, true)
223
+ .withField('cash', DataType.BOOLEAN, true)
224
+ .withField('force', DataType.BOOLEAN, true)
264
225
  .schema
265
226
  );
266
227
 
@@ -287,7 +248,6 @@ module.exports = (() => {
287
248
  .withField('quantity', DataType.DECIMAL)
288
249
  .withField('fee', DataType.DECIMAL, true)
289
250
  .withField('force', DataType.BOOLEAN, true)
290
- .withField('force', DataType.BOOLEAN, true)
291
251
  .schema
292
252
  );
293
253
 
@@ -305,83 +265,8 @@ module.exports = (() => {
305
265
  .withField('price', DataType.DECIMAL)
306
266
  .withField('quantity', DataType.DECIMAL)
307
267
  .withField('fee', DataType.DECIMAL, true)
308
- .withField('force', DataType.BOOLEAN, true)
309
268
  .withField('reinvest', DataType.BOOLEAN, true)
310
- .schema
311
- );
312
-
313
- const dividend = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND.code)
314
- .withField('portfolio', DataType.STRING)
315
- .withField('position', DataType.STRING)
316
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
317
- .withField('date', DataType.DAY)
318
- .withField('rate', DataType.DECIMAL)
319
- .withField('effective', DataType.DAY)
320
- .withField('fee', DataType.DECIMAL, true)
321
- .withField('force', DataType.BOOLEAN, true)
322
- .schema
323
- );
324
-
325
- const dividendReinvest = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND_REINVEST.code)
326
- .withField('portfolio', DataType.STRING)
327
- .withField('position', DataType.STRING)
328
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
329
- .withField('date', DataType.DAY)
330
- .withField('rate', DataType.DECIMAL)
331
- .withField('effective', DataType.DAY)
332
- .withField('price', DataType.DECIMAL)
333
- .withField('fee', DataType.DECIMAL, true)
334
- .withField('force', DataType.BOOLEAN, true)
335
- .schema
336
- );
337
-
338
- const dividendStock = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND_STOCK.code)
339
- .withField('portfolio', DataType.STRING)
340
- .withField('position', DataType.STRING)
341
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
342
- .withField('date', DataType.DAY)
343
- .withField('rate', DataType.DECIMAL)
344
- .withField('effective', DataType.DAY)
345
- .withField('price', DataType.DECIMAL)
346
- .withField('fee', DataType.DECIMAL, true)
347
- .withField('force', DataType.BOOLEAN, true)
348
- .schema
349
- );
350
-
351
- const distributionCash = new TransactionSchema(SchemaBuilder.withName(TransactionType.DISTRIBUTION_CASH.code)
352
- .withField('portfolio', DataType.STRING)
353
- .withField('position', DataType.STRING)
354
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
355
- .withField('date', DataType.DAY)
356
- .withField('rate', DataType.DECIMAL)
357
- .withField('effective', DataType.DAY)
358
- .withField('fee', DataType.DECIMAL, true)
359
- .withField('force', DataType.BOOLEAN, true)
360
- .schema
361
- );
362
-
363
- const distributionFund = new TransactionSchema(SchemaBuilder.withName(TransactionType.DISTRIBUTION_FUND.code)
364
- .withField('portfolio', DataType.STRING)
365
- .withField('position', DataType.STRING)
366
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
367
- .withField('date', DataType.DAY)
368
- .withField('rate', DataType.DECIMAL)
369
- .withField('effective', DataType.DAY)
370
- .withField('price', DataType.DECIMAL)
371
- .withField('fee', DataType.DECIMAL, true)
372
- .withField('force', DataType.BOOLEAN, true)
373
- .schema
374
- );
375
-
376
- const split = new TransactionSchema(SchemaBuilder.withName(TransactionType.SPLIT.code)
377
- .withField('portfolio', DataType.STRING)
378
- .withField('position', DataType.STRING)
379
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
380
- .withField('date', DataType.DAY)
381
- .withField('numerator', DataType.DECIMAL)
382
- .withField('denominator', DataType.DECIMAL)
383
- .withField('effective', DataType.DAY)
384
- .withField('fee', DataType.DECIMAL, true)
269
+ .withField('cash', DataType.BOOLEAN, true)
385
270
  .withField('force', DataType.BOOLEAN, true)
386
271
  .schema
387
272
  );
@@ -397,18 +282,6 @@ module.exports = (() => {
397
282
  .schema
398
283
  );
399
284
 
400
- const feeUnits = new TransactionSchema(SchemaBuilder.withName(TransactionType.FEE_UNITS.code)
401
- .withField('portfolio', DataType.STRING)
402
- .withField('position', DataType.STRING)
403
- .withField('sequence', DataType.NUMBER, true)
404
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
405
- .withField('date', DataType.DAY)
406
- .withField('fee', DataType.DECIMAL)
407
- .withField('price', DataType.DECIMAL)
408
- .withField('force', DataType.BOOLEAN, true)
409
- .schema
410
- );
411
-
412
285
  const deposit = new TransactionSchema(SchemaBuilder.withName(TransactionType.DEPOSIT.code)
413
286
  .withField('portfolio', DataType.STRING)
414
287
  .withField('position', DataType.STRING)
@@ -437,28 +310,6 @@ module.exports = (() => {
437
310
  .schema
438
311
  );
439
312
 
440
- const debit = new TransactionSchema(SchemaBuilder.withName(TransactionType.DEBIT.code)
441
- .withField('portfolio', DataType.STRING)
442
- .withField('position', DataType.STRING)
443
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
444
- .withField('date', DataType.DAY)
445
- .withField('amount', DataType.DECIMAL)
446
- .withField('fee', DataType.DECIMAL, true)
447
- .withField('force', DataType.BOOLEAN, true)
448
- .schema
449
- );
450
-
451
- const credit = new TransactionSchema(SchemaBuilder.withName(TransactionType.CREDIT.code)
452
- .withField('portfolio', DataType.STRING)
453
- .withField('position', DataType.STRING)
454
- .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
455
- .withField('date', DataType.DAY)
456
- .withField('amount', DataType.DECIMAL)
457
- .withField('fee', DataType.DECIMAL, true)
458
- .withField('force', DataType.BOOLEAN, true)
459
- .schema
460
- );
461
-
462
313
  const valuation = new TransactionSchema(SchemaBuilder.withName(TransactionType.VALUATION.code)
463
314
  .withField('portfolio', DataType.STRING)
464
315
  .withField('position', DataType.STRING)
@@ -492,12 +343,7 @@ module.exports = (() => {
492
343
  addSchemaToMap(TransactionType.SELL, sell);
493
344
  addSchemaToMap(TransactionType.BUY_SHORT, buyShort);
494
345
  addSchemaToMap(TransactionType.SELL_SHORT, sellShort);
495
- addSchemaToMap(TransactionType.DIVIDEND, dividend);
496
- addSchemaToMap(TransactionType.DIVIDEND_STOCK, dividendStock);
497
- addSchemaToMap(TransactionType.DIVIDEND_REINVEST, dividendReinvest);
498
- addSchemaToMap(TransactionType.SPLIT, split);
499
346
  addSchemaToMap(TransactionType.FEE, fee);
500
- addSchemaToMap(TransactionType.FEE_UNITS, feeUnits);
501
347
  addSchemaToMap(TransactionType.DEPOSIT, deposit);
502
348
  addSchemaToMap(TransactionType.WITHDRAWAL, withdrawal);
503
349
  addSchemaToMap(TransactionType.VALUATION, valuation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.34",
3
+ "version": "1.2.38",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -3187,7 +3187,7 @@ module.exports = (() => {
3187
3187
  }
3188
3188
 
3189
3189
  /**
3190
- * The year-to-date position summary of the encapsulated position.
3190
+ * The year-to-date summary of the encapsulated position.
3191
3191
  *
3192
3192
  * @public
3193
3193
  * @returns {Object}