@barchart/portfolio-api-common 1.2.19 → 1.2.20
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.
|
@@ -19,10 +19,11 @@ module.exports = (() => {
|
|
|
19
19
|
* @param {Boolean} closing
|
|
20
20
|
* @param {Boolean} fee
|
|
21
21
|
* @param {Boolean} corporateAction
|
|
22
|
-
* @param {Boolean}
|
|
22
|
+
* @param {Boolean} initial
|
|
23
|
+
* @param {Boolean} significant
|
|
23
24
|
*/
|
|
24
25
|
class TransactionType extends Enum {
|
|
25
|
-
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial) {
|
|
26
|
+
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
26
27
|
super(code, description);
|
|
27
28
|
|
|
28
29
|
assert.argumentIsRequired(display, 'display', String);
|
|
@@ -34,6 +35,7 @@ module.exports = (() => {
|
|
|
34
35
|
assert.argumentIsRequired(fee, 'fee', Boolean);
|
|
35
36
|
assert.argumentIsRequired(corporateAction, 'corporateAction', Boolean);
|
|
36
37
|
assert.argumentIsRequired(initial, 'initial', Boolean);
|
|
38
|
+
assert.argumentIsRequired(significant, 'significant', Boolean);
|
|
37
39
|
|
|
38
40
|
this._display = display;
|
|
39
41
|
this._purchase = purchase;
|
|
@@ -44,6 +46,7 @@ module.exports = (() => {
|
|
|
44
46
|
this._fee = fee;
|
|
45
47
|
this._corporateAction = corporateAction;
|
|
46
48
|
this._initial = initial;
|
|
49
|
+
this._significant = significant;
|
|
47
50
|
}
|
|
48
51
|
|
|
49
52
|
/**
|
|
@@ -149,6 +152,16 @@ module.exports = (() => {
|
|
|
149
152
|
return this._initial;
|
|
150
153
|
}
|
|
151
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Significant transactions cannot be discarded during transaction re-write.
|
|
157
|
+
*
|
|
158
|
+
* @public
|
|
159
|
+
* @returns {Boolean}
|
|
160
|
+
*/
|
|
161
|
+
get significant() {
|
|
162
|
+
return this._significant;
|
|
163
|
+
}
|
|
164
|
+
|
|
152
165
|
/**
|
|
153
166
|
* A purchase.
|
|
154
167
|
*
|
|
@@ -363,28 +376,28 @@ module.exports = (() => {
|
|
|
363
376
|
}
|
|
364
377
|
}
|
|
365
378
|
|
|
366
|
-
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true);
|
|
367
|
-
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false);
|
|
368
|
-
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false);
|
|
369
|
-
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true);
|
|
370
|
-
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false);
|
|
371
|
-
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false);
|
|
372
|
-
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false);
|
|
373
|
-
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false);
|
|
374
|
-
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false);
|
|
375
|
-
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false);
|
|
376
|
-
|
|
377
|
-
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false);
|
|
378
|
-
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false);
|
|
379
|
-
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false);
|
|
380
|
-
|
|
381
|
-
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true);
|
|
382
|
-
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true);
|
|
383
|
-
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true);
|
|
384
|
-
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true);
|
|
385
|
-
|
|
386
|
-
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false);
|
|
387
|
-
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false);
|
|
379
|
+
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true, true);
|
|
380
|
+
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false, true);
|
|
381
|
+
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false, true);
|
|
382
|
+
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true, true);
|
|
383
|
+
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false, false);
|
|
384
|
+
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false, false);
|
|
385
|
+
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false, false);
|
|
386
|
+
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false, false);
|
|
387
|
+
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false, false);
|
|
388
|
+
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false, false);
|
|
389
|
+
|
|
390
|
+
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false, false);
|
|
391
|
+
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false, false);
|
|
392
|
+
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false, false);
|
|
393
|
+
|
|
394
|
+
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true, true);
|
|
395
|
+
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true, true);
|
|
396
|
+
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true, true);
|
|
397
|
+
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true, true);
|
|
398
|
+
|
|
399
|
+
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false, false);
|
|
400
|
+
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false, false);
|
|
388
401
|
|
|
389
402
|
return TransactionType;
|
|
390
403
|
})();
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -629,10 +629,11 @@ module.exports = (() => {
|
|
|
629
629
|
* @param {Boolean} closing
|
|
630
630
|
* @param {Boolean} fee
|
|
631
631
|
* @param {Boolean} corporateAction
|
|
632
|
-
* @param {Boolean}
|
|
632
|
+
* @param {Boolean} initial
|
|
633
|
+
* @param {Boolean} significant
|
|
633
634
|
*/
|
|
634
635
|
class TransactionType extends Enum {
|
|
635
|
-
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial) {
|
|
636
|
+
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
636
637
|
super(code, description);
|
|
637
638
|
|
|
638
639
|
assert.argumentIsRequired(display, 'display', String);
|
|
@@ -644,6 +645,7 @@ module.exports = (() => {
|
|
|
644
645
|
assert.argumentIsRequired(fee, 'fee', Boolean);
|
|
645
646
|
assert.argumentIsRequired(corporateAction, 'corporateAction', Boolean);
|
|
646
647
|
assert.argumentIsRequired(initial, 'initial', Boolean);
|
|
648
|
+
assert.argumentIsRequired(significant, 'significant', Boolean);
|
|
647
649
|
|
|
648
650
|
this._display = display;
|
|
649
651
|
this._purchase = purchase;
|
|
@@ -654,6 +656,7 @@ module.exports = (() => {
|
|
|
654
656
|
this._fee = fee;
|
|
655
657
|
this._corporateAction = corporateAction;
|
|
656
658
|
this._initial = initial;
|
|
659
|
+
this._significant = significant;
|
|
657
660
|
}
|
|
658
661
|
|
|
659
662
|
/**
|
|
@@ -759,6 +762,16 @@ module.exports = (() => {
|
|
|
759
762
|
return this._initial;
|
|
760
763
|
}
|
|
761
764
|
|
|
765
|
+
/**
|
|
766
|
+
* Significant transactions cannot be discarded during transaction re-write.
|
|
767
|
+
*
|
|
768
|
+
* @public
|
|
769
|
+
* @returns {Boolean}
|
|
770
|
+
*/
|
|
771
|
+
get significant() {
|
|
772
|
+
return this._significant;
|
|
773
|
+
}
|
|
774
|
+
|
|
762
775
|
/**
|
|
763
776
|
* A purchase.
|
|
764
777
|
*
|
|
@@ -973,28 +986,28 @@ module.exports = (() => {
|
|
|
973
986
|
}
|
|
974
987
|
}
|
|
975
988
|
|
|
976
|
-
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true);
|
|
977
|
-
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false);
|
|
978
|
-
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false);
|
|
979
|
-
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true);
|
|
980
|
-
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false);
|
|
981
|
-
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false);
|
|
982
|
-
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false);
|
|
983
|
-
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false);
|
|
984
|
-
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false);
|
|
985
|
-
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false);
|
|
986
|
-
|
|
987
|
-
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false);
|
|
988
|
-
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false);
|
|
989
|
-
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false);
|
|
990
|
-
|
|
991
|
-
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true);
|
|
992
|
-
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true);
|
|
993
|
-
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true);
|
|
994
|
-
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true);
|
|
995
|
-
|
|
996
|
-
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false);
|
|
997
|
-
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false);
|
|
989
|
+
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true, true);
|
|
990
|
+
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false, true);
|
|
991
|
+
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false, true);
|
|
992
|
+
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true, true);
|
|
993
|
+
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false, false);
|
|
994
|
+
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false, false);
|
|
995
|
+
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false, false);
|
|
996
|
+
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false, false);
|
|
997
|
+
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false, false);
|
|
998
|
+
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false, false);
|
|
999
|
+
|
|
1000
|
+
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false, false);
|
|
1001
|
+
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false, false);
|
|
1002
|
+
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false, false);
|
|
1003
|
+
|
|
1004
|
+
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true, true);
|
|
1005
|
+
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true, true);
|
|
1006
|
+
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true, true);
|
|
1007
|
+
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true, true);
|
|
1008
|
+
|
|
1009
|
+
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false, false);
|
|
1010
|
+
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false, false);
|
|
998
1011
|
|
|
999
1012
|
return TransactionType;
|
|
1000
1013
|
})();
|