@barchart/portfolio-api-common 1.2.45 → 1.2.46

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.
@@ -131,6 +131,18 @@ module.exports = (() => {
131
131
  return transactionCreateFailedTypeReserved;
132
132
  }
133
133
 
134
+ /**
135
+ * The transaction failed because a dividend would be reinvested on
136
+ * a day for which no historical price is available.
137
+ *
138
+ * @public
139
+ * @static
140
+ * @returns {FailureType}
141
+ */
142
+ static get TRANSACTION_CREATE_FAILED_REINVEST_PRICE_UNAVAILABLE() {
143
+ return transactionCreateFailedReinvestPriceUnavailable;
144
+ }
145
+
134
146
  /**
135
147
  * Deleting any transaction except for the most recent requires
136
148
  * re-writing transaction history.
@@ -206,6 +218,7 @@ module.exports = (() => {
206
218
  const transactionCreateFailedInvalidDirectionSwitch = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_DIRECTION_SWITCH', 'Unable to process transaction, the transaction would switch the position from {L|currentDirection.description} to {L|proposedDirection.description} (i.e. {L|currentDirection.sign} to {L|proposedDirection.sign} shares/units). This is not allowed. Please close the current position (i.e. zero it out) and then enter a second transaction.');
207
219
  const transactionCreateFailedInvalidInitialType = new FailureType('TRANSACTION_CREATE_FAILED_INVALID_INITIAL_TYPE', 'Unable to process operation because the first transaction would to be a {U|transactionType.description}, which is not allowed -- since {U|transactionType.description} transactions cannot open a position.');
208
220
  const transactionCreateFailedTypeReserved = new FailureType('TRANSACTION_CREATE_FAILED_TYPE_RESERVED', 'Unable to create {U|type.description} transaction, this type of transaction is managed by the system.');
221
+ const transactionCreateFailedReinvestPriceUnavailable = new FailureType('TRANSACTION_CREATE_FAILED_REINVEST_PRICE_UNAVAILABLE', 'Unable to create transaction, a dividend was paid on {L|day}; however no historical price is available for this day. To successfully create this transaction, please turn off dividend reinvestment for this position.');
209
222
 
210
223
  const transactionDeleteFailedOutOfSequence = new FailureType('TRANSACTION_DELETE_FAILED_OUT_OF_SEQUENCE', 'Deleting any transaction, except for the most recent, will cause transaction history to be re-written. Please confirm your intent to re-write transaction history (which could take some time and alter the historical results for this position).');
211
224
  const transactionDeleteFailedNoTransaction = new FailureType('TRANSACTION_DELETE_FAILED_NO_TRANSACTION', 'Unable to delete transaction. The referenced transaction does not exist.');
@@ -92,7 +92,7 @@ module.exports = (() => {
92
92
  * @public
93
93
  * @param {InstrumentType} instrumentType
94
94
  * @param {Boolean=} userInitiated
95
- * @pararm {PositionDirection=} currentDirection
95
+ * @param {PositionDirection=} currentDirection
96
96
  * @returns {Array.<TransactionType>}
97
97
  */
98
98
  static getTransactionTypesFor(instrumentType, userInitiated, currentDirection) {
@@ -156,7 +156,9 @@ module.exports = (() => {
156
156
  * Determines if a transaction type is valid as the first transaction of
157
157
  * a position.
158
158
  *
159
+ * @public
159
160
  * @param {TransactionType} transactionType
161
+ * @returns {Boolean}
160
162
  */
161
163
  static validateInitialTransactionType(transactionType) {
162
164
  return transactionType.initial;
@@ -1,5 +1,4 @@
1
- const assert = require('@barchart/common-js/lang/assert'),
2
- is = require('@barchart/common-js/lang/is'),
1
+ const is = require('@barchart/common-js/lang/is'),
3
2
  Currency = require('@barchart/common-js/lang/Currency'),
4
3
  DataType = require('@barchart/common-js/serialization/json/DataType'),
5
4
  Enum = require('@barchart/common-js/lang/Enum'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.45",
3
+ "version": "1.2.46",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",