@barchart/portfolio-api-common 1.0.7 → 1.0.11
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.
|
@@ -62,9 +62,9 @@ module.exports = (() => {
|
|
|
62
62
|
transaction.formatted = formatted;
|
|
63
63
|
|
|
64
64
|
return transaction;
|
|
65
|
+
} else {
|
|
66
|
+
return formatted;
|
|
65
67
|
}
|
|
66
|
-
|
|
67
|
-
return formatted;
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -81,9 +81,11 @@ module.exports = (() => {
|
|
|
81
81
|
instrument: t.instrument
|
|
82
82
|
};
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
if (basic.instrument) {
|
|
85
|
+
delete basic.instrument.id;
|
|
86
|
+
}
|
|
85
87
|
|
|
86
|
-
return
|
|
88
|
+
return basic;
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
const formatters = new Map();
|
|
@@ -28,12 +28,16 @@ module.exports = (() => {
|
|
|
28
28
|
return this._schema;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
static get CREATE() {
|
|
32
|
+
return create;
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
static get COMPLETE() {
|
|
32
36
|
return complete;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
static get
|
|
36
|
-
return
|
|
39
|
+
static get UPDATE() {
|
|
40
|
+
return update;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
toString() {
|
|
@@ -60,14 +64,31 @@ module.exports = (() => {
|
|
|
60
64
|
.schema
|
|
61
65
|
);
|
|
62
66
|
|
|
63
|
-
const
|
|
67
|
+
const create = new PortfolioSchema(SchemaBuilder.withName('Create')
|
|
64
68
|
.withField('user', DataType.STRING)
|
|
65
69
|
.withField('portfolio', DataType.STRING)
|
|
66
70
|
.withField('name', DataType.STRING)
|
|
67
71
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
|
|
72
|
+
.withField('dates.create', DataType.DAY)
|
|
73
|
+
.withField('dates.cash', DataType.DAY, true)
|
|
68
74
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'))
|
|
69
|
-
.withField('
|
|
70
|
-
.withField('
|
|
75
|
+
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
76
|
+
.withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
77
|
+
.withField('legacy.system', DataType.STRING, true)
|
|
78
|
+
.withField('legacy.user', DataType.STRING, true)
|
|
79
|
+
.withField('system.version', DataType.NUMBER, true)
|
|
80
|
+
.schema
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const update = new PortfolioSchema(SchemaBuilder.withName('Update')
|
|
84
|
+
.withField('user', DataType.STRING)
|
|
85
|
+
.withField('portfolio', DataType.STRING)
|
|
86
|
+
.withField('name', DataType.STRING)
|
|
87
|
+
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
|
|
88
|
+
.withField('dates.cash', DataType.DAY, true)
|
|
89
|
+
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'))
|
|
90
|
+
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
91
|
+
.withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
71
92
|
.schema
|
|
72
93
|
);
|
|
73
94
|
|
|
@@ -31,10 +31,6 @@ module.exports = (() => {
|
|
|
31
31
|
return complete;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
static get SIMPLE() {
|
|
35
|
-
return simple;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
34
|
toString() {
|
|
39
35
|
return '[PositionSchema]';
|
|
40
36
|
}
|
|
@@ -72,25 +68,5 @@ module.exports = (() => {
|
|
|
72
68
|
.schema
|
|
73
69
|
);
|
|
74
70
|
|
|
75
|
-
const simple = new PositionSchema(SchemaBuilder.withName('Simple')
|
|
76
|
-
.withField('position', DataType.STRING)
|
|
77
|
-
.withField('instrument.id', DataType.STRING)
|
|
78
|
-
.withField('instrument.name', DataType.STRING)
|
|
79
|
-
.withField('instrument.type', DataType.STRING)
|
|
80
|
-
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
|
|
81
|
-
.withField('instrument.delist', DataType.DAY, true)
|
|
82
|
-
.withField('instrument.symbol.barchart', DataType.STRING, true)
|
|
83
|
-
.withField('instrument.symbol.display', DataType.STRING, true)
|
|
84
|
-
.withField('snapshot.date', DataType.DAY)
|
|
85
|
-
.withField('snapshot.open', DataType.DECIMAL)
|
|
86
|
-
.withField('snapshot.buys', DataType.DECIMAL)
|
|
87
|
-
.withField('snapshot.sells', DataType.DECIMAL)
|
|
88
|
-
.withField('snapshot.gain', DataType.DECIMAL)
|
|
89
|
-
.withField('snapshot.basis', DataType.DECIMAL)
|
|
90
|
-
.withField('snapshot.income', DataType.DECIMAL)
|
|
91
|
-
.withField('snapshot.value', DataType.DECIMAL)
|
|
92
|
-
.schema
|
|
93
|
-
);
|
|
94
|
-
|
|
95
71
|
return PositionSchema;
|
|
96
72
|
})();
|
|
@@ -30,22 +30,6 @@ module.exports = (() => {
|
|
|
30
30
|
return complete;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
static get SIMPLE() {
|
|
34
|
-
return simple;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static get DISPLAY() {
|
|
38
|
-
return display;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static get DOWNLOAD() {
|
|
42
|
-
return download;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static get SNAPSHOT() {
|
|
46
|
-
return snapshot;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
33
|
toString() {
|
|
50
34
|
return '[TransactionSchema]';
|
|
51
35
|
}
|
|
@@ -91,58 +75,5 @@ module.exports = (() => {
|
|
|
91
75
|
.schema
|
|
92
76
|
);
|
|
93
77
|
|
|
94
|
-
const simple = new TransactionSchema(SchemaBuilder.withName('Simple')
|
|
95
|
-
.withField('sequence', DataType.NUMBER)
|
|
96
|
-
.withField('date', DataType.DAY)
|
|
97
|
-
.withField('description', DataType.STRING)
|
|
98
|
-
.withField('amount', DataType.DECIMAL)
|
|
99
|
-
.schema
|
|
100
|
-
);
|
|
101
|
-
|
|
102
|
-
const display = new TransactionSchema(SchemaBuilder.withName('Display')
|
|
103
|
-
.withField('sequence', DataType.NUMBER)
|
|
104
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
105
|
-
.withField('date', DataType.DAY)
|
|
106
|
-
.withField('amount', DataType.DECIMAL)
|
|
107
|
-
.withField('quantity', DataType.DECIMAL)
|
|
108
|
-
.withField('fee', DataType.DECIMAL)
|
|
109
|
-
.withField('snapshot.open', DataType.DECIMAL)
|
|
110
|
-
.withField('trade.price', DataType.DECIMAL, true)
|
|
111
|
-
.withField('dividend.rate', DataType.DECIMAL, true)
|
|
112
|
-
.withField('dividend.amount', DataType.DECIMAL, true)
|
|
113
|
-
.withField('charge.amount', DataType.DECIMAL, true)
|
|
114
|
-
.withField('income.amount', DataType.DECIMAL, true)
|
|
115
|
-
.withField('valuation.value', DataType.DECIMAL, true)
|
|
116
|
-
.schema
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
const download = new TransactionSchema(SchemaBuilder.withName('Download')
|
|
120
|
-
.withField('sequence', DataType.NUMBER)
|
|
121
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
122
|
-
.withField('date', DataType.DAY)
|
|
123
|
-
.withField('amount', DataType.DECIMAL)
|
|
124
|
-
.withField('quantity', DataType.DECIMAL)
|
|
125
|
-
.withField('fee', DataType.DECIMAL)
|
|
126
|
-
.withField('snapshot.open', DataType.DECIMAL)
|
|
127
|
-
.withField('trade.price', DataType.DECIMAL, true)
|
|
128
|
-
.withField('dividend.rate', DataType.DECIMAL, true)
|
|
129
|
-
.withField('dividend.amount', DataType.DECIMAL, true)
|
|
130
|
-
.withField('charge.amount', DataType.DECIMAL, true)
|
|
131
|
-
.withField('income.amount', DataType.DECIMAL, true)
|
|
132
|
-
.withField('valuation.value', DataType.DECIMAL, true)
|
|
133
|
-
.schema);
|
|
134
|
-
|
|
135
|
-
const snapshot = new TransactionSchema(SchemaBuilder.withName('Snapshot')
|
|
136
|
-
.withField('position', DataType.STRING)
|
|
137
|
-
.withField('sequence', DataType.NUMBER)
|
|
138
|
-
.withField('date', DataType.DAY)
|
|
139
|
-
.withField('snapshot.open', DataType.DECIMAL)
|
|
140
|
-
.withField('snapshot.gain', DataType.DECIMAL)
|
|
141
|
-
.withField('snapshot.basis', DataType.DECIMAL)
|
|
142
|
-
.withField('snapshot.income', DataType.DECIMAL)
|
|
143
|
-
.withField('snapshot.value', DataType.DECIMAL)
|
|
144
|
-
.schema
|
|
145
|
-
);
|
|
146
|
-
|
|
147
78
|
return TransactionSchema;
|
|
148
79
|
})();
|