@barchart/portfolio-client-js 1.2.32 → 1.2.33
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/lib/gateway/PortfolioGateway.js +44 -46
- package/lib/index.js +1 -1
- package/package.json +1 -1
|
@@ -7,9 +7,9 @@ const assert = require('@barchart/common-js/lang/assert'),
|
|
|
7
7
|
|
|
8
8
|
const TransactionType = require('@barchart/portfolio-api-common/lib/data/TransactionType');
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const BrokerageReportAvailabilitySchema = require('@barchart/portfolio-api-common/lib/serialization/reports/BrokerageReportAvailabilitySchema'),
|
|
11
|
+
PortfolioSchema = require('@barchart/portfolio-api-common/lib/serialization/PortfolioSchema'),
|
|
11
12
|
PositionSummarySchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummarySchema'),
|
|
12
|
-
PositionSummaryDefinitionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSummaryDefinitionSchema'),
|
|
13
13
|
PositionSchema = require('@barchart/portfolio-api-common/lib/serialization/PositionSchema'),
|
|
14
14
|
TransactionSchema = require('@barchart/portfolio-api-common/lib/serialization/TransactionSchema');
|
|
15
15
|
|
|
@@ -197,26 +197,6 @@ module.exports = (() => {
|
|
|
197
197
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
198
198
|
.endpoint;
|
|
199
199
|
|
|
200
|
-
this._readPositionSummaryDefinitionEndpoint = EndpointBuilder.for('read-position-summary-definitions', 'read position summary definitions')
|
|
201
|
-
.withVerb(VerbType.GET)
|
|
202
|
-
.withProtocol(protocolType)
|
|
203
|
-
.withHost(host)
|
|
204
|
-
.withPort(port)
|
|
205
|
-
.withPathBuilder((pb) => {
|
|
206
|
-
pb.withLiteralParameter('portfolios', 'portfolios')
|
|
207
|
-
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
208
|
-
.withLiteralParameter('summaries', 'summaries')
|
|
209
|
-
.withLiteralParameter('ranges', 'ranges');
|
|
210
|
-
})
|
|
211
|
-
.withQueryBuilder((qb) => {
|
|
212
|
-
qb.withVariableParameter('frames', 'frames', 'frames', true, frames => frames.map(f => f.code).join());
|
|
213
|
-
})
|
|
214
|
-
.withRequestInterceptor(requestInterceptorToUse)
|
|
215
|
-
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
216
|
-
.withResponseInterceptor(responseInterceptorForPositionSummaryDefinitionDeserialization)
|
|
217
|
-
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
218
|
-
.endpoint;
|
|
219
|
-
|
|
220
200
|
this._readTransactionsEndpoint = EndpointBuilder.for('read-transactions', 'read transactions')
|
|
221
201
|
.withVerb(VerbType.GET)
|
|
222
202
|
.withProtocol(protocolType)
|
|
@@ -348,6 +328,26 @@ module.exports = (() => {
|
|
|
348
328
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
349
329
|
.endpoint;
|
|
350
330
|
|
|
331
|
+
this._readBrokerageReportAvailabilityEndpoint = EndpointBuilder.for('read-brokerage-report-availability', 'read brokerage report availability')
|
|
332
|
+
.withVerb(VerbType.GET)
|
|
333
|
+
.withProtocol(protocolType)
|
|
334
|
+
.withHost(host)
|
|
335
|
+
.withPort(port)
|
|
336
|
+
.withPathBuilder((pb) => {
|
|
337
|
+
pb.withLiteralParameter('portfolios', 'portfolios')
|
|
338
|
+
.withVariableParameter('portfolio', 'portfolio', 'portfolio', false)
|
|
339
|
+
.withLiteralParameter('summaries', 'summaries')
|
|
340
|
+
.withLiteralParameter('ranges', 'ranges');
|
|
341
|
+
})
|
|
342
|
+
.withQueryBuilder((qb) => {
|
|
343
|
+
qb.withVariableParameter('frames', 'frames', 'frames', true, frames => frames.map(f => f.code).join());
|
|
344
|
+
})
|
|
345
|
+
.withRequestInterceptor(requestInterceptorToUse)
|
|
346
|
+
.withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
|
|
347
|
+
.withResponseInterceptor(responseInterceptorForBrokerageReportAvailabilityDeserialization)
|
|
348
|
+
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
349
|
+
.endpoint;
|
|
350
|
+
|
|
351
351
|
this._downloadBrokerageReportEndpoint = EndpointBuilder.for('download-brokerage-report', 'download brokerage report')
|
|
352
352
|
.withVerb(VerbType.GET)
|
|
353
353
|
.withProtocol(protocolType)
|
|
@@ -645,27 +645,6 @@ module.exports = (() => {
|
|
|
645
645
|
});
|
|
646
646
|
}
|
|
647
647
|
|
|
648
|
-
/**
|
|
649
|
-
* Returns all position summary definitions for a portfolio.
|
|
650
|
-
*
|
|
651
|
-
* @public
|
|
652
|
-
* @param {String} portfolio
|
|
653
|
-
* @param {Array.<PositionSummaryFrame>} frames
|
|
654
|
-
*/
|
|
655
|
-
readPositionSummaryDefinitions(portfolio, frames) {
|
|
656
|
-
return Promise.resolve()
|
|
657
|
-
.then(() => {
|
|
658
|
-
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
659
|
-
|
|
660
|
-
const payload = { };
|
|
661
|
-
|
|
662
|
-
payload.portfolio = portfolio;
|
|
663
|
-
payload.frames = frames;
|
|
664
|
-
|
|
665
|
-
return Gateway.invoke(this._readPositionSummaryDefinitionEndpoint, payload);
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
|
|
669
648
|
/**
|
|
670
649
|
* Deletes a position.
|
|
671
650
|
*
|
|
@@ -922,6 +901,25 @@ module.exports = (() => {
|
|
|
922
901
|
});
|
|
923
902
|
}
|
|
924
903
|
|
|
904
|
+
/**
|
|
905
|
+
* Returns all position summary definitions for a portfolio.
|
|
906
|
+
*
|
|
907
|
+
* @public
|
|
908
|
+
* @param {String} portfolio
|
|
909
|
+
*/
|
|
910
|
+
readBrokerageReportAvailability(portfolio) {
|
|
911
|
+
return Promise.resolve()
|
|
912
|
+
.then(() => {
|
|
913
|
+
assert.argumentIsRequired(portfolio, 'portfolio', String);
|
|
914
|
+
|
|
915
|
+
const payload = { };
|
|
916
|
+
|
|
917
|
+
payload.portfolio = portfolio;
|
|
918
|
+
|
|
919
|
+
return Gateway.invoke(this._readBrokerageReportAvailabilityEndpoint, payload);
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
|
|
925
923
|
/**
|
|
926
924
|
* @public
|
|
927
925
|
* @param {String=} portfolio
|
|
@@ -1102,11 +1100,11 @@ module.exports = (() => {
|
|
|
1102
1100
|
}
|
|
1103
1101
|
});
|
|
1104
1102
|
|
|
1105
|
-
const
|
|
1103
|
+
const responseInterceptorForBrokerageReportAvailabilityDeserialization = ResponseInterceptor.fromDelegate((response, ignored) => {
|
|
1106
1104
|
try {
|
|
1107
|
-
return JSON.parse(response.data,
|
|
1105
|
+
return JSON.parse(response.data, BrokerageReportAvailabilitySchema.COMPLETE.schema.getReviver());
|
|
1108
1106
|
} catch (e) {
|
|
1109
|
-
console.log('Error deserializing
|
|
1107
|
+
console.log('Error deserializing brokerage report availability definition', e);
|
|
1110
1108
|
}
|
|
1111
1109
|
});
|
|
1112
1110
|
|
package/lib/index.js
CHANGED