@barchart/portfolio-api-common 1.7.0 → 1.8.0

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,3 @@
1
+ **New Features**
2
+
3
+ * Added a new `PortfolioFailureType` for attempts to switch to dividend reinvestment when the position is short.
@@ -348,8 +348,30 @@ module.exports = (() => {
348
348
  static get TRANSACTION_EDIT_FAILED_TYPE_CHANGED() {
349
349
  return transactionEditFailedTypeChanged;
350
350
  }
351
+
352
+ /**
353
+ * Conversion of transaction type is unsupported.
354
+ *
355
+ * @public
356
+ * @static
357
+ * @returns {FailureType}
358
+ */
359
+ static get TRANSACTION_SWITCH_FAILED_INVALID_CONVERSION() {
360
+ return transactionSwitchFailedInvalidConversion;
361
+ }
351
362
 
352
-
363
+ /**
364
+ * Conversion of transaction type is not allowed. Dividends (or distributions)
365
+ * cannot be reinvested when the position is short.
366
+ *
367
+ * @public
368
+ * @static
369
+ * @returns {FailureType}
370
+ */
371
+ static get TRANSACTION_SWITCH_FAILED_INVALID_REINVEST() {
372
+ return transactionSwitchFailedInvalidReinvest;
373
+ }
374
+
353
375
  toString() {
354
376
  return '[PortfolioFailureType]';
355
377
  }
@@ -389,7 +411,10 @@ module.exports = (() => {
389
411
  const transactionEditFailedInvalidDate = new FailureType('TRANSACTION_EDIT_FAILED_INVALID_DATE', 'Unable to edit transaction with given date.');
390
412
  const transactionEditFailedNoTransaction = new FailureType('TRANSACTION_EDIT_FAILED_NO_TRANSACTION', 'Unable to edit transaction. The referenced transaction does not exist.', false);
391
413
  const transactionEditFailedTypeReserved = new FailureType('TRANSACTION_EDIT_FAILED_TYPE_RESERVED', 'Unable to edit {U|type.description} transaction, this type of transaction is managed by the system.');
392
- const transactionEditFailedTypeChanged = new FailureType('TRANSACTION_EDIT_FAILED_TYPE_CHANGED', 'Changing a transaction type is forbidden. You must delete the existing transaction then recreate it.');
414
+ const transactionEditFailedTypeChanged = new FailureType('TRANSACTION_EDIT_FAILED_TYPE_CHANGED', 'Changing a transaction type is forbidden. You must delete the existing transaction and then create a new transaction.');
415
+
416
+ const transactionSwitchFailedInvalidConversion = new FailureType('TRANSACTION_SWITCH_FAILED_INVALID_CONVERSION', 'Unable to convert transaction from {U|existing.description} to {U|desired.description}. This conversion is not supported.');
417
+ const transactionSwitchFailedInvalidReinvest = new FailureType('TRANSACTION_SWITCH_FAILED_INVALID_REINVEST', 'Unable to convert transaction from {U|existing.description} to {U|desired.description}. Reinvestment is not supported for short positions.');
393
418
 
394
419
  return PortfolioFailureType;
395
420
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Common code used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",