@barchart/portfolio-api-common 1.2.18 → 1.2.22
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/InstrumentType.js +19 -6
- package/lib/data/TransactionType.js +37 -24
- package/lib/data/TransactionValidator.js +1 -1
- package/lib/formatters/TransactionFormatter.js +1 -1
- package/package.json +1 -1
- package/test/SpecRunner.js +57 -31
|
@@ -169,7 +169,7 @@ module.exports = (() => {
|
|
|
169
169
|
const transactionCreateFailedTypeInvalidForInstrument = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_INVALID_FOR_INSTRUMENT', 'Unable to process transaction, {L|transactionType.description} transactions cannot be used with {L|instrumentType.description} positions.');
|
|
170
170
|
const transactionCreateFailedTypeInvalidForDirection = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_INVALID_FOR_DIRECTION', 'Unable to process transaction, a {L|positionDirection.description} position would be created (i.e. you would have {L|positionDirection.sign} shares/units). {u|instrumentType.description} positions cannot have {L|positionDirection.description} positions.');
|
|
171
171
|
const transactionCreateFailedInvalidDirectionSwitch = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_DIRECTION_SWITCH', 'Unable to process transaction, the transaction would switch the position from {L|currentDirection.description} to {L|proposedDirection.description} (i.e. {L|currentDirection.sign} to {L|proposedDirection.sign} shares/units). This is not allowed. Please close the current position (i.e. zero it out) and then enter a second transaction.');
|
|
172
|
-
const transactionCreateFailedInvalidInitialType = new FailureType('TRANSACTION_CREATE_FAILED_INITIAL_TYPE', 'Unable to process
|
|
172
|
+
const transactionCreateFailedInvalidInitialType = new FailureType('TRANSACTION_CREATE_FAILED_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.');
|
|
173
173
|
|
|
174
174
|
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).');
|
|
175
175
|
const transactionDeleteFailedNoTransaction = new FailureType('TRANSACTION_DELETE_FAILED_NO_TRANSACTION', 'Unable to delete transaction. The referenced transaction does not exist.');
|
|
@@ -18,10 +18,11 @@ module.exports = (() => {
|
|
|
18
18
|
* @param {Boolean} canShort
|
|
19
19
|
* @param {Boolean} canSwitchDirection
|
|
20
20
|
* @param {Boolean} usesSymbols
|
|
21
|
-
* @param {
|
|
21
|
+
* @param {Boolean} hasCorporateActions
|
|
22
|
+
* @param {Function} generator
|
|
22
23
|
*/
|
|
23
24
|
class InstrumentType extends Enum {
|
|
24
|
-
constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, generator) {
|
|
25
|
+
constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, generator) {
|
|
25
26
|
super(code, description);
|
|
26
27
|
|
|
27
28
|
assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
|
|
@@ -29,6 +30,7 @@ module.exports = (() => {
|
|
|
29
30
|
assert.argumentIsRequired(canShort, 'canShort', Boolean);
|
|
30
31
|
assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
|
|
31
32
|
assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
|
|
33
|
+
assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
|
|
32
34
|
assert.argumentIsRequired(generator, 'generator', Function);
|
|
33
35
|
|
|
34
36
|
this._alternateDescription = alternateDescription;
|
|
@@ -36,6 +38,7 @@ module.exports = (() => {
|
|
|
36
38
|
this._canShort = canShort;
|
|
37
39
|
this._canSwitchDirection = canSwitchDirection;
|
|
38
40
|
this._usesSymbols = usesSymbols;
|
|
41
|
+
this._hasCorporateActions = hasCorporateActions;
|
|
39
42
|
|
|
40
43
|
this._generator = generator;
|
|
41
44
|
}
|
|
@@ -91,6 +94,16 @@ module.exports = (() => {
|
|
|
91
94
|
return this._usesSymbols;
|
|
92
95
|
}
|
|
93
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Indicates if corporate actions are possible for this type of instrument.
|
|
99
|
+
*
|
|
100
|
+
* @public
|
|
101
|
+
* @returns {Boolean}
|
|
102
|
+
*/
|
|
103
|
+
get hasCorporateActions() {
|
|
104
|
+
return this._hasCorporateActions;
|
|
105
|
+
}
|
|
106
|
+
|
|
94
107
|
/**
|
|
95
108
|
* Generates an identifier for the instrument.
|
|
96
109
|
*
|
|
@@ -188,10 +201,10 @@ module.exports = (() => {
|
|
|
188
201
|
}
|
|
189
202
|
}
|
|
190
203
|
|
|
191
|
-
const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
|
|
192
|
-
const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
193
|
-
const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
194
|
-
const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
|
|
204
|
+
const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
|
|
205
|
+
const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
206
|
+
const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
207
|
+
const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
|
|
195
208
|
|
|
196
209
|
const map = { };
|
|
197
210
|
|
|
@@ -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
|
@@ -19,10 +19,11 @@ module.exports = (() => {
|
|
|
19
19
|
* @param {Boolean} canShort
|
|
20
20
|
* @param {Boolean} canSwitchDirection
|
|
21
21
|
* @param {Boolean} usesSymbols
|
|
22
|
-
* @param {
|
|
22
|
+
* @param {Boolean} hasCorporateActions
|
|
23
|
+
* @param {Function} generator
|
|
23
24
|
*/
|
|
24
25
|
class InstrumentType extends Enum {
|
|
25
|
-
constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, generator) {
|
|
26
|
+
constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, generator) {
|
|
26
27
|
super(code, description);
|
|
27
28
|
|
|
28
29
|
assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
|
|
@@ -30,6 +31,7 @@ module.exports = (() => {
|
|
|
30
31
|
assert.argumentIsRequired(canShort, 'canShort', Boolean);
|
|
31
32
|
assert.argumentIsRequired(canSwitchDirection, 'canSwitchDirection', Boolean);
|
|
32
33
|
assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
|
|
34
|
+
assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
|
|
33
35
|
assert.argumentIsRequired(generator, 'generator', Function);
|
|
34
36
|
|
|
35
37
|
this._alternateDescription = alternateDescription;
|
|
@@ -37,6 +39,7 @@ module.exports = (() => {
|
|
|
37
39
|
this._canShort = canShort;
|
|
38
40
|
this._canSwitchDirection = canSwitchDirection;
|
|
39
41
|
this._usesSymbols = usesSymbols;
|
|
42
|
+
this._hasCorporateActions = hasCorporateActions;
|
|
40
43
|
|
|
41
44
|
this._generator = generator;
|
|
42
45
|
}
|
|
@@ -92,6 +95,16 @@ module.exports = (() => {
|
|
|
92
95
|
return this._usesSymbols;
|
|
93
96
|
}
|
|
94
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Indicates if corporate actions are possible for this type of instrument.
|
|
100
|
+
*
|
|
101
|
+
* @public
|
|
102
|
+
* @returns {Boolean}
|
|
103
|
+
*/
|
|
104
|
+
get hasCorporateActions() {
|
|
105
|
+
return this._hasCorporateActions;
|
|
106
|
+
}
|
|
107
|
+
|
|
95
108
|
/**
|
|
96
109
|
* Generates an identifier for the instrument.
|
|
97
110
|
*
|
|
@@ -189,10 +202,10 @@ module.exports = (() => {
|
|
|
189
202
|
}
|
|
190
203
|
}
|
|
191
204
|
|
|
192
|
-
const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
|
|
193
|
-
const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
194
|
-
const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
195
|
-
const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
|
|
205
|
+
const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
|
|
206
|
+
const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
207
|
+
const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
|
|
208
|
+
const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
|
|
196
209
|
|
|
197
210
|
const map = { };
|
|
198
211
|
|
|
@@ -629,10 +642,11 @@ module.exports = (() => {
|
|
|
629
642
|
* @param {Boolean} closing
|
|
630
643
|
* @param {Boolean} fee
|
|
631
644
|
* @param {Boolean} corporateAction
|
|
632
|
-
* @param {Boolean}
|
|
645
|
+
* @param {Boolean} initial
|
|
646
|
+
* @param {Boolean} significant
|
|
633
647
|
*/
|
|
634
648
|
class TransactionType extends Enum {
|
|
635
|
-
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial) {
|
|
649
|
+
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
636
650
|
super(code, description);
|
|
637
651
|
|
|
638
652
|
assert.argumentIsRequired(display, 'display', String);
|
|
@@ -644,6 +658,7 @@ module.exports = (() => {
|
|
|
644
658
|
assert.argumentIsRequired(fee, 'fee', Boolean);
|
|
645
659
|
assert.argumentIsRequired(corporateAction, 'corporateAction', Boolean);
|
|
646
660
|
assert.argumentIsRequired(initial, 'initial', Boolean);
|
|
661
|
+
assert.argumentIsRequired(significant, 'significant', Boolean);
|
|
647
662
|
|
|
648
663
|
this._display = display;
|
|
649
664
|
this._purchase = purchase;
|
|
@@ -654,6 +669,7 @@ module.exports = (() => {
|
|
|
654
669
|
this._fee = fee;
|
|
655
670
|
this._corporateAction = corporateAction;
|
|
656
671
|
this._initial = initial;
|
|
672
|
+
this._significant = significant;
|
|
657
673
|
}
|
|
658
674
|
|
|
659
675
|
/**
|
|
@@ -759,6 +775,16 @@ module.exports = (() => {
|
|
|
759
775
|
return this._initial;
|
|
760
776
|
}
|
|
761
777
|
|
|
778
|
+
/**
|
|
779
|
+
* Significant transactions cannot be discarded during transaction re-write.
|
|
780
|
+
*
|
|
781
|
+
* @public
|
|
782
|
+
* @returns {Boolean}
|
|
783
|
+
*/
|
|
784
|
+
get significant() {
|
|
785
|
+
return this._significant;
|
|
786
|
+
}
|
|
787
|
+
|
|
762
788
|
/**
|
|
763
789
|
* A purchase.
|
|
764
790
|
*
|
|
@@ -973,28 +999,28 @@ module.exports = (() => {
|
|
|
973
999
|
}
|
|
974
1000
|
}
|
|
975
1001
|
|
|
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);
|
|
1002
|
+
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true, true);
|
|
1003
|
+
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false, true);
|
|
1004
|
+
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false, true);
|
|
1005
|
+
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true, true);
|
|
1006
|
+
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false, false);
|
|
1007
|
+
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false, false);
|
|
1008
|
+
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false, false);
|
|
1009
|
+
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false, false);
|
|
1010
|
+
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false, false);
|
|
1011
|
+
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false, false);
|
|
1012
|
+
|
|
1013
|
+
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false, false);
|
|
1014
|
+
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false, false);
|
|
1015
|
+
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false, false);
|
|
1016
|
+
|
|
1017
|
+
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true, true);
|
|
1018
|
+
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true, true);
|
|
1019
|
+
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true, true);
|
|
1020
|
+
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true, true);
|
|
1021
|
+
|
|
1022
|
+
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false, false);
|
|
1023
|
+
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false, false);
|
|
998
1024
|
|
|
999
1025
|
return TransactionType;
|
|
1000
1026
|
})();
|
|
@@ -1122,7 +1148,7 @@ module.exports = (() => {
|
|
|
1122
1148
|
* @param {TransactionType} transactionType
|
|
1123
1149
|
*/
|
|
1124
1150
|
static validateInitialTransactionType(transactionType) {
|
|
1125
|
-
return transactionType.
|
|
1151
|
+
return transactionType.initial;
|
|
1126
1152
|
}
|
|
1127
1153
|
|
|
1128
1154
|
/**
|