@barchart/portfolio-api-common 1.0.246 → 1.0.250
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.
|
@@ -13,7 +13,18 @@ module.exports = (() => {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* The portfolio
|
|
16
|
+
* The portfolio does not exist.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
* @static
|
|
20
|
+
* @returns {FailureType}
|
|
21
|
+
*/
|
|
22
|
+
static get PORTFOLIO_UPDATE_FAILED_NO_PORTFOLIO() {
|
|
23
|
+
return portfolioUpdateFailedNoPortfolio;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The portfolio does not exist.
|
|
17
28
|
*
|
|
18
29
|
* @public
|
|
19
30
|
* @static
|
|
@@ -24,7 +35,18 @@ module.exports = (() => {
|
|
|
24
35
|
}
|
|
25
36
|
|
|
26
37
|
/**
|
|
27
|
-
* The
|
|
38
|
+
* The portfolio does not exist.
|
|
39
|
+
*
|
|
40
|
+
* @public
|
|
41
|
+
* @static
|
|
42
|
+
* @returns {FailureType}
|
|
43
|
+
*/
|
|
44
|
+
static get POSITION_UPDATE_FAILED_NO_POSITION() {
|
|
45
|
+
return positionUpdateFailedNoPosition;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The position does not exist.
|
|
28
50
|
*
|
|
29
51
|
* @public
|
|
30
52
|
* @static
|
|
@@ -103,7 +125,10 @@ module.exports = (() => {
|
|
|
103
125
|
}
|
|
104
126
|
}
|
|
105
127
|
|
|
106
|
-
const
|
|
128
|
+
const portfolioUpdateFailedNoPortfolio = new FailureType('PORTFOLIO_UPDATED_FAILED_NO_PORTFOLIO', 'Unable to update portfolio. The portfolio does not exist, has it been deleted?');
|
|
129
|
+
|
|
130
|
+
const positionCreateFailedNoPortfolio = new FailureType('POSITION_CREATE_FAILED_NO_PORTFOLIO', 'Unable to create transaction. The portfolio does not exist, has it been deleted?');
|
|
131
|
+
const positionUpdateFailedNoPosition = new FailureType('POSITION_UPDATE_FAILED_NO_POSITION', 'Unable to update preferences for position. The position does not exist, has it been deleted?');
|
|
107
132
|
|
|
108
133
|
const transactionCreateFailedNoPosition = new FailureType('TRANSACTION_CREATE_FAILED_NO_POSITION', 'Unable to create transaction. The referenced position does not exist. Has it been deleted?');
|
|
109
134
|
const transactionCreateFailedOutOfSequence = new FailureType('TRANSACTION_CREATE_FAILED_OUT_OF_SEQUENCE', 'Unable to process 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).');
|
|
@@ -88,7 +88,7 @@ module.exports = (() => {
|
|
|
88
88
|
.withField('open', DataType.BOOLEAN, true)
|
|
89
89
|
.withField('transaction', DataType.NUMBER)
|
|
90
90
|
.withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
91
|
-
.withField('reinvest', DataType.BOOLEAN)
|
|
91
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
92
92
|
.withField('snapshot.date', DataType.DAY)
|
|
93
93
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
94
94
|
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
@@ -120,7 +120,7 @@ module.exports = (() => {
|
|
|
120
120
|
.withField('open', DataType.BOOLEAN, true)
|
|
121
121
|
.withField('transaction', DataType.NUMBER)
|
|
122
122
|
.withField('valuation', DataType.forEnum(ValuationType, 'ValuationType'))
|
|
123
|
-
.withField('reinvest', DataType.BOOLEAN)
|
|
123
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
124
124
|
.withField('snapshot.date', DataType.DAY)
|
|
125
125
|
.withField('snapshot.open', DataType.DECIMAL)
|
|
126
126
|
.withField('snapshot.direction', DataType.forEnum(PositionDirection, 'PositionDirection'))
|
|
@@ -129,13 +129,14 @@ module.exports = (() => {
|
|
|
129
129
|
.withField('snapshot.gain', DataType.DECIMAL)
|
|
130
130
|
.withField('snapshot.basis', DataType.DECIMAL)
|
|
131
131
|
.withField('snapshot.income', DataType.DECIMAL)
|
|
132
|
-
.withField('snapshot.value', DataType.DECIMAL)
|
|
132
|
+
.withField('snapshot.value', DataType.DECIMAL)rm pa
|
|
133
133
|
.withField('previous', DataType.NUMBER, true)
|
|
134
134
|
.schema
|
|
135
135
|
);
|
|
136
136
|
|
|
137
137
|
const update = new PositionSchema(SchemaBuilder.withName('update')
|
|
138
138
|
.withField('portfolio', DataType.STRING)
|
|
139
|
+
.withField('position', DataType.STRING)
|
|
139
140
|
.withField('reinvest', DataType.BOOLEAN, true)
|
|
140
141
|
.schema
|
|
141
142
|
);
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -3830,6 +3830,33 @@ module.exports = function () {
|
|
|
3830
3830
|
}
|
|
3831
3831
|
}
|
|
3832
3832
|
|
|
3833
|
+
/**
|
|
3834
|
+
* Climbs the tree, evaluating each parent until a predicate is matched. Once matched,
|
|
3835
|
+
* the {@link Tree} node is returned. Otherwise, if the predicate cannot be matched,
|
|
3836
|
+
* a null value is returned.
|
|
3837
|
+
*
|
|
3838
|
+
* @public
|
|
3839
|
+
* @param {Tree~nodePredicate} predicate - A predicate that tests each child node. The predicate takes two arguments -- the node's value, and the node itself.
|
|
3840
|
+
* @param {boolean=} includeCurrentNode - If true, the predicate will be applied to the current node.
|
|
3841
|
+
* @returns {Tree|null}
|
|
3842
|
+
*/
|
|
3843
|
+
|
|
3844
|
+
}, {
|
|
3845
|
+
key: 'findParent',
|
|
3846
|
+
value: function findParent(predicate, includeCurrentNode) {
|
|
3847
|
+
var returnRef = void 0;
|
|
3848
|
+
|
|
3849
|
+
if (is.boolean(includeCurrentNode) && includeCurrentNode && predicate(this.getValue(), this)) {
|
|
3850
|
+
returnRef = this;
|
|
3851
|
+
} else if (this._parent !== null) {
|
|
3852
|
+
returnRef = this._parent.findParent(predicate, true);
|
|
3853
|
+
} else {
|
|
3854
|
+
returnRef = null;
|
|
3855
|
+
}
|
|
3856
|
+
|
|
3857
|
+
return returnRef;
|
|
3858
|
+
}
|
|
3859
|
+
|
|
3833
3860
|
/**
|
|
3834
3861
|
* Creates a representation of the tree using JavaScript objects and arrays.
|
|
3835
3862
|
*
|