@barchart/portfolio-api-common 1.2.37 → 1.2.41
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.
|
@@ -4,6 +4,15 @@ const Enum = require('@barchart/common-js/lang/Enum'),
|
|
|
4
4
|
module.exports = (() => {
|
|
5
5
|
'use strict';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Types of corporate actions.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @extends {Enum}
|
|
12
|
+
* @param {String} code
|
|
13
|
+
* @param {String} description
|
|
14
|
+
* @param {Boolean} internal
|
|
15
|
+
*/
|
|
7
16
|
class CorporateActionType extends Enum {
|
|
8
17
|
constructor(code, description, internal) {
|
|
9
18
|
super(code, description);
|
|
@@ -11,23 +20,75 @@ module.exports = (() => {
|
|
|
11
20
|
this._internal = is.boolean(internal) && internal;
|
|
12
21
|
}
|
|
13
22
|
|
|
23
|
+
/**
|
|
24
|
+
* If true, the corporate action is fictitious -- used only for internal
|
|
25
|
+
* system purposes.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @returns {Boolean}
|
|
29
|
+
*/
|
|
14
30
|
get internal() {
|
|
15
31
|
return this._internal;
|
|
16
32
|
}
|
|
17
33
|
|
|
34
|
+
/**
|
|
35
|
+
* A symbol change.
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
38
|
+
* @static
|
|
39
|
+
* @returns {CorporateActionType}
|
|
40
|
+
*/
|
|
41
|
+
static get SYMBOL_CHANGE() {
|
|
42
|
+
return symbolChange;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A name change.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
* @static
|
|
50
|
+
* @returns {CorporateActionType}
|
|
51
|
+
*/
|
|
52
|
+
static get NAME_CHANGE() {
|
|
53
|
+
return nameChange;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A dividend.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
* @static
|
|
61
|
+
* @returns {CorporateActionType}
|
|
62
|
+
*/
|
|
18
63
|
static get DIVIDEND() {
|
|
19
64
|
return dividend;
|
|
20
65
|
}
|
|
21
66
|
|
|
67
|
+
/**
|
|
68
|
+
* A split.
|
|
69
|
+
*
|
|
70
|
+
* @public
|
|
71
|
+
* @static
|
|
72
|
+
* @returns {CorporateActionType}
|
|
73
|
+
*/
|
|
22
74
|
static get SPLIT() {
|
|
23
75
|
return split;
|
|
24
76
|
}
|
|
25
77
|
|
|
78
|
+
/**
|
|
79
|
+
* A fictitious event, used for internal system purposes.
|
|
80
|
+
*
|
|
81
|
+
* @public
|
|
82
|
+
* @static
|
|
83
|
+
* @returns {CorporateActionType}
|
|
84
|
+
*/
|
|
26
85
|
static get JOB() {
|
|
27
86
|
return job;
|
|
28
87
|
}
|
|
29
88
|
}
|
|
30
89
|
|
|
90
|
+
const symbolChange = new CorporateActionType('SYMBOL_CHANGE', 'Symbol Change', false);
|
|
91
|
+
const nameChange = new CorporateActionType('NAME_CHANGE', 'Name Change', false);
|
|
31
92
|
const dividend = new CorporateActionType('DIVIDEND', 'Dividend', false);
|
|
32
93
|
const split = new CorporateActionType('SPLIT', 'Split', false);
|
|
33
94
|
const job = new CorporateActionType('JOB', 'Job', true);
|
|
@@ -198,7 +198,6 @@ module.exports = (() => {
|
|
|
198
198
|
|
|
199
199
|
associateTypes(InstrumentType.CASH, TransactionType.DEPOSIT, true);
|
|
200
200
|
associateTypes(InstrumentType.CASH, TransactionType.WITHDRAWAL, true);
|
|
201
|
-
associateTypes(InstrumentType.CASH, TransactionType.FEE, true);
|
|
202
201
|
associateTypes(InstrumentType.CASH, TransactionType.DEBIT, false);
|
|
203
202
|
associateTypes(InstrumentType.CASH, TransactionType.CREDIT, false);
|
|
204
203
|
|
|
@@ -216,7 +216,7 @@ module.exports = (() => {
|
|
|
216
216
|
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
217
217
|
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
218
218
|
.withField('date', DataType.DAY)
|
|
219
|
-
.withField('price', DataType.DECIMAL)
|
|
219
|
+
.withField('price', DataType.DECIMAL, true)
|
|
220
220
|
.withField('quantity', DataType.DECIMAL)
|
|
221
221
|
.withField('fee', DataType.DECIMAL, true)
|
|
222
222
|
.withField('reinvest', DataType.BOOLEAN, true)
|
|
@@ -231,7 +231,7 @@ module.exports = (() => {
|
|
|
231
231
|
.withField('sequence', DataType.NUMBER, true)
|
|
232
232
|
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
233
233
|
.withField('date', DataType.DAY)
|
|
234
|
-
.withField('price', DataType.DECIMAL)
|
|
234
|
+
.withField('price', DataType.DECIMAL, true)
|
|
235
235
|
.withField('quantity', DataType.DECIMAL)
|
|
236
236
|
.withField('fee', DataType.DECIMAL, true)
|
|
237
237
|
.withField('force', DataType.BOOLEAN, true)
|
|
@@ -291,9 +291,7 @@ module.exports = (() => {
|
|
|
291
291
|
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
292
292
|
.withField('date', DataType.DAY)
|
|
293
293
|
.withField('amount', DataType.DECIMAL)
|
|
294
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
295
294
|
.withField('force', DataType.BOOLEAN, true)
|
|
296
|
-
.withField('cash', DataType.BOOLEAN, true)
|
|
297
295
|
.schema
|
|
298
296
|
);
|
|
299
297
|
|
|
@@ -306,7 +304,6 @@ module.exports = (() => {
|
|
|
306
304
|
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
307
305
|
.withField('date', DataType.DAY)
|
|
308
306
|
.withField('amount', DataType.DECIMAL)
|
|
309
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
310
307
|
.withField('force', DataType.BOOLEAN, true)
|
|
311
308
|
.schema
|
|
312
309
|
);
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1226,7 +1226,6 @@ module.exports = (() => {
|
|
|
1226
1226
|
|
|
1227
1227
|
associateTypes(InstrumentType.CASH, TransactionType.DEPOSIT, true);
|
|
1228
1228
|
associateTypes(InstrumentType.CASH, TransactionType.WITHDRAWAL, true);
|
|
1229
|
-
associateTypes(InstrumentType.CASH, TransactionType.FEE, true);
|
|
1230
1229
|
associateTypes(InstrumentType.CASH, TransactionType.DEBIT, false);
|
|
1231
1230
|
associateTypes(InstrumentType.CASH, TransactionType.CREDIT, false);
|
|
1232
1231
|
|