@barchart/portfolio-api-common 1.2.35 → 1.2.39
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.
|
@@ -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
|
|
|
@@ -267,13 +267,13 @@ module.exports = (() => {
|
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
const comparator = ComparatorBuilder.startWith((a, b) => {
|
|
270
|
-
return Day.compareDays(
|
|
270
|
+
return Day.compareDays(a.date, b.date);
|
|
271
271
|
}).thenBy((a, b) => {
|
|
272
272
|
return comparators.compareNumbers(getInstrumentTypePriority(a.instrument.type), getInstrumentTypePriority(b.instrument.type));
|
|
273
273
|
}).thenBy((a, b) => {
|
|
274
274
|
return comparators.compareStrings(a.instrument.id, b.instrument.id);
|
|
275
275
|
}).thenBy((a, b) => {
|
|
276
|
-
return comparators.compareNumbers(
|
|
276
|
+
return comparators.compareNumbers(a.sequence, b.sequence);
|
|
277
277
|
}).toComparator();
|
|
278
278
|
|
|
279
279
|
return TransactionFormatter;
|
|
@@ -103,38 +103,6 @@ module.exports = (() => {
|
|
|
103
103
|
return sellShort;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
static get DIVIDEND() {
|
|
107
|
-
return dividend;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
static get DIVIDEND_REINVEST() {
|
|
111
|
-
return dividendReinvest;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
static get DIVIDEND_STOCK() {
|
|
115
|
-
return dividendStock;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
static get DISTRIBUTION_CASH() {
|
|
119
|
-
return distributionCash;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
static get DISTRIBUTION_FUND() {
|
|
123
|
-
return distributionFund;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
static get SPLIT() {
|
|
127
|
-
return split;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
static get FEE() {
|
|
131
|
-
return fee;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
static get FEE_UNITS() {
|
|
135
|
-
return feeUnits;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
106
|
static get DEPOSIT() {
|
|
139
107
|
return deposit;
|
|
140
108
|
}
|
|
@@ -143,14 +111,6 @@ module.exports = (() => {
|
|
|
143
111
|
return withdrawal;
|
|
144
112
|
}
|
|
145
113
|
|
|
146
|
-
static get DEBIT() {
|
|
147
|
-
return debit;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
static get CREDIT() {
|
|
151
|
-
return credit;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
114
|
static get VALUATION() {
|
|
155
115
|
return valuation;
|
|
156
116
|
}
|
|
@@ -259,8 +219,9 @@ module.exports = (() => {
|
|
|
259
219
|
.withField('price', DataType.DECIMAL)
|
|
260
220
|
.withField('quantity', DataType.DECIMAL)
|
|
261
221
|
.withField('fee', DataType.DECIMAL, true)
|
|
262
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
263
222
|
.withField('reinvest', DataType.BOOLEAN, true)
|
|
223
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
224
|
+
.withField('force', DataType.BOOLEAN, true)
|
|
264
225
|
.schema
|
|
265
226
|
);
|
|
266
227
|
|
|
@@ -287,7 +248,6 @@ module.exports = (() => {
|
|
|
287
248
|
.withField('quantity', DataType.DECIMAL)
|
|
288
249
|
.withField('fee', DataType.DECIMAL, true)
|
|
289
250
|
.withField('force', DataType.BOOLEAN, true)
|
|
290
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
291
251
|
.schema
|
|
292
252
|
);
|
|
293
253
|
|
|
@@ -305,83 +265,8 @@ module.exports = (() => {
|
|
|
305
265
|
.withField('price', DataType.DECIMAL)
|
|
306
266
|
.withField('quantity', DataType.DECIMAL)
|
|
307
267
|
.withField('fee', DataType.DECIMAL, true)
|
|
308
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
309
268
|
.withField('reinvest', DataType.BOOLEAN, true)
|
|
310
|
-
.
|
|
311
|
-
);
|
|
312
|
-
|
|
313
|
-
const dividend = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND.code)
|
|
314
|
-
.withField('portfolio', DataType.STRING)
|
|
315
|
-
.withField('position', DataType.STRING)
|
|
316
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
317
|
-
.withField('date', DataType.DAY)
|
|
318
|
-
.withField('rate', DataType.DECIMAL)
|
|
319
|
-
.withField('effective', DataType.DAY)
|
|
320
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
321
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
322
|
-
.schema
|
|
323
|
-
);
|
|
324
|
-
|
|
325
|
-
const dividendReinvest = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND_REINVEST.code)
|
|
326
|
-
.withField('portfolio', DataType.STRING)
|
|
327
|
-
.withField('position', DataType.STRING)
|
|
328
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
329
|
-
.withField('date', DataType.DAY)
|
|
330
|
-
.withField('rate', DataType.DECIMAL)
|
|
331
|
-
.withField('effective', DataType.DAY)
|
|
332
|
-
.withField('price', DataType.DECIMAL)
|
|
333
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
334
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
335
|
-
.schema
|
|
336
|
-
);
|
|
337
|
-
|
|
338
|
-
const dividendStock = new TransactionSchema(SchemaBuilder.withName(TransactionType.DIVIDEND_STOCK.code)
|
|
339
|
-
.withField('portfolio', DataType.STRING)
|
|
340
|
-
.withField('position', DataType.STRING)
|
|
341
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
342
|
-
.withField('date', DataType.DAY)
|
|
343
|
-
.withField('rate', DataType.DECIMAL)
|
|
344
|
-
.withField('effective', DataType.DAY)
|
|
345
|
-
.withField('price', DataType.DECIMAL)
|
|
346
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
347
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
348
|
-
.schema
|
|
349
|
-
);
|
|
350
|
-
|
|
351
|
-
const distributionCash = new TransactionSchema(SchemaBuilder.withName(TransactionType.DISTRIBUTION_CASH.code)
|
|
352
|
-
.withField('portfolio', DataType.STRING)
|
|
353
|
-
.withField('position', DataType.STRING)
|
|
354
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
355
|
-
.withField('date', DataType.DAY)
|
|
356
|
-
.withField('rate', DataType.DECIMAL)
|
|
357
|
-
.withField('effective', DataType.DAY)
|
|
358
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
359
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
360
|
-
.schema
|
|
361
|
-
);
|
|
362
|
-
|
|
363
|
-
const distributionFund = new TransactionSchema(SchemaBuilder.withName(TransactionType.DISTRIBUTION_FUND.code)
|
|
364
|
-
.withField('portfolio', DataType.STRING)
|
|
365
|
-
.withField('position', DataType.STRING)
|
|
366
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
367
|
-
.withField('date', DataType.DAY)
|
|
368
|
-
.withField('rate', DataType.DECIMAL)
|
|
369
|
-
.withField('effective', DataType.DAY)
|
|
370
|
-
.withField('price', DataType.DECIMAL)
|
|
371
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
372
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
373
|
-
.schema
|
|
374
|
-
);
|
|
375
|
-
|
|
376
|
-
const split = new TransactionSchema(SchemaBuilder.withName(TransactionType.SPLIT.code)
|
|
377
|
-
.withField('portfolio', DataType.STRING)
|
|
378
|
-
.withField('position', DataType.STRING)
|
|
379
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
380
|
-
.withField('date', DataType.DAY)
|
|
381
|
-
.withField('numerator', DataType.DECIMAL)
|
|
382
|
-
.withField('denominator', DataType.DECIMAL)
|
|
383
|
-
.withField('effective', DataType.DAY)
|
|
384
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
269
|
+
.withField('cash', DataType.BOOLEAN, true)
|
|
385
270
|
.withField('force', DataType.BOOLEAN, true)
|
|
386
271
|
.schema
|
|
387
272
|
);
|
|
@@ -397,18 +282,6 @@ module.exports = (() => {
|
|
|
397
282
|
.schema
|
|
398
283
|
);
|
|
399
284
|
|
|
400
|
-
const feeUnits = new TransactionSchema(SchemaBuilder.withName(TransactionType.FEE_UNITS.code)
|
|
401
|
-
.withField('portfolio', DataType.STRING)
|
|
402
|
-
.withField('position', DataType.STRING)
|
|
403
|
-
.withField('sequence', DataType.NUMBER, true)
|
|
404
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
405
|
-
.withField('date', DataType.DAY)
|
|
406
|
-
.withField('fee', DataType.DECIMAL)
|
|
407
|
-
.withField('price', DataType.DECIMAL)
|
|
408
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
409
|
-
.schema
|
|
410
|
-
);
|
|
411
|
-
|
|
412
285
|
const deposit = new TransactionSchema(SchemaBuilder.withName(TransactionType.DEPOSIT.code)
|
|
413
286
|
.withField('portfolio', DataType.STRING)
|
|
414
287
|
.withField('position', DataType.STRING)
|
|
@@ -418,7 +291,6 @@ module.exports = (() => {
|
|
|
418
291
|
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
419
292
|
.withField('date', DataType.DAY)
|
|
420
293
|
.withField('amount', DataType.DECIMAL)
|
|
421
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
422
294
|
.withField('force', DataType.BOOLEAN, true)
|
|
423
295
|
.schema
|
|
424
296
|
);
|
|
@@ -432,29 +304,6 @@ module.exports = (() => {
|
|
|
432
304
|
.withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
|
|
433
305
|
.withField('date', DataType.DAY)
|
|
434
306
|
.withField('amount', DataType.DECIMAL)
|
|
435
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
436
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
437
|
-
.schema
|
|
438
|
-
);
|
|
439
|
-
|
|
440
|
-
const debit = new TransactionSchema(SchemaBuilder.withName(TransactionType.DEBIT.code)
|
|
441
|
-
.withField('portfolio', DataType.STRING)
|
|
442
|
-
.withField('position', DataType.STRING)
|
|
443
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
444
|
-
.withField('date', DataType.DAY)
|
|
445
|
-
.withField('amount', DataType.DECIMAL)
|
|
446
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
447
|
-
.withField('force', DataType.BOOLEAN, true)
|
|
448
|
-
.schema
|
|
449
|
-
);
|
|
450
|
-
|
|
451
|
-
const credit = new TransactionSchema(SchemaBuilder.withName(TransactionType.CREDIT.code)
|
|
452
|
-
.withField('portfolio', DataType.STRING)
|
|
453
|
-
.withField('position', DataType.STRING)
|
|
454
|
-
.withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
|
|
455
|
-
.withField('date', DataType.DAY)
|
|
456
|
-
.withField('amount', DataType.DECIMAL)
|
|
457
|
-
.withField('fee', DataType.DECIMAL, true)
|
|
458
307
|
.withField('force', DataType.BOOLEAN, true)
|
|
459
308
|
.schema
|
|
460
309
|
);
|
|
@@ -492,12 +341,7 @@ module.exports = (() => {
|
|
|
492
341
|
addSchemaToMap(TransactionType.SELL, sell);
|
|
493
342
|
addSchemaToMap(TransactionType.BUY_SHORT, buyShort);
|
|
494
343
|
addSchemaToMap(TransactionType.SELL_SHORT, sellShort);
|
|
495
|
-
addSchemaToMap(TransactionType.DIVIDEND, dividend);
|
|
496
|
-
addSchemaToMap(TransactionType.DIVIDEND_STOCK, dividendStock);
|
|
497
|
-
addSchemaToMap(TransactionType.DIVIDEND_REINVEST, dividendReinvest);
|
|
498
|
-
addSchemaToMap(TransactionType.SPLIT, split);
|
|
499
344
|
addSchemaToMap(TransactionType.FEE, fee);
|
|
500
|
-
addSchemaToMap(TransactionType.FEE_UNITS, feeUnits);
|
|
501
345
|
addSchemaToMap(TransactionType.DEPOSIT, deposit);
|
|
502
346
|
addSchemaToMap(TransactionType.WITHDRAWAL, withdrawal);
|
|
503
347
|
addSchemaToMap(TransactionType.VALUATION, valuation);
|
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
|
|