@barchart/portfolio-api-common 1.11.6 → 1.11.7
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.
|
@@ -128,6 +128,8 @@ module.exports = (() => {
|
|
|
128
128
|
f.position = t.position;
|
|
129
129
|
f.open = t.snapshot.open;
|
|
130
130
|
f.transaction = t.transaction;
|
|
131
|
+
|
|
132
|
+
f.raw.open = f.open.toFloat();
|
|
131
133
|
};
|
|
132
134
|
|
|
133
135
|
const averageCostFormatter = (t, f) => {
|
|
@@ -150,14 +152,15 @@ module.exports = (() => {
|
|
|
150
152
|
f.price = t.trade.price;
|
|
151
153
|
f.fee = t.fee;
|
|
152
154
|
f.total = t.amount;
|
|
155
|
+
f.raw.total = f.total.toFloat();
|
|
156
|
+
f.raw.price = f.price.toFloat();
|
|
157
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
153
158
|
};
|
|
154
159
|
|
|
155
160
|
const dividendFormatter = (t, f) => {
|
|
156
161
|
f.total = t.dividend.amount;
|
|
157
162
|
f.rate = t.dividend.rate;
|
|
158
163
|
|
|
159
|
-
f.raw.rate = t.dividend.rate.toFloat();
|
|
160
|
-
|
|
161
164
|
let shares;
|
|
162
165
|
|
|
163
166
|
if (!t.dividend.rate.getIsZero()) {
|
|
@@ -188,7 +191,12 @@ module.exports = (() => {
|
|
|
188
191
|
|
|
189
192
|
if (t.dividend.native) {
|
|
190
193
|
f.native = t.dividend.native;
|
|
194
|
+
f.raw.native = f.native.toFloat();
|
|
191
195
|
}
|
|
196
|
+
|
|
197
|
+
f.raw.rate = f.rate.toFloat();
|
|
198
|
+
f.raw.shares = f.shares.toFloat();
|
|
199
|
+
f.raw.total = f.total.toFloat();
|
|
192
200
|
};
|
|
193
201
|
|
|
194
202
|
const distributionCashFormatter = (t, f) => {
|
|
@@ -225,7 +233,12 @@ module.exports = (() => {
|
|
|
225
233
|
|
|
226
234
|
if (t.dividend.native) {
|
|
227
235
|
f.native = t.dividend.native;
|
|
236
|
+
f.raw.native = f.native.toFloat();
|
|
228
237
|
}
|
|
238
|
+
|
|
239
|
+
f.raw.rate = f.rate.toFloat();
|
|
240
|
+
f.raw.shares = f.shares.toFloat();
|
|
241
|
+
f.raw.total = f.total.toFloat();
|
|
229
242
|
};
|
|
230
243
|
|
|
231
244
|
const dividendReinvestFormatter = (t, f) => {
|
|
@@ -243,6 +256,11 @@ module.exports = (() => {
|
|
|
243
256
|
f.rate = t.dividend.rate;
|
|
244
257
|
|
|
245
258
|
f.shares = t.snapshot.open.subtract(t.quantity);
|
|
259
|
+
|
|
260
|
+
f.raw.rate = f.rate.toFloat();
|
|
261
|
+
f.raw.shares = f.shares.toFloat();
|
|
262
|
+
f.raw.price = f.price.toFloat();
|
|
263
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
246
264
|
};
|
|
247
265
|
|
|
248
266
|
const distributionReinvestFormatter = (t, f) => {
|
|
@@ -260,6 +278,11 @@ module.exports = (() => {
|
|
|
260
278
|
f.rate = t.dividend.rate;
|
|
261
279
|
|
|
262
280
|
f.shares = t.snapshot.open.subtract(t.quantity);
|
|
281
|
+
|
|
282
|
+
f.raw.rate = f.rate.toFloat();
|
|
283
|
+
f.raw.shares = f.shares.toFloat();
|
|
284
|
+
f.raw.price = f.price.toFloat();
|
|
285
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
263
286
|
};
|
|
264
287
|
|
|
265
288
|
const dividendStockFormatter = (t, f) => {
|
|
@@ -284,12 +307,18 @@ module.exports = (() => {
|
|
|
284
307
|
|
|
285
308
|
f.rate = rate;
|
|
286
309
|
|
|
310
|
+
f.raw.rate = f.rate.toFloat();
|
|
311
|
+
|
|
287
312
|
if (t.dividend.price) {
|
|
288
313
|
f.price = t.dividend.price;
|
|
314
|
+
f.raw.price = f.price.toFloat();
|
|
289
315
|
}
|
|
290
316
|
}
|
|
291
317
|
|
|
292
318
|
f.shares = t.snapshot.open.subtract(t.quantity);
|
|
319
|
+
|
|
320
|
+
f.raw.shares = f.shares.toFloat();
|
|
321
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
293
322
|
};
|
|
294
323
|
|
|
295
324
|
const distributionFundFormatter = (t, f) => {
|
|
@@ -314,25 +343,34 @@ module.exports = (() => {
|
|
|
314
343
|
|
|
315
344
|
f.rate = rate;
|
|
316
345
|
|
|
346
|
+
f.raw.rate = f.rate.toFloat();
|
|
347
|
+
|
|
317
348
|
if (t.dividend.price) {
|
|
318
349
|
f.price = t.dividend.price;
|
|
350
|
+
f.raw.price = f.price.toFloat();
|
|
319
351
|
}
|
|
320
352
|
}
|
|
321
353
|
|
|
322
354
|
f.shares = t.snapshot.open.subtract(t.quantity);
|
|
355
|
+
|
|
356
|
+
f.raw.shares = f.shares.toFloat();
|
|
357
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
323
358
|
};
|
|
324
359
|
|
|
325
360
|
const incomeFormatter = (t, f) => {
|
|
326
361
|
f.total = t.income.amount;
|
|
362
|
+
f.raw.total = f.total.toFloat();
|
|
327
363
|
};
|
|
328
364
|
|
|
329
365
|
const feeFormatter = (t, f) => {
|
|
330
366
|
f.fee = t.charge.amount;
|
|
331
367
|
f.total = t.charge.amount;
|
|
368
|
+
f.raw.total = f.total.toFloat();
|
|
332
369
|
};
|
|
333
370
|
|
|
334
371
|
const feeUnitsFormatter = (t, f) => {
|
|
335
372
|
f.boughtSold = t.quantity;
|
|
373
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
336
374
|
};
|
|
337
375
|
|
|
338
376
|
const splitFormatter = (t, f) => {
|
|
@@ -349,6 +387,10 @@ module.exports = (() => {
|
|
|
349
387
|
f.rate = rate;
|
|
350
388
|
|
|
351
389
|
f.shares = t.snapshot.open.subtract(t.quantity);
|
|
390
|
+
|
|
391
|
+
f.raw.rate = f.rate.toFloat();
|
|
392
|
+
f.raw.shares = f.shares.toFloat();
|
|
393
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
352
394
|
};
|
|
353
395
|
|
|
354
396
|
const valuationFormatter = (t, f) => {
|
|
@@ -367,10 +409,12 @@ module.exports = (() => {
|
|
|
367
409
|
}
|
|
368
410
|
|
|
369
411
|
f.price = rate;
|
|
412
|
+
f.raw.price = f.price.toFloat();
|
|
370
413
|
};
|
|
371
414
|
|
|
372
415
|
const cashFormatter = (t, f) => {
|
|
373
416
|
f.total = t.quantity;
|
|
417
|
+
f.raw.total = f.total.toFloat();
|
|
374
418
|
};
|
|
375
419
|
|
|
376
420
|
const debitFormatter = (t, f) => {
|
|
@@ -395,6 +439,10 @@ module.exports = (() => {
|
|
|
395
439
|
f.rate = rate;
|
|
396
440
|
|
|
397
441
|
f.shares = t.snapshot.open.subtract(t.quantity);
|
|
442
|
+
|
|
443
|
+
f.raw.rate = f.rate.toFloat();
|
|
444
|
+
f.raw.shares = f.shares.toFloat();
|
|
445
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
398
446
|
};
|
|
399
447
|
|
|
400
448
|
const spinoffFormatter = (t, f) => {
|
|
@@ -411,6 +459,10 @@ module.exports = (() => {
|
|
|
411
459
|
f.rate = rate;
|
|
412
460
|
|
|
413
461
|
f.shares = t.snapshot.open.subtract(t.quantity);
|
|
462
|
+
|
|
463
|
+
f.raw.rate = f.rate.toFloat();
|
|
464
|
+
f.raw.shares = f.shares.toFloat();
|
|
465
|
+
f.raw.boughtSold = f.boughtSold.toFloat();
|
|
414
466
|
};
|
|
415
467
|
|
|
416
468
|
const formatters = new Map();
|