@barchart/portfolio-api-common 1.0.252 → 1.0.256
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.
|
@@ -120,6 +120,17 @@ module.exports = (() => {
|
|
|
120
120
|
return transactionDeleteFailedNoTransaction;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* Unable to delete, the position's direction would switch.
|
|
125
|
+
*
|
|
126
|
+
* @public
|
|
127
|
+
* @static
|
|
128
|
+
* @returns {FailureType}
|
|
129
|
+
*/
|
|
130
|
+
static get TRANSACTION_DELETE_FAILED_DIRECTION_SWITCH_ON_REWRITE() {
|
|
131
|
+
return transactionDeleteFailedDirectionSwitchOnRewrite;
|
|
132
|
+
}
|
|
133
|
+
|
|
123
134
|
toString() {
|
|
124
135
|
return '[PortfolioFailureType]';
|
|
125
136
|
}
|
|
@@ -138,6 +149,7 @@ module.exports = (() => {
|
|
|
138
149
|
|
|
139
150
|
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).');
|
|
140
151
|
const transactionDeleteFailedNoTransaction = new FailureType('TRANSACTION_DELETE_FAILED_NO_TRANSACTION', 'Unable to delete transaction. The referenced transaction does not exist.');
|
|
152
|
+
const transactionDeleteFailedDirectionSwitchOnRewrite = new FailureType('TRANSACTION_DELETE_FAILED_DIRECTION_SWITCH_ON_REWRITE', 'Deleting this transaction would cause your history to be re-written and the position to switch from long to short (i.e. positive to negative) or vice versa.');
|
|
141
153
|
|
|
142
154
|
return PortfolioFailureType;
|
|
143
155
|
})();
|
|
@@ -730,7 +730,7 @@ module.exports = (() => {
|
|
|
730
730
|
actual.unrealized = updates.unrealized;
|
|
731
731
|
actual.unrealizedToday = updates.unrealizedToday;
|
|
732
732
|
actual.summaryTotalCurrent = updates.summaryTotalCurrent;
|
|
733
|
-
actual.total = updates.
|
|
733
|
+
actual.total = updates.unrealized.add(actual.realized).add(actual.income);
|
|
734
734
|
|
|
735
735
|
format.market = formatCurrency(actual.market, currency);
|
|
736
736
|
|
|
@@ -258,6 +258,7 @@ module.exports = (() => {
|
|
|
258
258
|
.withField('quantity', DataType.DECIMAL)
|
|
259
259
|
.withField('fee', DataType.DECIMAL, true)
|
|
260
260
|
.withField('force', DataType.BOOLEAN, true)
|
|
261
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
261
262
|
.schema
|
|
262
263
|
);
|
|
263
264
|
|
|
@@ -299,6 +300,7 @@ module.exports = (() => {
|
|
|
299
300
|
.withField('quantity', DataType.DECIMAL)
|
|
300
301
|
.withField('fee', DataType.DECIMAL, true)
|
|
301
302
|
.withField('force', DataType.BOOLEAN, true)
|
|
303
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
302
304
|
.schema
|
|
303
305
|
);
|
|
304
306
|
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -2487,7 +2487,7 @@ module.exports = (() => {
|
|
|
2487
2487
|
actual.unrealized = updates.unrealized;
|
|
2488
2488
|
actual.unrealizedToday = updates.unrealizedToday;
|
|
2489
2489
|
actual.summaryTotalCurrent = updates.summaryTotalCurrent;
|
|
2490
|
-
actual.total = updates.
|
|
2490
|
+
actual.total = updates.unrealized.add(actual.realized).add(actual.income);
|
|
2491
2491
|
|
|
2492
2492
|
format.market = formatCurrency(actual.market, currency);
|
|
2493
2493
|
|