@barchart/portfolio-client-js 3.3.0 → 3.4.1
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/.releases/3.3.0.md +1 -1
- package/.releases/3.4.0.md +3 -0
- package/.releases/3.4.1.md +3 -0
- package/lib/gateway/PortfolioGateway.js +61 -13
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/.releases/3.3.0.md
CHANGED
|
@@ -44,7 +44,7 @@ module.exports = (() => {
|
|
|
44
44
|
* @param {String} host - The hostname of the Portfolio web service.
|
|
45
45
|
* @param {Number} port - The TCP port number of the Portfolio web service.
|
|
46
46
|
* @param {String} environment - A description of the environment we're connecting to.
|
|
47
|
-
* @param {String=} product - A product
|
|
47
|
+
* @param {String=} product - A code for the product which is using the gateway.
|
|
48
48
|
* @extends {Disposable}
|
|
49
49
|
*/
|
|
50
50
|
class PortfolioGateway extends Disposable {
|
|
@@ -424,6 +424,23 @@ module.exports = (() => {
|
|
|
424
424
|
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
425
425
|
.endpoint;
|
|
426
426
|
|
|
427
|
+
this._readMarketValueEndpoint = EndpointBuilder.for('read-market-value', 'read market value')
|
|
428
|
+
.withVerb(VerbType.GET)
|
|
429
|
+
.withProtocol(protocolType)
|
|
430
|
+
.withHost(host)
|
|
431
|
+
.withPort(port)
|
|
432
|
+
.withPathBuilder((pb) => {
|
|
433
|
+
pb.withLiteralParameter('version', 'v1')
|
|
434
|
+
.withLiteralParameter('values', 'values');
|
|
435
|
+
})
|
|
436
|
+
.withQueryBuilder((qb) => {
|
|
437
|
+
qb.withVariableParameter('symbol', 'symbol', 'symbol', false);
|
|
438
|
+
})
|
|
439
|
+
.withRequestInterceptor(requestInterceptor)
|
|
440
|
+
.withResponseInterceptor(ResponseInterceptor.DATA)
|
|
441
|
+
.withErrorInterceptor(ErrorInterceptor.GENERAL)
|
|
442
|
+
.endpoint;
|
|
443
|
+
|
|
427
444
|
this._brokerageReportUrlGenerator = (user, portfolio, frame, end) => {
|
|
428
445
|
return `https://${Configuration.getBrokerageHost(host)}/reports/portfolios/${portfolio}/frames/${frame.code}/date/${end.format()}/${user}`;
|
|
429
446
|
};
|
|
@@ -1129,6 +1146,25 @@ module.exports = (() => {
|
|
|
1129
1146
|
});
|
|
1130
1147
|
}
|
|
1131
1148
|
|
|
1149
|
+
/**
|
|
1150
|
+
* Returns all market value for a symbol.
|
|
1151
|
+
*
|
|
1152
|
+
* @public
|
|
1153
|
+
* @param {String} symbol
|
|
1154
|
+
*/
|
|
1155
|
+
readMarketValue(symbol) {
|
|
1156
|
+
return Promise.resolve()
|
|
1157
|
+
.then(() => {
|
|
1158
|
+
assert.argumentIsRequired(symbol, 'symbol', String);
|
|
1159
|
+
|
|
1160
|
+
const payload = { };
|
|
1161
|
+
|
|
1162
|
+
payload.symbol = symbol;
|
|
1163
|
+
|
|
1164
|
+
return Gateway.invoke(this._readMarketValueEndpoint, payload);
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1132
1168
|
/**
|
|
1133
1169
|
* Generates a URL suitable for downloading a brokerage report (as a PDF).
|
|
1134
1170
|
*
|
|
@@ -1186,14 +1222,16 @@ module.exports = (() => {
|
|
|
1186
1222
|
* @public
|
|
1187
1223
|
* @static
|
|
1188
1224
|
* @param {JwtProvider} jwtProvider
|
|
1225
|
+
* @param {String=} product
|
|
1189
1226
|
* @returns {Promise<PortfolioGateway>}
|
|
1190
1227
|
*/
|
|
1191
|
-
static forTest(jwtProvider) {
|
|
1228
|
+
static forTest(jwtProvider, product) {
|
|
1192
1229
|
return Promise.resolve()
|
|
1193
1230
|
.then(() => {
|
|
1194
1231
|
assert.argumentIsRequired(jwtProvider, 'jwtProvider', JwtProvider, 'JwtProvider');
|
|
1232
|
+
assert.argumentIsOptional(product, 'product', String);
|
|
1195
1233
|
|
|
1196
|
-
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.testHost, REST_API_SECURE_PORT, 'test'), jwtProvider);
|
|
1234
|
+
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.testHost, REST_API_SECURE_PORT, 'test', product), jwtProvider);
|
|
1197
1235
|
});
|
|
1198
1236
|
}
|
|
1199
1237
|
|
|
@@ -1203,14 +1241,16 @@ module.exports = (() => {
|
|
|
1203
1241
|
* @public
|
|
1204
1242
|
* @static
|
|
1205
1243
|
* @param {JwtProvider} jwtProvider
|
|
1244
|
+
* @param {String=} product
|
|
1206
1245
|
* @returns {Promise<PortfolioGateway>}
|
|
1207
1246
|
*/
|
|
1208
|
-
static forDevelopment(jwtProvider) {
|
|
1247
|
+
static forDevelopment(jwtProvider, product) {
|
|
1209
1248
|
return Promise.resolve()
|
|
1210
1249
|
.then(() => {
|
|
1211
1250
|
assert.argumentIsRequired(jwtProvider, 'jwtProvider', JwtProvider, 'JwtProvider');
|
|
1251
|
+
assert.argumentIsOptional(product, 'product', String);
|
|
1212
1252
|
|
|
1213
|
-
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.developmentHost, REST_API_SECURE_PORT, 'development'), jwtProvider);
|
|
1253
|
+
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.developmentHost, REST_API_SECURE_PORT, 'development', product), jwtProvider);
|
|
1214
1254
|
});
|
|
1215
1255
|
}
|
|
1216
1256
|
|
|
@@ -1220,14 +1260,16 @@ module.exports = (() => {
|
|
|
1220
1260
|
* @public
|
|
1221
1261
|
* @static
|
|
1222
1262
|
* @param {JwtProvider} jwtProvider
|
|
1263
|
+
* @param {String=} product
|
|
1223
1264
|
* @returns {Promise<PortfolioGateway>}
|
|
1224
1265
|
*/
|
|
1225
|
-
static forStaging(jwtProvider) {
|
|
1266
|
+
static forStaging(jwtProvider, product) {
|
|
1226
1267
|
return Promise.resolve()
|
|
1227
1268
|
.then(() => {
|
|
1228
1269
|
assert.argumentIsRequired(jwtProvider, 'jwtProvider', JwtProvider, 'JwtProvider');
|
|
1270
|
+
assert.argumentIsOptional(product, 'product', String);
|
|
1229
1271
|
|
|
1230
|
-
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.stagingHost, REST_API_SECURE_PORT, 'staging'), jwtProvider);
|
|
1272
|
+
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.stagingHost, REST_API_SECURE_PORT, 'staging', product), jwtProvider);
|
|
1231
1273
|
});
|
|
1232
1274
|
}
|
|
1233
1275
|
|
|
@@ -1237,14 +1279,16 @@ module.exports = (() => {
|
|
|
1237
1279
|
* @public
|
|
1238
1280
|
* @static
|
|
1239
1281
|
* @param {JwtProvider} jwtProvider
|
|
1282
|
+
* @param {String=} product
|
|
1240
1283
|
* @returns {Promise<PortfolioGateway>}
|
|
1241
1284
|
*/
|
|
1242
|
-
static forDemo(jwtProvider) {
|
|
1285
|
+
static forDemo(jwtProvider, product) {
|
|
1243
1286
|
return Promise.resolve()
|
|
1244
1287
|
.then(() => {
|
|
1245
1288
|
assert.argumentIsRequired(jwtProvider, 'jwtProvider', JwtProvider, 'JwtProvider');
|
|
1289
|
+
assert.argumentIsOptional(product, 'product', String);
|
|
1246
1290
|
|
|
1247
|
-
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.demoHost, REST_API_SECURE_PORT, 'demo'), jwtProvider);
|
|
1291
|
+
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.demoHost, REST_API_SECURE_PORT, 'demo', product), jwtProvider);
|
|
1248
1292
|
});
|
|
1249
1293
|
}
|
|
1250
1294
|
|
|
@@ -1254,14 +1298,16 @@ module.exports = (() => {
|
|
|
1254
1298
|
* @public
|
|
1255
1299
|
* @static
|
|
1256
1300
|
* @param {JwtProvider} jwtProvider
|
|
1301
|
+
* @param {String=} product
|
|
1257
1302
|
* @returns {Promise<PortfolioGateway>}
|
|
1258
1303
|
*/
|
|
1259
|
-
static forProduction(jwtProvider) {
|
|
1304
|
+
static forProduction(jwtProvider, product) {
|
|
1260
1305
|
return Promise.resolve()
|
|
1261
1306
|
.then(() => {
|
|
1262
1307
|
assert.argumentIsRequired(jwtProvider, 'jwtProvider', JwtProvider, 'JwtProvider');
|
|
1308
|
+
assert.argumentIsOptional(product, 'product', String);
|
|
1263
1309
|
|
|
1264
|
-
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.productionHost, REST_API_SECURE_PORT, 'production'), jwtProvider);
|
|
1310
|
+
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.productionHost, REST_API_SECURE_PORT, 'production', product), jwtProvider);
|
|
1265
1311
|
});
|
|
1266
1312
|
}
|
|
1267
1313
|
|
|
@@ -1271,14 +1317,16 @@ module.exports = (() => {
|
|
|
1271
1317
|
* @public
|
|
1272
1318
|
* @static
|
|
1273
1319
|
* @param {JwtProvider} jwtProvider
|
|
1320
|
+
* @param {String=} product
|
|
1274
1321
|
* @returns {Promise<PortfolioGateway>}
|
|
1275
1322
|
*/
|
|
1276
|
-
static forAdmin(jwtProvider) {
|
|
1323
|
+
static forAdmin(jwtProvider, product) {
|
|
1277
1324
|
return Promise.resolve()
|
|
1278
1325
|
.then(() => {
|
|
1279
1326
|
assert.argumentIsRequired(jwtProvider, 'jwtProvider', JwtProvider, 'JwtProvider');
|
|
1327
|
+
assert.argumentIsOptional(product, 'product', String);
|
|
1280
1328
|
|
|
1281
|
-
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.adminHost, REST_API_SECURE_PORT, 'admin'), jwtProvider);
|
|
1329
|
+
return start(new PortfolioGateway(REST_API_SECURE_PROTOCOL, Configuration.adminHost, REST_API_SECURE_PORT, 'admin', product), jwtProvider);
|
|
1282
1330
|
});
|
|
1283
1331
|
}
|
|
1284
1332
|
|
package/lib/index.js
CHANGED