@barchart/portfolio-client-js 1.2.13 → 1.2.16
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.
- package/example/example.js +33 -5
- package/lib/gateway/PortfolioGateway.js +32 -5
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/example/example.js
CHANGED
|
@@ -193,8 +193,6 @@ module.exports = function () {
|
|
|
193
193
|
|
|
194
194
|
_this._readPortfoliosEndpoint = EndpointBuilder.for('read-portfolios', 'read portfolios').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
195
195
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
196
|
-
}).withHeadersBuilder(function (hb) {
|
|
197
|
-
hb.withLiteralParameter('Accept-Encoding', 'Accept-Encoding', 'gzip');
|
|
198
196
|
}).withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(responseInterceptorForPortfolioDeserialization).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
199
197
|
|
|
200
198
|
_this._createPortfolioEndpoint = EndpointBuilder.for('create-portfolio', 'create portfolio').withVerb(VerbType.POST).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
@@ -269,6 +267,8 @@ module.exports = function () {
|
|
|
269
267
|
|
|
270
268
|
_this._readTransactionsReportEndpoint = EndpointBuilder.for('read-transaction-report', 'read transaction report').withVerb(VerbType.GET).withProtocol(protocolType).withHost(host).withPort(port).withPathBuilder(function (pb) {
|
|
271
269
|
pb.withLiteralParameter('portfolios', 'portfolios').withVariableParameter('portfolio', 'portfolio', 'portfolio', false).withLiteralParameter('positions', 'positions').withVariableParameter('position', 'position', 'position', true).withLiteralParameter('transactions', 'transactions').withLiteralParameter('formatted', 'formatted');
|
|
270
|
+
}).withQueryBuilder(function (qb) {
|
|
271
|
+
qb.withVariableParameter('start', 'start', 'start', true).withVariableParameter('end', 'end', 'end', true);
|
|
272
272
|
}).withRequestInterceptor(requestInterceptorToUse).withResponseInterceptor(ResponseInterceptor.DATA).withErrorInterceptor(ErrorInterceptor.GENERAL).endpoint;
|
|
273
273
|
return _this;
|
|
274
274
|
}
|
|
@@ -722,9 +722,22 @@ module.exports = function () {
|
|
|
722
722
|
return Gateway.invoke(_this16._readTransactionsEndpoint, { portfolio: portfolio, position: position || '*' });
|
|
723
723
|
});
|
|
724
724
|
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* Retrieves transactions, where the property values are suitable for display,
|
|
728
|
+
* for a portfolio, or a single position.
|
|
729
|
+
*
|
|
730
|
+
* @public
|
|
731
|
+
* @param {String} portfolio
|
|
732
|
+
* @param {String=} position
|
|
733
|
+
* @param {Day=} startDay
|
|
734
|
+
* @param {Day=} endDay
|
|
735
|
+
* @returns {Promise.<Object[]>}
|
|
736
|
+
*/
|
|
737
|
+
|
|
725
738
|
}, {
|
|
726
739
|
key: 'readTransactionsFormatted',
|
|
727
|
-
value: function readTransactionsFormatted(portfolio, position) {
|
|
740
|
+
value: function readTransactionsFormatted(portfolio, position, startDay, endDay) {
|
|
728
741
|
var _this17 = this;
|
|
729
742
|
|
|
730
743
|
return Promise.resolve().then(function () {
|
|
@@ -732,8 +745,23 @@ module.exports = function () {
|
|
|
732
745
|
|
|
733
746
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
734
747
|
assert.argumentIsOptional(position, 'position', String);
|
|
748
|
+
assert.argumentIsOptional(startDay, 'startDay', Day, 'Day');
|
|
749
|
+
assert.argumentIsOptional(endDay, 'endDay', Day, 'Day');
|
|
750
|
+
|
|
751
|
+
var payload = {};
|
|
752
|
+
|
|
753
|
+
payload.portfolio = portfolio;
|
|
754
|
+
payload.position = position || '*';
|
|
755
|
+
|
|
756
|
+
if (startDay) {
|
|
757
|
+
payload.start = startDay;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
if (endDay) {
|
|
761
|
+
payload.end = endDay;
|
|
762
|
+
}
|
|
735
763
|
|
|
736
|
-
return Gateway.invoke(_this17._readTransactionsReportEndpoint,
|
|
764
|
+
return Gateway.invoke(_this17._readTransactionsReportEndpoint, payload);
|
|
737
765
|
});
|
|
738
766
|
}
|
|
739
767
|
|
|
@@ -1324,7 +1352,7 @@ module.exports = function () {
|
|
|
1324
1352
|
return {
|
|
1325
1353
|
JwtGateway: JwtGateway,
|
|
1326
1354
|
PortfolioGateway: PortfolioGateway,
|
|
1327
|
-
version: '1.2.
|
|
1355
|
+
version: '1.2.16'
|
|
1328
1356
|
};
|
|
1329
1357
|
}();
|
|
1330
1358
|
|
|
@@ -66,9 +66,6 @@ module.exports = (() => {
|
|
|
66
66
|
pb.withLiteralParameter('portfolios', 'portfolios')
|
|
67
67
|
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false);
|
|
68
68
|
})
|
|
69
|
-
.withHeadersBuilder((hb) => {
|
|
70
|
-
hb.withLiteralParameter('Accept-Encoding', 'Accept-Encoding', 'gzip')
|
|
71
|
-
})
|
|
72
69
|
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
73
70
|
.withRequestInterceptor(requestInterceptorToUse)
|
|
74
71
|
.withResponseInterceptor(responseInterceptorForPortfolioDeserialization)
|
|
@@ -315,6 +312,10 @@ module.exports = (() => {
|
|
|
315
312
|
.withLiteralParameter('transactions', 'transactions')
|
|
316
313
|
.withLiteralParameter('formatted', 'formatted');
|
|
317
314
|
})
|
|
315
|
+
.withQueryBuilder((qb) => {
|
|
316
|
+
qb.withVariableParameter('start', 'start', 'start', true)
|
|
317
|
+
.withVariableParameter('end', 'end', 'end', true);
|
|
318
|
+
})
|
|
318
319
|
.withRequestInterceptor(requestInterceptorToUse)
|
|
319
320
|
.withResponseInterceptor(ResponseInterceptor.DATA)
|
|
320
321
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
@@ -714,15 +715,41 @@ module.exports = (() => {
|
|
|
714
715
|
});
|
|
715
716
|
}
|
|
716
717
|
|
|
717
|
-
|
|
718
|
+
/**
|
|
719
|
+
* Retrieves transactions, where the property values are suitable for display,
|
|
720
|
+
* for a portfolio, or a single position.
|
|
721
|
+
*
|
|
722
|
+
* @public
|
|
723
|
+
* @param {String} portfolio
|
|
724
|
+
* @param {String=} position
|
|
725
|
+
* @param {Day=} startDay
|
|
726
|
+
* @param {Day=} endDay
|
|
727
|
+
* @returns {Promise.<Object[]>}
|
|
728
|
+
*/
|
|
729
|
+
readTransactionsFormatted(portfolio, position, startDay, endDay) {
|
|
718
730
|
return Promise.resolve()
|
|
719
731
|
.then(() => {
|
|
720
732
|
checkStart.call(this);
|
|
721
733
|
|
|
722
734
|
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
723
735
|
assert.argumentIsOptional(position, 'position', String);
|
|
736
|
+
assert.argumentIsOptional(startDay, 'startDay', Day, 'Day');
|
|
737
|
+
assert.argumentIsOptional(endDay, 'endDay', Day, 'Day');
|
|
738
|
+
|
|
739
|
+
const payload = { };
|
|
740
|
+
|
|
741
|
+
payload.portfolio = portfolio;
|
|
742
|
+
payload.position = position || '*';
|
|
743
|
+
|
|
744
|
+
if (startDay) {
|
|
745
|
+
payload.start = startDay;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
if (endDay) {
|
|
749
|
+
payload.end = endDay;
|
|
750
|
+
}
|
|
724
751
|
|
|
725
|
-
return Gateway.invoke(this._readTransactionsReportEndpoint,
|
|
752
|
+
return Gateway.invoke(this._readTransactionsReportEndpoint, payload);
|
|
726
753
|
});
|
|
727
754
|
}
|
|
728
755
|
|
package/lib/index.js
CHANGED