@barchart/portfolio-api-common 1.0.197 → 1.0.198

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.
@@ -22,12 +22,24 @@ module.exports = (() => {
22
22
  return transactionCreateFailedOutOfSequence;
23
23
  }
24
24
 
25
+ /**
26
+ * The transaction would cause the position to change (from long to
27
+ * short, or vice versa).
28
+ *
29
+ * @static
30
+ * @returns {FailureType}
31
+ */
32
+ static get TRANSACTION_CREATE_FAILED_DIRECTION_SWITCH() {
33
+ return transactionCreateFailedDirectionSwitch;
34
+ }
35
+
25
36
  toString() {
26
37
  return '[PortfolioFailureType]';
27
38
  }
28
39
  }
29
40
 
30
- const transactionCreateFailedOutOfSequence = new FailureType('TRANSACTION_CREATE_FAILED_OUT_OF_SEQUENCE', 'Unable to create transaction, the transaction date is out-of-sequence (i.e. it would occur before an existing transaction). Please confirm your intent to re-write transaction history.');
41
+ const transactionCreateFailedOutOfSequence = new FailureType('TRANSACTION_CREATE_FAILED_OUT_OF_SEQUENCE', 'Unable to create transaction, because the transaction date is out-of-sequence. In other words, it would occur before an existing transaction. Please confirm your intent to re-write transaction history (which could take some time and alter the historical results for this position).');
42
+ const transactionCreateFailedDirectionSwitch = new FailureType('TRANSACTION_CREATE_FAILED_DIRECTION_SWITCH', 'Unable to create transaction, because the position direction would be switched (from long to short or vice versa). Please close the position (to a zero balance) first, then enter a second transaction.');
31
43
 
32
44
  return PortfolioFailureType;
33
45
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.0.197",
3
+ "version": "1.0.198",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",