@barchart/portfolio-api-common 1.0.244 → 1.0.248
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).');
|
|
@@ -564,6 +564,20 @@ module.exports = (() => {
|
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
|
|
567
|
+
/**
|
|
568
|
+
* Returns a single position for a portfolio.
|
|
569
|
+
*
|
|
570
|
+
* @public
|
|
571
|
+
* @param {String} portfolio
|
|
572
|
+
* @param {String} position
|
|
573
|
+
* @return {Object|null}
|
|
574
|
+
*/
|
|
575
|
+
getPosition(portfolio, position) {
|
|
576
|
+
assert.argumentIsRequired(position, 'position', String);
|
|
577
|
+
|
|
578
|
+
return this.getPositions(portfolio).find(p => p.position === position) || null;
|
|
579
|
+
}
|
|
580
|
+
|
|
567
581
|
/**
|
|
568
582
|
* Pauses aggregation calculations during the processing of an action.
|
|
569
583
|
*
|
|
@@ -58,6 +58,17 @@ module.exports = (() => {
|
|
|
58
58
|
return client;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* Data required to update a position.
|
|
63
|
+
*
|
|
64
|
+
* @static
|
|
65
|
+
* @public
|
|
66
|
+
* @returns {PositionSchema}
|
|
67
|
+
*/
|
|
68
|
+
static get UPDATE() {
|
|
69
|
+
return update;
|
|
70
|
+
}
|
|
71
|
+
|
|
61
72
|
toString() {
|
|
62
73
|
return '[PositionSchema]';
|
|
63
74
|
}
|
|
@@ -123,5 +134,11 @@ module.exports = (() => {
|
|
|
123
134
|
.schema
|
|
124
135
|
);
|
|
125
136
|
|
|
137
|
+
const update = new PositionSchema(SchemaBuilder.withName('update')
|
|
138
|
+
.withField('position', DataType.STRING)
|
|
139
|
+
.withField('reinvest', DataType.BOOLEAN, true)
|
|
140
|
+
.schema
|
|
141
|
+
);
|
|
142
|
+
|
|
126
143
|
return PositionSchema;
|
|
127
144
|
})();
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1363,6 +1363,20 @@ module.exports = (() => {
|
|
|
1363
1363
|
});
|
|
1364
1364
|
}
|
|
1365
1365
|
|
|
1366
|
+
/**
|
|
1367
|
+
* Returns a single position for a portfolio.
|
|
1368
|
+
*
|
|
1369
|
+
* @public
|
|
1370
|
+
* @param {String} portfolio
|
|
1371
|
+
* @param {String} position
|
|
1372
|
+
* @return {Object|null}
|
|
1373
|
+
*/
|
|
1374
|
+
getPosition(portfolio, position) {
|
|
1375
|
+
assert.argumentIsRequired(position, 'position', String);
|
|
1376
|
+
|
|
1377
|
+
return this.getPositions(portfolio).find(p => p.position === position) || null;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1366
1380
|
/**
|
|
1367
1381
|
* Pauses aggregation calculations during the processing of an action.
|
|
1368
1382
|
*
|