@barchart/portfolio-api-common 7.4.1 → 7.5.2
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.
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
const Enum = require('@barchart/common-js/lang/Enum');
|
|
2
|
+
|
|
3
|
+
module.exports = (() => {
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* An enumeration item that describes a strategy for importing positions
|
|
8
|
+
* into a SnapTrade-linked account.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @extends {Enum}
|
|
12
|
+
* @param {String} code
|
|
13
|
+
*/
|
|
14
|
+
class SnapTradeLinkMode extends Enum {
|
|
15
|
+
constructor(code) {
|
|
16
|
+
super(code, code);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
static get STANDARD() {
|
|
20
|
+
return standard;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static get LIMITED() {
|
|
24
|
+
return limited;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Given a code, returns the enumeration item.
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
* @param {String} code
|
|
32
|
+
* @returns {SnapTradeLinkMode|null}
|
|
33
|
+
*/
|
|
34
|
+
static parse(code) {
|
|
35
|
+
return Enum.fromCode(SnapTradeLinkMode, code);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
toString() {
|
|
39
|
+
return `[SnapTradeLinkMode (code=${this.code})]`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const standard = new SnapTradeLinkMode('STANDARD');
|
|
44
|
+
const limited = new SnapTradeLinkMode('LIMITED');
|
|
45
|
+
|
|
46
|
+
return SnapTradeLinkMode;
|
|
47
|
+
})();
|
|
@@ -5,6 +5,7 @@ const Currency = require('@barchart/common-js/lang/Currency'),
|
|
|
5
5
|
Timezones = require('@barchart/common-js/lang/Timezones');
|
|
6
6
|
|
|
7
7
|
const SnapTradeLinkStatus = require('./../data/SnapTradeLinkStatus'),
|
|
8
|
+
SnapTradeLinkMode = require('./../data/SnapTradeLinkMode'),
|
|
8
9
|
ValuationType = require('./../data/ValuationType');
|
|
9
10
|
|
|
10
11
|
module.exports = (() => {
|
|
@@ -96,96 +97,123 @@ module.exports = (() => {
|
|
|
96
97
|
const complete = new PortfolioSchema(SchemaBuilder.withName('complete')
|
|
97
98
|
.withField('user', DataType.STRING)
|
|
98
99
|
.withField('portfolio', DataType.STRING)
|
|
100
|
+
|
|
99
101
|
.withField('name', DataType.STRING)
|
|
100
102
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
|
|
103
|
+
.withField('miscellany', DataType.AD_HOC, true)
|
|
104
|
+
.withField('email', DataType.AD_HOC, true)
|
|
105
|
+
|
|
101
106
|
.withField('dates.create', DataType.DAY)
|
|
102
107
|
.withField('dates.access', DataType.TIMESTAMP, true)
|
|
108
|
+
|
|
103
109
|
.withField('defaults.cash', DataType.BOOLEAN, true)
|
|
104
110
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'))
|
|
105
111
|
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
106
112
|
.withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
113
|
+
|
|
114
|
+
.withField('legacy.system', DataType.STRING, true)
|
|
115
|
+
.withField('legacy.user', DataType.STRING, true)
|
|
116
|
+
.withField('legacy.portfolio', DataType.STRING, true)
|
|
117
|
+
.withField('legacy.warnings', DataType.NUMBER, true)
|
|
118
|
+
.withField('legacy.drops', DataType.NUMBER, true)
|
|
119
|
+
|
|
107
120
|
.withField('snaptrade.connection', DataType.STRING, true)
|
|
108
121
|
.withField('snaptrade.account', DataType.STRING, true)
|
|
109
122
|
.withField('snaptrade.broken', DataType.BOOLEAN, true)
|
|
110
123
|
.withField('snaptrade.timestamp', DataType.TIMESTAMP, true)
|
|
124
|
+
|
|
125
|
+
.withField('snaptrade.brokerage.display', DataType.STRING, true)
|
|
126
|
+
.withField('snaptrade.brokerage.logo', DataType.STRING, true)
|
|
127
|
+
|
|
128
|
+
.withField('snaptrade.link.mode', DataType.forEnum(SnapTradeLinkMode, 'SnapTradeLinkMode'), true)
|
|
111
129
|
.withField('snaptrade.link.status', DataType.forEnum(SnapTradeLinkStatus, 'SnapTradeLinkStatus'), true)
|
|
112
130
|
.withField('snaptrade.link.progress', DataType.NUMBER, true)
|
|
113
131
|
.withField('snaptrade.link.timestamp', DataType.TIMESTAMP, true)
|
|
114
|
-
|
|
115
|
-
.withField('snaptrade.brokerage.logo', DataType.STRING, true)
|
|
116
|
-
.withField('legacy.system', DataType.STRING, true)
|
|
117
|
-
.withField('legacy.user', DataType.STRING, true)
|
|
118
|
-
.withField('legacy.portfolio', DataType.STRING, true)
|
|
119
|
-
.withField('legacy.warnings', DataType.NUMBER, true)
|
|
120
|
-
.withField('legacy.drops', DataType.NUMBER, true)
|
|
121
|
-
.withField('miscellany', DataType.AD_HOC, true)
|
|
122
|
-
.withField('email', DataType.AD_HOC, true)
|
|
123
|
-
.withField('system.calculate.processors', DataType.NUMBER, true)
|
|
132
|
+
|
|
124
133
|
.withField('system.sequence', DataType.NUMBER)
|
|
125
134
|
.withField('system.version', DataType.STRING)
|
|
126
135
|
.withField('system.timestamp', DataType.TIMESTAMP)
|
|
136
|
+
.withField('system.calculate.processors', DataType.NUMBER, true)
|
|
137
|
+
|
|
127
138
|
.schema
|
|
128
139
|
);
|
|
129
140
|
|
|
130
141
|
const client = new PortfolioSchema(SchemaBuilder.withName('client')
|
|
131
142
|
.withField('user', DataType.STRING)
|
|
132
143
|
.withField('portfolio', DataType.STRING)
|
|
144
|
+
|
|
133
145
|
.withField('name', DataType.STRING)
|
|
134
146
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
|
|
147
|
+
.withField('miscellany', DataType.AD_HOC, true)
|
|
148
|
+
.withField('email', DataType.AD_HOC, true)
|
|
149
|
+
|
|
135
150
|
.withField('dates.create', DataType.DAY)
|
|
136
151
|
.withField('dates.access', DataType.TIMESTAMP, true)
|
|
152
|
+
|
|
137
153
|
.withField('defaults.cash', DataType.BOOLEAN, true)
|
|
138
154
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'))
|
|
139
155
|
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
140
156
|
.withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
157
|
+
|
|
158
|
+
.withField('legacy.system', DataType.STRING, true)
|
|
159
|
+
.withField('legacy.user', DataType.STRING, true)
|
|
160
|
+
.withField('legacy.portfolio', DataType.STRING, true)
|
|
161
|
+
.withField('legacy.warnings', DataType.NUMBER, true)
|
|
162
|
+
.withField('legacy.drops', DataType.NUMBER, true)
|
|
163
|
+
|
|
141
164
|
.withField('snaptrade.connection', DataType.STRING, true)
|
|
142
165
|
.withField('snaptrade.account', DataType.STRING, true)
|
|
143
166
|
.withField('snaptrade.broken', DataType.BOOLEAN, true)
|
|
144
167
|
.withField('snaptrade.timestamp', DataType.TIMESTAMP, true)
|
|
168
|
+
|
|
169
|
+
.withField('snaptrade.brokerage.display', DataType.STRING, true)
|
|
170
|
+
.withField('snaptrade.brokerage.logo', DataType.STRING, true)
|
|
171
|
+
|
|
172
|
+
.withField('snaptrade.link.mode', DataType.forEnum(SnapTradeLinkMode, 'SnapTradeLinkMode'), true)
|
|
145
173
|
.withField('snaptrade.link.status', DataType.forEnum(SnapTradeLinkStatus, 'SnapTradeLinkStatus'), true)
|
|
146
174
|
.withField('snaptrade.link.progress', DataType.NUMBER, true)
|
|
147
175
|
.withField('snaptrade.link.timestamp', DataType.TIMESTAMP, true)
|
|
148
|
-
|
|
149
|
-
.withField('snaptrade.brokerage.logo', DataType.STRING, true)
|
|
150
|
-
.withField('legacy.system', DataType.STRING, true)
|
|
151
|
-
.withField('legacy.user', DataType.STRING, true)
|
|
152
|
-
.withField('legacy.portfolio', DataType.STRING, true)
|
|
153
|
-
.withField('legacy.warnings', DataType.NUMBER, true)
|
|
154
|
-
.withField('legacy.drops', DataType.NUMBER, true)
|
|
155
|
-
.withField('miscellany', DataType.AD_HOC, true)
|
|
156
|
-
.withField('email', DataType.AD_HOC, true)
|
|
176
|
+
|
|
157
177
|
.withField('system.calculate.processors', DataType.NUMBER, true)
|
|
178
|
+
|
|
158
179
|
.schema
|
|
159
180
|
);
|
|
160
181
|
|
|
161
182
|
const name = new PortfolioSchema(SchemaBuilder.withName('name')
|
|
162
183
|
.withField('user', DataType.STRING)
|
|
163
184
|
.withField('portfolio', DataType.STRING)
|
|
185
|
+
|
|
164
186
|
.withField('name', DataType.STRING)
|
|
187
|
+
|
|
165
188
|
.schema
|
|
166
189
|
);
|
|
167
190
|
|
|
168
191
|
const create = new PortfolioSchema(SchemaBuilder.withName('create')
|
|
169
192
|
.withField('name', DataType.STRING)
|
|
170
193
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'))
|
|
194
|
+
.withField('miscellany', DataType.AD_HOC, true)
|
|
195
|
+
.withField('email', DataType.AD_HOC, true)
|
|
196
|
+
|
|
171
197
|
.withField('defaults.cash', DataType.BOOLEAN, true)
|
|
172
198
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
173
199
|
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
174
200
|
.withField('defaults.valuation', DataType.forEnum(ValuationType, 'ValuationType'), true)
|
|
175
|
-
|
|
176
|
-
.withField('email', DataType.AD_HOC, true)
|
|
201
|
+
|
|
177
202
|
.schema
|
|
178
203
|
);
|
|
179
204
|
|
|
180
205
|
const update = new PortfolioSchema(SchemaBuilder.withName('update')
|
|
181
206
|
.withField('portfolio', DataType.STRING)
|
|
182
|
-
|
|
207
|
+
|
|
183
208
|
.withField('timezone', DataType.forEnum(Timezones, 'Timezone'), true)
|
|
209
|
+
.withField('name', DataType.STRING)
|
|
210
|
+
.withField('miscellany', DataType.AD_HOC, true)
|
|
211
|
+
.withField('email', DataType.AD_HOC, true)
|
|
212
|
+
|
|
184
213
|
.withField('defaults.cash', DataType.BOOLEAN, true)
|
|
185
214
|
.withField('defaults.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
186
215
|
.withField('defaults.reinvest', DataType.BOOLEAN, true)
|
|
187
|
-
|
|
188
|
-
.withField('email', DataType.AD_HOC, true)
|
|
216
|
+
|
|
189
217
|
.schema
|
|
190
218
|
);
|
|
191
219
|
|