@barchart/portfolio-api-common 1.2.9 → 1.2.10

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.
@@ -235,6 +235,17 @@ module.exports = (() => {
235
235
  return distributionFund;
236
236
  }
237
237
 
238
+ /**
239
+ * A mutual fund distribution in cash, reinvested.
240
+ *
241
+ * @public
242
+ * @static
243
+ * @returns {TransactionType}
244
+ */
245
+ static get DISTRIBUTION_REINVEST() {
246
+ return distributionReinvest;
247
+ }
248
+
238
249
  /**
239
250
  * A split.
240
251
  *
@@ -351,6 +362,7 @@ module.exports = (() => {
351
362
  const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false);
352
363
 
353
364
  const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true);
365
+ const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true);
354
366
  const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true);
355
367
 
356
368
  const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false);
@@ -125,16 +125,25 @@ module.exports = (() => {
125
125
  });
126
126
 
127
127
  formatters.set(TransactionType.DIVIDEND_STOCK, (t) => {
128
- const shares = t.snapshot.open.subtract(t.quantity);
129
128
  const rate = (is.object(t.dividend) && is.string(t.dividend.rate)) || '';
130
129
 
131
130
  return {
132
131
  boughtSold: t.quantity,
133
- shares: shares,
132
+ shares: t.snapshot.open.subtract(t.quantity),
134
133
  rate: rate
135
134
  };
136
135
  });
137
136
 
137
+ formatters.set(TransactionType.DIVIDEND_REINVEST, (t) => {
138
+ return {
139
+ boughtSold: t.quantity,
140
+ shares: t.snapshot.open.subtract(t.quantity),
141
+ price: t.dividend.price,
142
+ fee: t.fee,
143
+ rate: t.dividend.rate
144
+ };
145
+ });
146
+
138
147
  formatters.set(TransactionType.DISTRIBUTION_CASH, (t) => {
139
148
  return {
140
149
  shares: t.snapshot.open,
@@ -143,20 +152,20 @@ module.exports = (() => {
143
152
  };
144
153
  });
145
154
 
146
- formatters.set(TransactionType.DIVIDEND_REINVEST, (t) => {
155
+ formatters.set(TransactionType.DISTRIBUTION_FUND, (t) => {
147
156
  return {
148
157
  shares: t.snapshot.open.subtract(t.quantity),
149
- price: t.dividend.price,
150
- fee: t.fee,
151
- total: t.quantity,
152
- rate: t.dividend.rate
158
+ fee: t.fee
153
159
  };
154
160
  });
155
161
 
156
- formatters.set(TransactionType.DISTRIBUTION_FUND, (t) => {
162
+ formatters.set(TransactionType.DISTRIBUTION_REINVEST, (t) => {
157
163
  return {
164
+ boughtSold: t.quantity,
158
165
  shares: t.snapshot.open.subtract(t.quantity),
159
- fee: t.fee
166
+ price: t.dividend.price,
167
+ fee: t.fee,
168
+ rate: t.dividend.rate
160
169
  };
161
170
  });
162
171
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -845,6 +845,17 @@ module.exports = (() => {
845
845
  return distributionFund;
846
846
  }
847
847
 
848
+ /**
849
+ * A mutual fund distribution in cash, reinvested.
850
+ *
851
+ * @public
852
+ * @static
853
+ * @returns {TransactionType}
854
+ */
855
+ static get DISTRIBUTION_REINVEST() {
856
+ return distributionReinvest;
857
+ }
858
+
848
859
  /**
849
860
  * A split.
850
861
  *
@@ -961,6 +972,7 @@ module.exports = (() => {
961
972
  const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false);
962
973
 
963
974
  const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true);
975
+ const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true);
964
976
  const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true);
965
977
 
966
978
  const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false);