@barchart/portfolio-api-common 1.0.18 → 1.0.19

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.
@@ -30,6 +30,79 @@ module.exports = (() => {
30
30
  return complete;
31
31
  }
32
32
 
33
+ static get BUY() {
34
+ return buy;
35
+ }
36
+
37
+ static get SELL() {
38
+ return sell;
39
+ }
40
+
41
+ static get BUY_SHORT() {
42
+ return buyShort;
43
+ }
44
+
45
+ static get SELL_SHORT() {
46
+ return sellShort;
47
+ }
48
+
49
+ static get DIVIDEND() {
50
+ return dividend;
51
+ }
52
+
53
+ static get DIVIDEND_REINVEST() {
54
+ return dividendReinvest;
55
+ }
56
+
57
+ static get DIVIDEND_STOCK() {
58
+ return dividendStock;
59
+ }
60
+
61
+ static get DISTRIBUTION_CASH() {
62
+ return distributionCash;
63
+ }
64
+
65
+ static get DISTRIBUTION_FUND() {
66
+ return distributionFund;
67
+ }
68
+
69
+ static get SPLIT() {
70
+ return split;
71
+ }
72
+
73
+ static get FEE() {
74
+ return fee;
75
+ }
76
+
77
+ static get FEE_UNITS() {
78
+ return feeUnits;
79
+ }
80
+
81
+ static get DEPOSIT() {
82
+ return deposit;
83
+ }
84
+
85
+ static get WITHDRAWAL() {
86
+ return withdrawal;
87
+ }
88
+
89
+ static get DEBIT() {
90
+ return debit;
91
+ }
92
+
93
+ static get CREDIT() {
94
+ return credit;
95
+ }
96
+
97
+ static get VALUATION() {
98
+ return valuation;
99
+ }
100
+
101
+ static get INCOME() {
102
+ return income;
103
+ }
104
+
105
+
33
106
  toString() {
34
107
  return '[TransactionSchema]';
35
108
  }
@@ -75,5 +148,152 @@ module.exports = (() => {
75
148
  .schema
76
149
  );
77
150
 
151
+ const buy = new TransactionSchema(SchemaBuilder.withName('B')
152
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
153
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
154
+ .withField('date', DataType.DAY)
155
+ .withField('fee', DataType.DECIMAL, true)
156
+ .withField('price', DataType.DECIMAL)
157
+ .withField('quantity', DataType.DECIMAL)
158
+ .schema
159
+ );
160
+
161
+ const sell = new TransactionSchema(SchemaBuilder.withName('S')
162
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
163
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
164
+ .withField('date', DataType.DAY)
165
+ .withField('fee', DataType.DECIMAL, true)
166
+ .schema
167
+ );
168
+
169
+ const buyShort = new TransactionSchema(SchemaBuilder.withName('BS')
170
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
171
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
172
+ .withField('date', DataType.DAY)
173
+ .withField('fee', DataType.DECIMAL, true)
174
+ .schema
175
+ );
176
+
177
+ const sellShort = new TransactionSchema(SchemaBuilder.withName('SS')
178
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
179
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
180
+ .withField('date', DataType.DAY)
181
+ .withField('fee', DataType.DECIMAL, true)
182
+ .schema
183
+ );
184
+
185
+ const dividend = new TransactionSchema(SchemaBuilder.withName('DV')
186
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
187
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
188
+ .withField('date', DataType.DAY)
189
+ .withField('fee', DataType.DECIMAL, true)
190
+ .schema
191
+ );
192
+
193
+ const dividendReinvest = new TransactionSchema(SchemaBuilder.withName('DX')
194
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
195
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
196
+ .withField('date', DataType.DAY)
197
+ .withField('fee', DataType.DECIMAL, true)
198
+ .schema
199
+ );
200
+
201
+ const dividendStock = new TransactionSchema(SchemaBuilder.withName('DS')
202
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
203
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
204
+ .withField('date', DataType.DAY)
205
+ .withField('fee', DataType.DECIMAL, true)
206
+ .schema
207
+ );
208
+
209
+ const distributionCash = new TransactionSchema(SchemaBuilder.withName('DC')
210
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
211
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
212
+ .withField('date', DataType.DAY)
213
+ .withField('fee', DataType.DECIMAL, true)
214
+ .schema
215
+ );
216
+
217
+ const distributionFund = new TransactionSchema(SchemaBuilder.withName('DF')
218
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
219
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
220
+ .withField('date', DataType.DAY)
221
+ .withField('fee', DataType.DECIMAL, true)
222
+ .schema
223
+ );
224
+
225
+ const split = new TransactionSchema(SchemaBuilder.withName('SP')
226
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
227
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
228
+ .withField('date', DataType.DAY)
229
+ .withField('fee', DataType.DECIMAL, true)
230
+ .schema
231
+ );
232
+
233
+ const fee = new TransactionSchema(SchemaBuilder.withName('F')
234
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
235
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
236
+ .withField('date', DataType.DAY)
237
+ .withField('fee', DataType.DECIMAL, true)
238
+ .schema
239
+ );
240
+
241
+ const feeUnits = new TransactionSchema(SchemaBuilder.withName('FU')
242
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
243
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
244
+ .withField('date', DataType.DAY)
245
+ .withField('fee', DataType.DECIMAL, true)
246
+ .schema
247
+ );
248
+
249
+ const deposit = new TransactionSchema(SchemaBuilder.withName('D')
250
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
251
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
252
+ .withField('date', DataType.DAY)
253
+ .withField('fee', DataType.DECIMAL, true)
254
+ .schema
255
+ );
256
+
257
+ const withdrawal = new TransactionSchema(SchemaBuilder.withName('W')
258
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
259
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
260
+ .withField('date', DataType.DAY)
261
+ .withField('fee', DataType.DECIMAL, true)
262
+ .schema
263
+ );
264
+
265
+ const debit = new TransactionSchema(SchemaBuilder.withName('DR')
266
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
267
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
268
+ .withField('date', DataType.DAY)
269
+ .withField('fee', DataType.DECIMAL, true)
270
+ .schema
271
+ );
272
+
273
+ const credit = new TransactionSchema(SchemaBuilder.withName('CR')
274
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
275
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
276
+ .withField('date', DataType.DAY)
277
+ .withField('fee', DataType.DECIMAL, true)
278
+ .schema
279
+ );
280
+
281
+ const valuation = new TransactionSchema(SchemaBuilder.withName('V')
282
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
283
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
284
+ .withField('date', DataType.DAY)
285
+ .withField('fee', DataType.DECIMAL, true)
286
+ .schema
287
+ );
288
+
289
+ const income = new TransactionSchema(SchemaBuilder.withName('I')
290
+ .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
291
+ .withField('currency', DataType.forEnum(Currency, 'Currency'))
292
+ .withField('date', DataType.DAY)
293
+ .withField('fee', DataType.DECIMAL, true)
294
+ .schema
295
+ );
296
+
297
+
78
298
  return TransactionSchema;
79
299
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",