@barchart/portfolio-client-js 10.1.0 → 10.2.0

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/data/.meta.js CHANGED
@@ -298,6 +298,17 @@ const InstrumentType = require('@barchart/portfolio-api-common/lib/data/Instrume
298
298
  * @property {String[]} positions - Array of position identifiers for which are currently being calculated. An empty result indicates all position valuations are up-to-date.
299
299
  */
300
300
 
301
+ /**
302
+ * The result of recalculating aggregate values in a requested currency for the authorized user.
303
+ *
304
+ * @typedef UpdateValuesCurrencyResult
305
+ * @type {Object}
306
+ * @memberOf Schema
307
+ * @property {Boolean} success - Indicates the aggregate values were successfully recalculated.
308
+ * @property {String} userId - The identifier of the authorized user whose values were recalculated.
309
+ * @property {String} currency - The currency code used for the recalculation.
310
+ */
311
+
301
312
  /**
302
313
  * Instructions for connecting to a brokerage via SnapTrade.
303
314
  *
@@ -330,6 +330,23 @@ module.exports = (() => {
330
330
  .withErrorInterceptor(errorInterceptor)
331
331
  .endpoint;
332
332
 
333
+ this._updateValuesCurrencyEndpoint = EndpointBuilder.for('update-values-currency', 'update values currency')
334
+ .withVerb(VerbType.PUT)
335
+ .withProtocol(protocolType)
336
+ .withHost(host)
337
+ .withPort(port)
338
+ .withPathBuilder((pb) => {
339
+ pb.withLiteralParameter('version', REST_API_VERSION)
340
+ .withLiteralParameter('values', 'values')
341
+ .withLiteralParameter('currency', 'currency');
342
+ })
343
+ .withBody('currency')
344
+ .withRequestInterceptor(RequestInterceptor.PLAIN_TEXT_RESPONSE)
345
+ .withRequestInterceptor(requestInterceptor)
346
+ .withResponseInterceptor(responseInterceptorForDeserialization)
347
+ .withErrorInterceptor(errorInterceptor)
348
+ .endpoint;
349
+
333
350
  this._readTransactionsEndpoint = EndpointBuilder.for('read-transactions', 'read transactions')
334
351
  .withVerb(VerbType.GET)
335
352
  .withProtocol(protocolType)
@@ -1055,6 +1072,22 @@ module.exports = (() => {
1055
1072
  return Gateway.invoke(this._queryPositionValuationsEndpoint, { symbol });
1056
1073
  }
1057
1074
 
1075
+ /**
1076
+ * Recalculates aggregate values for the authorized user in the requested currency.
1077
+ *
1078
+ * @public
1079
+ * @async
1080
+ * @param {String} currency - The target currency code (e.g. `USD`).
1081
+ * @returns {Promise<Schema.UpdateValuesCurrencyResult>}
1082
+ */
1083
+ async updateValuesCurrency(currency) {
1084
+ checkStart.call(this);
1085
+
1086
+ assert.argumentIsRequired(currency, 'currency', String);
1087
+
1088
+ return Gateway.invoke(this._updateValuesCurrencyEndpoint, { currency });
1089
+ }
1090
+
1058
1091
  /**
1059
1092
  * Creates a new transaction.
1060
1093
  *
@@ -1920,4 +1953,4 @@ module.exports = (() => {
1920
1953
  */
1921
1954
 
1922
1955
  return PortfolioGateway;
1923
- })();
1956
+ })();
package/lib/index.js CHANGED
@@ -7,6 +7,6 @@ module.exports = (() => {
7
7
  return {
8
8
  JwtProvider: JwtProvider,
9
9
  PortfolioGateway: PortfolioGateway,
10
- version: '10.1.0'
10
+ version: '10.2.0'
11
11
  };
12
12
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-client-js",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "JavaScript SDK for Barchart's Portfolio Service",
5
5
  "homepage": "https://docs.barchart.com/portfolio/#/",
6
6
  "author": {